/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { WebhookEventType, WebhookEventType$inboundSchema, WebhookEventType$outboundSchema, } from "./webhookeventtype.js"; import { WebhookStatus, WebhookStatus$inboundSchema, WebhookStatus$outboundSchema, } from "./webhookstatus.js"; /** * Request body for updating an existing webhook. */ export type UpdateWebhook = { /** * The URL where webhook events will be sent. */ url: string; /** * The status of the webhook. */ status: WebhookStatus; /** * The list of event types this webhook should subscribe to. */ eventTypes: Array; /** * A description of the webhook for reference. Can be an empty string. */ description: string; }; /** @internal */ export const UpdateWebhook$inboundSchema: z.ZodType< UpdateWebhook, z.ZodTypeDef, unknown > = z.object({ url: z.string(), status: WebhookStatus$inboundSchema, eventTypes: z.array(WebhookEventType$inboundSchema), description: z.string(), }); /** @internal */ export type UpdateWebhook$Outbound = { url: string; status: string; eventTypes: Array; description: string; }; /** @internal */ export const UpdateWebhook$outboundSchema: z.ZodType< UpdateWebhook$Outbound, z.ZodTypeDef, UpdateWebhook > = z.object({ url: z.string(), status: WebhookStatus$outboundSchema, eventTypes: z.array(WebhookEventType$outboundSchema), description: z.string(), }); export function updateWebhookToJSON(updateWebhook: UpdateWebhook): string { return JSON.stringify(UpdateWebhook$outboundSchema.parse(updateWebhook)); } export function updateWebhookFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateWebhook$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateWebhook' from JSON`, ); }