/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; 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 { ActivityNotificationExecutionDetailResponseDto, ActivityNotificationExecutionDetailResponseDto$inboundSchema, } from "./activitynotificationexecutiondetailresponsedto.js"; import { ActivityNotificationStepResponseDto, ActivityNotificationStepResponseDto$inboundSchema, } from "./activitynotificationstepresponsedto.js"; import { DigestMetadataDto, DigestMetadataDto$inboundSchema, } from "./digestmetadatadto.js"; import { ProvidersIdEnum, ProvidersIdEnum$inboundSchema, } from "./providersidenum.js"; /** * Type of the job */ export const ActivityNotificationJobResponseDtoType = { InApp: "in_app", Email: "email", Sms: "sms", Chat: "chat", Push: "push", Digest: "digest", Trigger: "trigger", Delay: "delay", Throttle: "throttle", Custom: "custom", HttpRequest: "http_request", } as const; /** * Type of the job */ export type ActivityNotificationJobResponseDtoType = ClosedEnum< typeof ActivityNotificationJobResponseDtoType >; /** * Optional payload for the job */ export type Payload = {}; export type ActivityNotificationJobResponseDto = { /** * Unique identifier of the job */ id: string; /** * Type of the job */ type: ActivityNotificationJobResponseDtoType; /** * Optional digest for the job, including metadata and events */ digest?: DigestMetadataDto | undefined; /** * Execution details of the job */ executionDetails: Array; /** * Step details of the job */ step: ActivityNotificationStepResponseDto; /** * Optional context object for additional error details. */ overrides?: { [k: string]: any } | undefined; /** * Optional payload for the job */ payload?: Payload | undefined; /** * Provider ID of the job */ providerId: ProvidersIdEnum; /** * Status of the job */ status: string; /** * Updated time of the notification */ updatedAt?: string | undefined; /** * The number of times the digest/delay job has been extended to align with the subscribers schedule */ scheduleExtensionsCount?: number | undefined; }; /** @internal */ export const ActivityNotificationJobResponseDtoType$inboundSchema: z.ZodNativeEnum = z.nativeEnum( ActivityNotificationJobResponseDtoType, ); /** @internal */ export const Payload$inboundSchema: z.ZodType = z.object({}); export function payloadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Payload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Payload' from JSON`, ); } /** @internal */ export const ActivityNotificationJobResponseDto$inboundSchema: z.ZodType< ActivityNotificationJobResponseDto, z.ZodTypeDef, unknown > = z.object({ _id: z.string(), type: ActivityNotificationJobResponseDtoType$inboundSchema, digest: DigestMetadataDto$inboundSchema.optional(), executionDetails: z.array( ActivityNotificationExecutionDetailResponseDto$inboundSchema, ), step: ActivityNotificationStepResponseDto$inboundSchema, overrides: z.record(z.any()).optional(), payload: z.lazy(() => Payload$inboundSchema).optional(), providerId: ProvidersIdEnum$inboundSchema, status: z.string(), updatedAt: z.string().optional(), scheduleExtensionsCount: z.number().optional(), }).transform((v) => { return remap$(v, { "_id": "id", }); }); export function activityNotificationJobResponseDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ActivityNotificationJobResponseDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ActivityNotificationJobResponseDto' from JSON`, ); }