/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { WebhookEndpointDto, WebhookEndpointDto$Outbound, WebhookEndpointDto$outboundSchema, } from "./webhookendpointdto.js"; /** * Rich context object with id and optional data */ export type CreateWebhookEndpointDtoContext2 = { id: string; /** * Optional additional context data */ data?: { [k: string]: any } | undefined; }; export type CreateWebhookEndpointDtoContext = | CreateWebhookEndpointDtoContext2 | string; export type CreateWebhookEndpointDto = { /** * 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]: CreateWebhookEndpointDtoContext2 | 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: "webhook"; /** * Webhook endpoint data */ endpoint: WebhookEndpointDto; }; /** @internal */ export type CreateWebhookEndpointDtoContext2$Outbound = { id: string; data?: { [k: string]: any } | undefined; }; /** @internal */ export const CreateWebhookEndpointDtoContext2$outboundSchema: z.ZodType< CreateWebhookEndpointDtoContext2$Outbound, z.ZodTypeDef, CreateWebhookEndpointDtoContext2 > = z.object({ id: z.string(), data: z.record(z.any()).optional(), }); export function createWebhookEndpointDtoContext2ToJSON( createWebhookEndpointDtoContext2: CreateWebhookEndpointDtoContext2, ): string { return JSON.stringify( CreateWebhookEndpointDtoContext2$outboundSchema.parse( createWebhookEndpointDtoContext2, ), ); } /** @internal */ export type CreateWebhookEndpointDtoContext$Outbound = | CreateWebhookEndpointDtoContext2$Outbound | string; /** @internal */ export const CreateWebhookEndpointDtoContext$outboundSchema: z.ZodType< CreateWebhookEndpointDtoContext$Outbound, z.ZodTypeDef, CreateWebhookEndpointDtoContext > = z.union([ z.lazy(() => CreateWebhookEndpointDtoContext2$outboundSchema), z.string(), ]); export function createWebhookEndpointDtoContextToJSON( createWebhookEndpointDtoContext: CreateWebhookEndpointDtoContext, ): string { return JSON.stringify( CreateWebhookEndpointDtoContext$outboundSchema.parse( createWebhookEndpointDtoContext, ), ); } /** @internal */ export type CreateWebhookEndpointDto$Outbound = { identifier?: string | undefined; subscriberId: string; context?: | { [k: string]: CreateWebhookEndpointDtoContext2$Outbound | string } | undefined; integrationIdentifier: string; connectionIdentifier?: string | undefined; type: "webhook"; endpoint: WebhookEndpointDto$Outbound; }; /** @internal */ export const CreateWebhookEndpointDto$outboundSchema: z.ZodType< CreateWebhookEndpointDto$Outbound, z.ZodTypeDef, CreateWebhookEndpointDto > = z.object({ identifier: z.string().optional(), subscriberId: z.string(), context: z.record( z.union([ z.lazy(() => CreateWebhookEndpointDtoContext2$outboundSchema), z.string(), ]), ).optional(), integrationIdentifier: z.string(), connectionIdentifier: z.string().optional(), type: z.literal("webhook"), endpoint: WebhookEndpointDto$outboundSchema, }); export function createWebhookEndpointDtoToJSON( createWebhookEndpointDto: CreateWebhookEndpointDto, ): string { return JSON.stringify( CreateWebhookEndpointDto$outboundSchema.parse(createWebhookEndpointDto), ); }