/* * 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 { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type WebhookConfig = { /** * The URL to send the webhook events to. */ url: string; /** * JSON string of custom HTTP headers to include with every webhook request. Header names must be valid HTTP header tokens (alphanumeric, hyphens, underscores). Reserved headers (Content-Type, Host, etc.) cannot be overridden. */ customHeaders?: string | undefined; }; /** @internal */ export const WebhookConfig$inboundSchema: z.ZodType< WebhookConfig, z.ZodTypeDef, unknown > = z.object({ url: z.string(), custom_headers: z.string().optional(), }).transform((v) => { return remap$(v, { "custom_headers": "customHeaders", }); }); /** @internal */ export type WebhookConfig$Outbound = { url: string; custom_headers?: string | undefined; }; /** @internal */ export const WebhookConfig$outboundSchema: z.ZodType< WebhookConfig$Outbound, z.ZodTypeDef, WebhookConfig > = z.object({ url: z.string(), customHeaders: z.string().optional(), }).transform((v) => { return remap$(v, { customHeaders: "custom_headers", }); }); export function webhookConfigToJSON(webhookConfig: WebhookConfig): string { return JSON.stringify(WebhookConfig$outboundSchema.parse(webhookConfig)); } export function webhookConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookConfig' from JSON`, ); }