/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { WebhookEventType, WebhookEventType$outboundSchema, } from "./webhookeventtype.js"; import { WebhookFormat, WebhookFormat$outboundSchema, } from "./webhookformat.js"; /** * Schema to create a webhook endpoint. */ export type WebhookEndpointCreate = { /** * The URL where the webhook events will be sent. */ url: string; /** * An optional name for the webhook endpoint to help organize and identify it. */ name?: string | null | undefined; format: WebhookFormat; /** * The events that will trigger the webhook. */ events: Array; /** * The organization ID associated with the webhook endpoint. **Required unless you use an organization token.** */ organizationId?: string | null | undefined; }; /** @internal */ export type WebhookEndpointCreate$Outbound = { url: string; name?: string | null | undefined; format: string; events: Array; organization_id?: string | null | undefined; }; /** @internal */ export const WebhookEndpointCreate$outboundSchema: z.ZodMiniType< WebhookEndpointCreate$Outbound, WebhookEndpointCreate > = z.pipe( z.object({ url: z.string(), name: z.optional(z.nullable(z.string())), format: WebhookFormat$outboundSchema, events: z.array(WebhookEventType$outboundSchema), organizationId: z.optional(z.nullable(z.string())), }), z.transform((v) => { return remap$(v, { organizationId: "organization_id", }); }), ); export function webhookEndpointCreateToJSON( webhookEndpointCreate: WebhookEndpointCreate, ): string { return JSON.stringify( WebhookEndpointCreate$outboundSchema.parse(webhookEndpointCreate), ); }