/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { ChatStepUpsertDto, ChatStepUpsertDto$Outbound, ChatStepUpsertDto$outboundSchema, } from "./chatstepupsertdto.js"; import { CustomStepUpsertDto, CustomStepUpsertDto$Outbound, CustomStepUpsertDto$outboundSchema, } from "./customstepupsertdto.js"; import { DelayStepUpsertDto, DelayStepUpsertDto$Outbound, DelayStepUpsertDto$outboundSchema, } from "./delaystepupsertdto.js"; import { DigestStepUpsertDto, DigestStepUpsertDto$Outbound, DigestStepUpsertDto$outboundSchema, } from "./digeststepupsertdto.js"; import { EmailStepUpsertDto, EmailStepUpsertDto$Outbound, EmailStepUpsertDto$outboundSchema, } from "./emailstepupsertdto.js"; import { HttpRequestStepUpsertDto, HttpRequestStepUpsertDto$Outbound, HttpRequestStepUpsertDto$outboundSchema, } from "./httprequeststepupsertdto.js"; import { InAppStepUpsertDto, InAppStepUpsertDto$Outbound, InAppStepUpsertDto$outboundSchema, } from "./inappstepupsertdto.js"; import { PreferencesRequestDto, PreferencesRequestDto$Outbound, PreferencesRequestDto$outboundSchema, } from "./preferencesrequestdto.js"; import { PushStepUpsertDto, PushStepUpsertDto$Outbound, PushStepUpsertDto$outboundSchema, } from "./pushstepupsertdto.js"; import { ResourceOriginEnum, ResourceOriginEnum$outboundSchema, } from "./resourceoriginenum.js"; import { SeverityLevelEnum, SeverityLevelEnum$outboundSchema, } from "./severitylevelenum.js"; import { SmsStepUpsertDto, SmsStepUpsertDto$Outbound, SmsStepUpsertDto$outboundSchema, } from "./smsstepupsertdto.js"; export type UpdateWorkflowDtoSteps = | InAppStepUpsertDto | EmailStepUpsertDto | SmsStepUpsertDto | PushStepUpsertDto | ChatStepUpsertDto | DelayStepUpsertDto | DigestStepUpsertDto | CustomStepUpsertDto | HttpRequestStepUpsertDto; export type UpdateWorkflowDto = { /** * Name of the workflow */ name: string; /** * Description of the workflow */ description?: string | undefined; /** * Tags associated with the workflow */ tags?: Array | undefined; /** * Whether the workflow is active */ active?: boolean | undefined; /** * Enable or disable payload schema validation */ validatePayload?: boolean | undefined; /** * The payload JSON Schema for the workflow */ payloadSchema?: { [k: string]: any } | null | undefined; /** * Enable or disable translations for this workflow */ isTranslationEnabled?: boolean | undefined; /** * Workflow ID (allowed only for code-first workflows) */ workflowId?: string | undefined; /** * Steps of the workflow */ steps: Array< | InAppStepUpsertDto | EmailStepUpsertDto | SmsStepUpsertDto | PushStepUpsertDto | ChatStepUpsertDto | DelayStepUpsertDto | DigestStepUpsertDto | CustomStepUpsertDto | HttpRequestStepUpsertDto >; /** * Workflow preferences */ preferences: PreferencesRequestDto; /** * Origin of the layout */ origin: ResourceOriginEnum; /** * Severity of the workflow */ severity?: SeverityLevelEnum | undefined; }; /** @internal */ export type UpdateWorkflowDtoSteps$Outbound = | InAppStepUpsertDto$Outbound | EmailStepUpsertDto$Outbound | SmsStepUpsertDto$Outbound | PushStepUpsertDto$Outbound | ChatStepUpsertDto$Outbound | DelayStepUpsertDto$Outbound | DigestStepUpsertDto$Outbound | CustomStepUpsertDto$Outbound | HttpRequestStepUpsertDto$Outbound; /** @internal */ export const UpdateWorkflowDtoSteps$outboundSchema: z.ZodType< UpdateWorkflowDtoSteps$Outbound, z.ZodTypeDef, UpdateWorkflowDtoSteps > = z.union([ InAppStepUpsertDto$outboundSchema, EmailStepUpsertDto$outboundSchema, SmsStepUpsertDto$outboundSchema, PushStepUpsertDto$outboundSchema, ChatStepUpsertDto$outboundSchema, DelayStepUpsertDto$outboundSchema, DigestStepUpsertDto$outboundSchema, CustomStepUpsertDto$outboundSchema, HttpRequestStepUpsertDto$outboundSchema, ]); export function updateWorkflowDtoStepsToJSON( updateWorkflowDtoSteps: UpdateWorkflowDtoSteps, ): string { return JSON.stringify( UpdateWorkflowDtoSteps$outboundSchema.parse(updateWorkflowDtoSteps), ); } /** @internal */ export type UpdateWorkflowDto$Outbound = { name: string; description?: string | undefined; tags?: Array | undefined; active: boolean; validatePayload?: boolean | undefined; payloadSchema?: { [k: string]: any } | null | undefined; isTranslationEnabled: boolean; workflowId?: string | undefined; steps: Array< | InAppStepUpsertDto$Outbound | EmailStepUpsertDto$Outbound | SmsStepUpsertDto$Outbound | PushStepUpsertDto$Outbound | ChatStepUpsertDto$Outbound | DelayStepUpsertDto$Outbound | DigestStepUpsertDto$Outbound | CustomStepUpsertDto$Outbound | HttpRequestStepUpsertDto$Outbound >; preferences: PreferencesRequestDto$Outbound; origin: string; severity?: string | undefined; }; /** @internal */ export const UpdateWorkflowDto$outboundSchema: z.ZodType< UpdateWorkflowDto$Outbound, z.ZodTypeDef, UpdateWorkflowDto > = z.object({ name: z.string(), description: z.string().optional(), tags: z.array(z.string()).optional(), active: z.boolean().default(false), validatePayload: z.boolean().optional(), payloadSchema: z.nullable(z.record(z.any())).optional(), isTranslationEnabled: z.boolean().default(false), workflowId: z.string().optional(), steps: z.array( z.union([ InAppStepUpsertDto$outboundSchema, EmailStepUpsertDto$outboundSchema, SmsStepUpsertDto$outboundSchema, PushStepUpsertDto$outboundSchema, ChatStepUpsertDto$outboundSchema, DelayStepUpsertDto$outboundSchema, DigestStepUpsertDto$outboundSchema, CustomStepUpsertDto$outboundSchema, HttpRequestStepUpsertDto$outboundSchema, ]), ), preferences: PreferencesRequestDto$outboundSchema, origin: ResourceOriginEnum$outboundSchema, severity: SeverityLevelEnum$outboundSchema.optional(), }); export function updateWorkflowDtoToJSON( updateWorkflowDto: UpdateWorkflowDto, ): string { return JSON.stringify( UpdateWorkflowDto$outboundSchema.parse(updateWorkflowDto), ); }