/* * 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 { EmailChannelOverrides, EmailChannelOverrides$Outbound, EmailChannelOverrides$outboundSchema, } from "./emailchanneloverrides.js"; import { SeverityLevelEnum, SeverityLevelEnum$outboundSchema, } from "./severitylevelenum.js"; import { StepsOverrides, StepsOverrides$Outbound, StepsOverrides$outboundSchema, } from "./stepsoverrides.js"; import { SubscriberPayloadDto, SubscriberPayloadDto$Outbound, SubscriberPayloadDto$outboundSchema, } from "./subscriberpayloaddto.js"; import { TenantPayloadDto, TenantPayloadDto$Outbound, TenantPayloadDto$outboundSchema, } from "./tenantpayloaddto.js"; /** * Channel-specific overrides that apply to all steps of a particular channel type. Step-level overrides take precedence over channel-level overrides. */ export type TriggerEventToAllRequestDtoChannels = { /** * Email channel specific overrides */ email?: EmailChannelOverrides | undefined; }; /** * This could be used to override provider specific configurations */ export type TriggerEventToAllRequestDtoOverrides = { /** * This could be used to override provider specific configurations or layout at the step level */ steps?: { [k: string]: StepsOverrides } | undefined; /** * Channel-specific overrides that apply to all steps of a particular channel type. Step-level overrides take precedence over channel-level overrides. */ channels?: TriggerEventToAllRequestDtoChannels | undefined; /** * Overrides the provider configuration for the entire workflow and all steps */ providers?: { [k: string]: { [k: string]: any } } | undefined; /** * Override the email provider specific configurations for the entire workflow * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ email?: { [k: string]: any } | undefined; /** * Override the push provider specific configurations for the entire workflow * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ push?: { [k: string]: any } | undefined; /** * Override the sms provider specific configurations for the entire workflow * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ sms?: { [k: string]: any } | undefined; /** * Override the chat provider specific configurations for the entire workflow * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ chat?: { [k: string]: any } | undefined; /** * Override the layout identifier for the entire workflow * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ layoutIdentifier?: string | undefined; /** * Severity of the workflow */ severity?: SeverityLevelEnum | undefined; additionalProperties?: { [k: string]: { [k: string]: any } } | undefined; }; /** * It is used to display the Avatar of the provided actor's subscriber id or actor object. * * @remarks * If a new actor object is provided, we will create a new subscriber in our system */ export type TriggerEventToAllRequestDtoActor = SubscriberPayloadDto | string; /** * It is used to specify a tenant context during trigger event. * * @remarks * If a new tenant object is provided, we will create a new tenant. */ export type TriggerEventToAllRequestDtoTenant = string | TenantPayloadDto; /** * Rich context object with id and optional data */ export type TriggerEventToAllRequestDtoContext2 = { id: string; /** * Optional additional context data */ data?: { [k: string]: any } | undefined; }; export type TriggerEventToAllRequestDtoContext = | TriggerEventToAllRequestDtoContext2 | string; export type TriggerEventToAllRequestDto = { /** * The trigger identifier associated for the template you wish to send. This identifier can be found on the template page. */ name: string; /** * The payload object is used to pass additional information that * * @remarks * could be used to render the template, or perform routing rules based on it. * For In-App channel, payload data are also available in */ payload: { [k: string]: any }; /** * This could be used to override provider specific configurations */ overrides?: TriggerEventToAllRequestDtoOverrides | undefined; /** * A unique identifier for this transaction, we will generated a UUID if not provided. */ transactionId?: string | undefined; /** * It is used to display the Avatar of the provided actor's subscriber id or actor object. * * @remarks * If a new actor object is provided, we will create a new subscriber in our system */ actor?: SubscriberPayloadDto | string | undefined; /** * It is used to specify a tenant context during trigger event. * * @remarks * If a new tenant object is provided, we will create a new tenant. */ tenant?: string | TenantPayloadDto | undefined; context?: | { [k: string]: TriggerEventToAllRequestDtoContext2 | string } | undefined; }; /** @internal */ export type TriggerEventToAllRequestDtoChannels$Outbound = { email?: EmailChannelOverrides$Outbound | undefined; }; /** @internal */ export const TriggerEventToAllRequestDtoChannels$outboundSchema: z.ZodType< TriggerEventToAllRequestDtoChannels$Outbound, z.ZodTypeDef, TriggerEventToAllRequestDtoChannels > = z.object({ email: EmailChannelOverrides$outboundSchema.optional(), }); export function triggerEventToAllRequestDtoChannelsToJSON( triggerEventToAllRequestDtoChannels: TriggerEventToAllRequestDtoChannels, ): string { return JSON.stringify( TriggerEventToAllRequestDtoChannels$outboundSchema.parse( triggerEventToAllRequestDtoChannels, ), ); } /** @internal */ export type TriggerEventToAllRequestDtoOverrides$Outbound = { steps?: { [k: string]: StepsOverrides$Outbound } | undefined; channels?: TriggerEventToAllRequestDtoChannels$Outbound | undefined; providers?: { [k: string]: { [k: string]: any } } | undefined; email?: { [k: string]: any } | undefined; push?: { [k: string]: any } | undefined; sms?: { [k: string]: any } | undefined; chat?: { [k: string]: any } | undefined; layoutIdentifier?: string | undefined; severity?: string | undefined; [additionalProperties: string]: unknown; }; /** @internal */ export const TriggerEventToAllRequestDtoOverrides$outboundSchema: z.ZodType< TriggerEventToAllRequestDtoOverrides$Outbound, z.ZodTypeDef, TriggerEventToAllRequestDtoOverrides > = z.object({ steps: z.record(StepsOverrides$outboundSchema).optional(), channels: z.lazy(() => TriggerEventToAllRequestDtoChannels$outboundSchema) .optional(), providers: z.record(z.record(z.any())).optional(), email: z.record(z.any()).optional(), push: z.record(z.any()).optional(), sms: z.record(z.any()).optional(), chat: z.record(z.any()).optional(), layoutIdentifier: z.string().optional(), severity: SeverityLevelEnum$outboundSchema.optional(), additionalProperties: z.record(z.record(z.any())).optional(), }).transform((v) => { return { ...v.additionalProperties, ...remap$(v, { additionalProperties: null, }), }; }); export function triggerEventToAllRequestDtoOverridesToJSON( triggerEventToAllRequestDtoOverrides: TriggerEventToAllRequestDtoOverrides, ): string { return JSON.stringify( TriggerEventToAllRequestDtoOverrides$outboundSchema.parse( triggerEventToAllRequestDtoOverrides, ), ); } /** @internal */ export type TriggerEventToAllRequestDtoActor$Outbound = | SubscriberPayloadDto$Outbound | string; /** @internal */ export const TriggerEventToAllRequestDtoActor$outboundSchema: z.ZodType< TriggerEventToAllRequestDtoActor$Outbound, z.ZodTypeDef, TriggerEventToAllRequestDtoActor > = z.union([SubscriberPayloadDto$outboundSchema, z.string()]); export function triggerEventToAllRequestDtoActorToJSON( triggerEventToAllRequestDtoActor: TriggerEventToAllRequestDtoActor, ): string { return JSON.stringify( TriggerEventToAllRequestDtoActor$outboundSchema.parse( triggerEventToAllRequestDtoActor, ), ); } /** @internal */ export type TriggerEventToAllRequestDtoTenant$Outbound = | string | TenantPayloadDto$Outbound; /** @internal */ export const TriggerEventToAllRequestDtoTenant$outboundSchema: z.ZodType< TriggerEventToAllRequestDtoTenant$Outbound, z.ZodTypeDef, TriggerEventToAllRequestDtoTenant > = z.union([z.string(), TenantPayloadDto$outboundSchema]); export function triggerEventToAllRequestDtoTenantToJSON( triggerEventToAllRequestDtoTenant: TriggerEventToAllRequestDtoTenant, ): string { return JSON.stringify( TriggerEventToAllRequestDtoTenant$outboundSchema.parse( triggerEventToAllRequestDtoTenant, ), ); } /** @internal */ export type TriggerEventToAllRequestDtoContext2$Outbound = { id: string; data?: { [k: string]: any } | undefined; }; /** @internal */ export const TriggerEventToAllRequestDtoContext2$outboundSchema: z.ZodType< TriggerEventToAllRequestDtoContext2$Outbound, z.ZodTypeDef, TriggerEventToAllRequestDtoContext2 > = z.object({ id: z.string(), data: z.record(z.any()).optional(), }); export function triggerEventToAllRequestDtoContext2ToJSON( triggerEventToAllRequestDtoContext2: TriggerEventToAllRequestDtoContext2, ): string { return JSON.stringify( TriggerEventToAllRequestDtoContext2$outboundSchema.parse( triggerEventToAllRequestDtoContext2, ), ); } /** @internal */ export type TriggerEventToAllRequestDtoContext$Outbound = | TriggerEventToAllRequestDtoContext2$Outbound | string; /** @internal */ export const TriggerEventToAllRequestDtoContext$outboundSchema: z.ZodType< TriggerEventToAllRequestDtoContext$Outbound, z.ZodTypeDef, TriggerEventToAllRequestDtoContext > = z.union([ z.lazy(() => TriggerEventToAllRequestDtoContext2$outboundSchema), z.string(), ]); export function triggerEventToAllRequestDtoContextToJSON( triggerEventToAllRequestDtoContext: TriggerEventToAllRequestDtoContext, ): string { return JSON.stringify( TriggerEventToAllRequestDtoContext$outboundSchema.parse( triggerEventToAllRequestDtoContext, ), ); } /** @internal */ export type TriggerEventToAllRequestDto$Outbound = { name: string; payload: { [k: string]: any }; overrides?: TriggerEventToAllRequestDtoOverrides$Outbound | undefined; transactionId?: string | undefined; actor?: SubscriberPayloadDto$Outbound | string | undefined; tenant?: string | TenantPayloadDto$Outbound | undefined; context?: { [k: string]: TriggerEventToAllRequestDtoContext2$Outbound | string; } | undefined; }; /** @internal */ export const TriggerEventToAllRequestDto$outboundSchema: z.ZodType< TriggerEventToAllRequestDto$Outbound, z.ZodTypeDef, TriggerEventToAllRequestDto > = z.object({ name: z.string(), payload: z.record(z.any()), overrides: z.lazy(() => TriggerEventToAllRequestDtoOverrides$outboundSchema) .optional(), transactionId: z.string().optional(), actor: z.union([SubscriberPayloadDto$outboundSchema, z.string()]).optional(), tenant: z.union([z.string(), TenantPayloadDto$outboundSchema]).optional(), context: z.record( z.union([ z.lazy(() => TriggerEventToAllRequestDtoContext2$outboundSchema), z.string(), ]), ).optional(), }); export function triggerEventToAllRequestDtoToJSON( triggerEventToAllRequestDto: TriggerEventToAllRequestDto, ): string { return JSON.stringify( TriggerEventToAllRequestDto$outboundSchema.parse( triggerEventToAllRequestDto, ), ); }