/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DigestTimedConfigDto, DigestTimedConfigDto$inboundSchema, } from "./digesttimedconfigdto.js"; import { DigestTypeEnum, DigestTypeEnum$inboundSchema, } from "./digesttypeenum.js"; import { DigestUnitEnum, DigestUnitEnum$inboundSchema, } from "./digestunitenum.js"; /** * Unit of the digest */ export const DigestMetadataDtoUnit = { Seconds: "seconds", Minutes: "minutes", Hours: "hours", Days: "days", Weeks: "weeks", Months: "months", } as const; /** * Unit of the digest */ export type DigestMetadataDtoUnit = ClosedEnum; export type DigestMetadataDto = { /** * Optional key for the digest */ digestKey?: string | undefined; /** * Amount for the digest */ amount?: number | undefined; /** * Unit of the digest */ unit?: DigestMetadataDtoUnit | undefined; /** * The Digest Type */ type: DigestTypeEnum; /** * Optional array of events associated with the digest, represented as key-value pairs */ events?: Array<{ [k: string]: any }> | undefined; /** * Regular digest: Indicates if backoff is enabled for the regular digest */ backoff?: boolean | undefined; /** * Regular digest: Amount for backoff */ backoffAmount?: number | undefined; /** * Regular digest: Unit for backoff */ backoffUnit?: DigestUnitEnum | undefined; /** * Regular digest: Indicates if the digest should update */ updateMode?: boolean | undefined; /** * Configuration for timed digest */ timed?: DigestTimedConfigDto | undefined; }; /** @internal */ export const DigestMetadataDtoUnit$inboundSchema: z.ZodNativeEnum< typeof DigestMetadataDtoUnit > = z.nativeEnum(DigestMetadataDtoUnit); /** @internal */ export const DigestMetadataDto$inboundSchema: z.ZodType< DigestMetadataDto, z.ZodTypeDef, unknown > = z.object({ digestKey: z.string().optional(), amount: z.number().optional(), unit: DigestMetadataDtoUnit$inboundSchema.optional(), type: DigestTypeEnum$inboundSchema, events: z.array(z.record(z.any())).optional(), backoff: z.boolean().optional(), backoffAmount: z.number().optional(), backoffUnit: DigestUnitEnum$inboundSchema.optional(), updateMode: z.boolean().optional(), timed: DigestTimedConfigDto$inboundSchema.optional(), }); export function digestMetadataDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DigestMetadataDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DigestMetadataDto' from JSON`, ); }