/* * 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"; import { TopicPayloadDto, TopicPayloadDto$Outbound, TopicPayloadDto$outboundSchema, } from "./topicpayloaddto.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 Channels = { /** * Email channel specific overrides */ email?: EmailChannelOverrides | undefined; }; /** * This could be used to override provider specific configurations */ export type Overrides = { /** * 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?: Channels | 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; }; export type To1 = TopicPayloadDto | SubscriberPayloadDto | string; /** * The recipients list of people who will receive the notification. Maximum number of recipients can be 100. */ export type To = | TopicPayloadDto | SubscriberPayloadDto | Array | string; /** * 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 Actor = SubscriberPayloadDto | string; /** * It is used to specify a tenant context during trigger event. * * @remarks * Existing tenants will be updated with the provided details. */ export type Tenant = string | TenantPayloadDto; /** * Rich context object with id and optional data */ export type TriggerEventRequestDtoContext2 = { id: string; /** * Optional additional context data */ data?: { [k: string]: any } | undefined; }; export type TriggerEventRequestDtoContext = | TriggerEventRequestDtoContext2 | string; export type TriggerEventRequestDto = { /** * The trigger identifier of the workflow you wish to send. This identifier can be found on the workflow page. */ workflowId: string; /** * The payload object is used to pass additional custom information that could be * * @remarks * used to render the workflow, or perform routing rules based on it. * This data will also be available when fetching the notifications feed from the API to display certain parts of the UI. */ payload?: { [k: string]: any } | undefined; /** * This could be used to override provider specific configurations */ overrides?: Overrides | undefined; /** * The recipients list of people who will receive the notification. Maximum number of recipients can be 100. */ to: | TopicPayloadDto | SubscriberPayloadDto | Array | string; /** * A unique identifier for deduplication. If the same **transactionId** is sent again, * * @remarks * the trigger is ignored. Useful to prevent duplicate notifications. The retention period depends on your billing tier. */ 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 * Existing tenants will be updated with the provided details. */ tenant?: string | TenantPayloadDto | undefined; context?: | { [k: string]: TriggerEventRequestDtoContext2 | string } | undefined; }; /** @internal */ export type Channels$Outbound = { email?: EmailChannelOverrides$Outbound | undefined; }; /** @internal */ export const Channels$outboundSchema: z.ZodType< Channels$Outbound, z.ZodTypeDef, Channels > = z.object({ email: EmailChannelOverrides$outboundSchema.optional(), }); export function channelsToJSON(channels: Channels): string { return JSON.stringify(Channels$outboundSchema.parse(channels)); } /** @internal */ export type Overrides$Outbound = { steps?: { [k: string]: StepsOverrides$Outbound } | undefined; channels?: Channels$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; }; /** @internal */ export const Overrides$outboundSchema: z.ZodType< Overrides$Outbound, z.ZodTypeDef, Overrides > = z.object({ steps: z.record(StepsOverrides$outboundSchema).optional(), channels: z.lazy(() => Channels$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(), }); export function overridesToJSON(overrides: Overrides): string { return JSON.stringify(Overrides$outboundSchema.parse(overrides)); } /** @internal */ export type To1$Outbound = | TopicPayloadDto$Outbound | SubscriberPayloadDto$Outbound | string; /** @internal */ export const To1$outboundSchema: z.ZodType = z .union([ TopicPayloadDto$outboundSchema, SubscriberPayloadDto$outboundSchema, z.string(), ]); export function to1ToJSON(to1: To1): string { return JSON.stringify(To1$outboundSchema.parse(to1)); } /** @internal */ export type To$Outbound = | TopicPayloadDto$Outbound | SubscriberPayloadDto$Outbound | Array | string; /** @internal */ export const To$outboundSchema: z.ZodType = z .union([ TopicPayloadDto$outboundSchema, SubscriberPayloadDto$outboundSchema, z.array( z.union([ TopicPayloadDto$outboundSchema, SubscriberPayloadDto$outboundSchema, z.string(), ]), ), z.string(), ]); export function toToJSON(to: To): string { return JSON.stringify(To$outboundSchema.parse(to)); } /** @internal */ export type Actor$Outbound = SubscriberPayloadDto$Outbound | string; /** @internal */ export const Actor$outboundSchema: z.ZodType< Actor$Outbound, z.ZodTypeDef, Actor > = z.union([SubscriberPayloadDto$outboundSchema, z.string()]); export function actorToJSON(actor: Actor): string { return JSON.stringify(Actor$outboundSchema.parse(actor)); } /** @internal */ export type Tenant$Outbound = string | TenantPayloadDto$Outbound; /** @internal */ export const Tenant$outboundSchema: z.ZodType< Tenant$Outbound, z.ZodTypeDef, Tenant > = z.union([z.string(), TenantPayloadDto$outboundSchema]); export function tenantToJSON(tenant: Tenant): string { return JSON.stringify(Tenant$outboundSchema.parse(tenant)); } /** @internal */ export type TriggerEventRequestDtoContext2$Outbound = { id: string; data?: { [k: string]: any } | undefined; }; /** @internal */ export const TriggerEventRequestDtoContext2$outboundSchema: z.ZodType< TriggerEventRequestDtoContext2$Outbound, z.ZodTypeDef, TriggerEventRequestDtoContext2 > = z.object({ id: z.string(), data: z.record(z.any()).optional(), }); export function triggerEventRequestDtoContext2ToJSON( triggerEventRequestDtoContext2: TriggerEventRequestDtoContext2, ): string { return JSON.stringify( TriggerEventRequestDtoContext2$outboundSchema.parse( triggerEventRequestDtoContext2, ), ); } /** @internal */ export type TriggerEventRequestDtoContext$Outbound = | TriggerEventRequestDtoContext2$Outbound | string; /** @internal */ export const TriggerEventRequestDtoContext$outboundSchema: z.ZodType< TriggerEventRequestDtoContext$Outbound, z.ZodTypeDef, TriggerEventRequestDtoContext > = z.union([ z.lazy(() => TriggerEventRequestDtoContext2$outboundSchema), z.string(), ]); export function triggerEventRequestDtoContextToJSON( triggerEventRequestDtoContext: TriggerEventRequestDtoContext, ): string { return JSON.stringify( TriggerEventRequestDtoContext$outboundSchema.parse( triggerEventRequestDtoContext, ), ); } /** @internal */ export type TriggerEventRequestDto$Outbound = { name: string; payload?: { [k: string]: any } | undefined; overrides?: Overrides$Outbound | undefined; to: | TopicPayloadDto$Outbound | SubscriberPayloadDto$Outbound | Array | string; transactionId?: string | undefined; actor?: SubscriberPayloadDto$Outbound | string | undefined; tenant?: string | TenantPayloadDto$Outbound | undefined; context?: | { [k: string]: TriggerEventRequestDtoContext2$Outbound | string } | undefined; }; /** @internal */ export const TriggerEventRequestDto$outboundSchema: z.ZodType< TriggerEventRequestDto$Outbound, z.ZodTypeDef, TriggerEventRequestDto > = z.object({ workflowId: z.string(), payload: z.record(z.any()).optional(), overrides: z.lazy(() => Overrides$outboundSchema).optional(), to: z.union([ TopicPayloadDto$outboundSchema, SubscriberPayloadDto$outboundSchema, z.array( z.union([ TopicPayloadDto$outboundSchema, SubscriberPayloadDto$outboundSchema, z.string(), ]), ), z.string(), ]), 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(() => TriggerEventRequestDtoContext2$outboundSchema), z.string(), ]), ).optional(), }).transform((v) => { return remap$(v, { workflowId: "name", }); }); export function triggerEventRequestDtoToJSON( triggerEventRequestDto: TriggerEventRequestDto, ): string { return JSON.stringify( TriggerEventRequestDto$outboundSchema.parse(triggerEventRequestDto), ); }