/* * 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 { NotificationTriggerVariable, NotificationTriggerVariable$inboundSchema, } from "./notificationtriggervariable.js"; /** * Type of the trigger */ export const NotificationTriggerDtoType = { Event: "event", } as const; /** * Type of the trigger */ export type NotificationTriggerDtoType = ClosedEnum< typeof NotificationTriggerDtoType >; export type NotificationTriggerDto = { /** * Type of the trigger */ type: NotificationTriggerDtoType; /** * Identifier of the trigger */ identifier: string; /** * Variables of the trigger */ variables: Array; /** * Subscriber variables of the trigger */ subscriberVariables?: Array | undefined; }; /** @internal */ export const NotificationTriggerDtoType$inboundSchema: z.ZodNativeEnum< typeof NotificationTriggerDtoType > = z.nativeEnum(NotificationTriggerDtoType); /** @internal */ export const NotificationTriggerDto$inboundSchema: z.ZodType< NotificationTriggerDto, z.ZodTypeDef, unknown > = z.object({ type: NotificationTriggerDtoType$inboundSchema, identifier: z.string(), variables: z.array(NotificationTriggerVariable$inboundSchema), subscriberVariables: z.array(NotificationTriggerVariable$inboundSchema) .optional(), }); export function notificationTriggerDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NotificationTriggerDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NotificationTriggerDto' from JSON`, ); }