/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { PhoneEndpointDto, PhoneEndpointDto$Outbound, PhoneEndpointDto$outboundSchema, } from "./phoneendpointdto.js"; /** * Rich context object with id and optional data */ export type CreatePhoneEndpointDtoContext2 = { id: string; /** * Optional additional context data */ data?: { [k: string]: any } | undefined; }; export type CreatePhoneEndpointDtoContext = | CreatePhoneEndpointDtoContext2 | string; export type CreatePhoneEndpointDto = { /** * The unique identifier for the channel endpoint. If not provided, one will be generated automatically. */ identifier?: string | undefined; /** * The subscriber ID to which the channel endpoint is linked */ subscriberId: string; context?: | { [k: string]: CreatePhoneEndpointDtoContext2 | string } | undefined; /** * The identifier of the integration to use for this channel endpoint. */ integrationIdentifier: string; /** * The identifier of the channel connection to use for this channel endpoint. */ connectionIdentifier?: string | undefined; /** * Type of channel endpoint */ type: "phone"; /** * Phone endpoint data */ endpoint: PhoneEndpointDto; }; /** @internal */ export type CreatePhoneEndpointDtoContext2$Outbound = { id: string; data?: { [k: string]: any } | undefined; }; /** @internal */ export const CreatePhoneEndpointDtoContext2$outboundSchema: z.ZodType< CreatePhoneEndpointDtoContext2$Outbound, z.ZodTypeDef, CreatePhoneEndpointDtoContext2 > = z.object({ id: z.string(), data: z.record(z.any()).optional(), }); export function createPhoneEndpointDtoContext2ToJSON( createPhoneEndpointDtoContext2: CreatePhoneEndpointDtoContext2, ): string { return JSON.stringify( CreatePhoneEndpointDtoContext2$outboundSchema.parse( createPhoneEndpointDtoContext2, ), ); } /** @internal */ export type CreatePhoneEndpointDtoContext$Outbound = | CreatePhoneEndpointDtoContext2$Outbound | string; /** @internal */ export const CreatePhoneEndpointDtoContext$outboundSchema: z.ZodType< CreatePhoneEndpointDtoContext$Outbound, z.ZodTypeDef, CreatePhoneEndpointDtoContext > = z.union([ z.lazy(() => CreatePhoneEndpointDtoContext2$outboundSchema), z.string(), ]); export function createPhoneEndpointDtoContextToJSON( createPhoneEndpointDtoContext: CreatePhoneEndpointDtoContext, ): string { return JSON.stringify( CreatePhoneEndpointDtoContext$outboundSchema.parse( createPhoneEndpointDtoContext, ), ); } /** @internal */ export type CreatePhoneEndpointDto$Outbound = { identifier?: string | undefined; subscriberId: string; context?: | { [k: string]: CreatePhoneEndpointDtoContext2$Outbound | string } | undefined; integrationIdentifier: string; connectionIdentifier?: string | undefined; type: "phone"; endpoint: PhoneEndpointDto$Outbound; }; /** @internal */ export const CreatePhoneEndpointDto$outboundSchema: z.ZodType< CreatePhoneEndpointDto$Outbound, z.ZodTypeDef, CreatePhoneEndpointDto > = z.object({ identifier: z.string().optional(), subscriberId: z.string(), context: z.record( z.union([ z.lazy(() => CreatePhoneEndpointDtoContext2$outboundSchema), z.string(), ]), ).optional(), integrationIdentifier: z.string(), connectionIdentifier: z.string().optional(), type: z.literal("phone"), endpoint: PhoneEndpointDto$outboundSchema, }); export function createPhoneEndpointDtoToJSON( createPhoneEndpointDto: CreatePhoneEndpointDto, ): string { return JSON.stringify( CreatePhoneEndpointDto$outboundSchema.parse(createPhoneEndpointDto), ); }