/* * 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 { lazySchema as lazySchema$ } from "../../lib/schemas.js"; import { Status, Status$outboundSchema } from "./status.js"; import { UnifiedApiId, UnifiedApiId$outboundSchema } from "./unifiedapiid.js"; import { WebhookEventType, WebhookEventType$outboundSchema, } from "./webhookeventtype.js"; export type CreateWebhookRequest = { /** * A description of the object. */ description?: string | null | undefined; /** * Name of Apideck Unified API */ unifiedApi: UnifiedApiId; /** * The status of the webhook. */ status: Status; /** * The delivery url of the webhook endpoint. The endpoint must respond within 60 seconds or the delivery is recorded as failed. */ deliveryUrl: string; /** * The list of subscribed events for this webhook. [`*`] indicates that all events are enabled. */ events: Array; }; /** @internal */ export type CreateWebhookRequest$Outbound = { description?: string | null | undefined; unified_api: string; status: string; delivery_url: string; events: Array; }; /** @internal */ export const CreateWebhookRequest$outboundSchema: z.ZodType< CreateWebhookRequest$Outbound, z.ZodTypeDef, CreateWebhookRequest > = /* @__PURE__ */ lazySchema$(() => z.object({ description: z.nullable(z.string()).optional(), unifiedApi: UnifiedApiId$outboundSchema, status: Status$outboundSchema, deliveryUrl: z.string(), events: z.array(WebhookEventType$outboundSchema), }).transform((v) => { return remap$(v, { unifiedApi: "unified_api", deliveryUrl: "delivery_url", }); }) ); export function createWebhookRequestToJSON( createWebhookRequest: CreateWebhookRequest, ): string { return JSON.stringify( CreateWebhookRequest$outboundSchema.parse(createWebhookRequest), ); }