/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { PatchPreferenceChannelsDto, PatchPreferenceChannelsDto$Outbound, PatchPreferenceChannelsDto$outboundSchema, } from "./patchpreferencechannelsdto.js"; import { ScheduleDto, ScheduleDto$Outbound, ScheduleDto$outboundSchema, } from "./scheduledto.js"; /** * Rich context object with id and optional data */ export type Two = { id: string; /** * Optional additional context data */ data?: { [k: string]: any } | undefined; }; export type Context = Two | string; export type PatchSubscriberPreferencesDto = { /** * Channel-specific preference settings */ channels?: PatchPreferenceChannelsDto | undefined; /** * Workflow internal _id, identifier or slug. If provided, update workflow specific preferences, otherwise update global preferences */ workflowId?: string | undefined; /** * Subscriber schedule */ schedule?: ScheduleDto | undefined; context?: { [k: string]: Two | string } | undefined; }; /** @internal */ export type Two$Outbound = { id: string; data?: { [k: string]: any } | undefined; }; /** @internal */ export const Two$outboundSchema: z.ZodType = z .object({ id: z.string(), data: z.record(z.any()).optional(), }); export function twoToJSON(two: Two): string { return JSON.stringify(Two$outboundSchema.parse(two)); } /** @internal */ export type Context$Outbound = Two$Outbound | string; /** @internal */ export const Context$outboundSchema: z.ZodType< Context$Outbound, z.ZodTypeDef, Context > = z.union([z.lazy(() => Two$outboundSchema), z.string()]); export function contextToJSON(context: Context): string { return JSON.stringify(Context$outboundSchema.parse(context)); } /** @internal */ export type PatchSubscriberPreferencesDto$Outbound = { channels?: PatchPreferenceChannelsDto$Outbound | undefined; workflowId?: string | undefined; schedule?: ScheduleDto$Outbound | undefined; context?: { [k: string]: Two$Outbound | string } | undefined; }; /** @internal */ export const PatchSubscriberPreferencesDto$outboundSchema: z.ZodType< PatchSubscriberPreferencesDto$Outbound, z.ZodTypeDef, PatchSubscriberPreferencesDto > = z.object({ channels: PatchPreferenceChannelsDto$outboundSchema.optional(), workflowId: z.string().optional(), schedule: ScheduleDto$outboundSchema.optional(), context: z.record(z.union([z.lazy(() => Two$outboundSchema), z.string()])) .optional(), }); export function patchSubscriberPreferencesDtoToJSON( patchSubscriberPreferencesDto: PatchSubscriberPreferencesDto, ): string { return JSON.stringify( PatchSubscriberPreferencesDto$outboundSchema.parse( patchSubscriberPreferencesDto, ), ); }