/* * 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"; /** * Type of editor to use for the body. */ export const EmailControlDtoEditorType = { Block: "block", Html: "html", } as const; /** * Type of editor to use for the body. */ export type EmailControlDtoEditorType = ClosedEnum< typeof EmailControlDtoEditorType >; export type EmailControlDto = { /** * JSONLogic filter conditions for conditionally skipping the step execution. Supports complex logical operations with AND, OR, and comparison operators. See https://jsonlogic.com/ for full typing reference. */ skip?: { [k: string]: any } | undefined; /** * Subject of the email. */ subject: string; /** * Body content of the email, either a valid Maily JSON object, or html string. */ body?: string | undefined; /** * Type of editor to use for the body. */ editorType?: EmailControlDtoEditorType | undefined; /** * Disable sanitization of the output. */ disableOutputSanitization?: boolean | undefined; /** * Layout ID to use for the email. Null means no layout, undefined means default layout. */ layoutId?: string | null | undefined; }; /** @internal */ export const EmailControlDtoEditorType$inboundSchema: z.ZodNativeEnum< typeof EmailControlDtoEditorType > = z.nativeEnum(EmailControlDtoEditorType); /** @internal */ export const EmailControlDtoEditorType$outboundSchema: z.ZodNativeEnum< typeof EmailControlDtoEditorType > = EmailControlDtoEditorType$inboundSchema; /** @internal */ export const EmailControlDto$inboundSchema: z.ZodType< EmailControlDto, z.ZodTypeDef, unknown > = z.object({ skip: z.record(z.any()).optional(), subject: z.string(), body: z.string().default(""), editorType: EmailControlDtoEditorType$inboundSchema.default("block"), disableOutputSanitization: z.boolean().default(false), layoutId: z.nullable(z.string()).optional(), }); /** @internal */ export type EmailControlDto$Outbound = { skip?: { [k: string]: any } | undefined; subject: string; body: string; editorType: string; disableOutputSanitization: boolean; layoutId?: string | null | undefined; }; /** @internal */ export const EmailControlDto$outboundSchema: z.ZodType< EmailControlDto$Outbound, z.ZodTypeDef, EmailControlDto > = z.object({ skip: z.record(z.any()).optional(), subject: z.string(), body: z.string().default(""), editorType: EmailControlDtoEditorType$outboundSchema.default("block"), disableOutputSanitization: z.boolean().default(false), layoutId: z.nullable(z.string()).optional(), }); export function emailControlDtoToJSON( emailControlDto: EmailControlDto, ): string { return JSON.stringify(EmailControlDto$outboundSchema.parse(emailControlDto)); } export function emailControlDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmailControlDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmailControlDto' from JSON`, ); }