/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Status, Status$inboundSchema, Status$outboundSchema, } from "./status.js"; import { WebhookEventType, WebhookEventType$inboundSchema, WebhookEventType$outboundSchema, } from "./webhookeventtype.js"; export type UpdateWebhookRequest = { /** * A description of the object. */ description?: string | null | undefined; /** * The status of the webhook. */ status?: Status | undefined; /** * The delivery url of the webhook endpoint. */ deliveryUrl?: string | undefined; /** * The list of subscribed events for this webhook. [`*`] indicates that all events are enabled. */ events?: Array | undefined; }; /** @internal */ export const UpdateWebhookRequest$inboundSchema: z.ZodType< UpdateWebhookRequest, z.ZodTypeDef, unknown > = z.object({ description: z.nullable(z.string()).optional(), status: Status$inboundSchema.optional(), delivery_url: z.string().optional(), events: z.array(WebhookEventType$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "delivery_url": "deliveryUrl", }); }); /** @internal */ export type UpdateWebhookRequest$Outbound = { description?: string | null | undefined; status?: string | undefined; delivery_url?: string | undefined; events?: Array | undefined; }; /** @internal */ export const UpdateWebhookRequest$outboundSchema: z.ZodType< UpdateWebhookRequest$Outbound, z.ZodTypeDef, UpdateWebhookRequest > = z.object({ description: z.nullable(z.string()).optional(), status: Status$outboundSchema.optional(), deliveryUrl: z.string().optional(), events: z.array(WebhookEventType$outboundSchema).optional(), }).transform((v) => { return remap$(v, { deliveryUrl: "delivery_url", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace UpdateWebhookRequest$ { /** @deprecated use `UpdateWebhookRequest$inboundSchema` instead. */ export const inboundSchema = UpdateWebhookRequest$inboundSchema; /** @deprecated use `UpdateWebhookRequest$outboundSchema` instead. */ export const outboundSchema = UpdateWebhookRequest$outboundSchema; /** @deprecated use `UpdateWebhookRequest$Outbound` instead. */ export type Outbound = UpdateWebhookRequest$Outbound; } export function updateWebhookRequestToJSON( updateWebhookRequest: UpdateWebhookRequest, ): string { return JSON.stringify( UpdateWebhookRequest$outboundSchema.parse(updateWebhookRequest), ); } export function updateWebhookRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateWebhookRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateWebhookRequest' from JSON`, ); }