/* * 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$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type WebhookWebhooksAddGlobals = { /** * The ID of your Unify application */ appId?: string | undefined; }; export type WebhookWebhooksAddRequest = { /** * The ID of your Unify application */ appId?: string | undefined; createWebhookRequest: components.CreateWebhookRequest; }; export type WebhookWebhooksAddResponse = { httpMeta: components.HTTPMetadata; /** * Webhooks */ createWebhookResponse?: components.CreateWebhookResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export type WebhookWebhooksAddRequest$Outbound = { appId?: string | undefined; CreateWebhookRequest: components.CreateWebhookRequest$Outbound; }; /** @internal */ export const WebhookWebhooksAddRequest$outboundSchema: z.ZodType< WebhookWebhooksAddRequest$Outbound, z.ZodTypeDef, WebhookWebhooksAddRequest > = /* @__PURE__ */ lazySchema$(() => z.object({ appId: z.string().optional(), createWebhookRequest: components.CreateWebhookRequest$outboundSchema, }).transform((v) => { return remap$(v, { createWebhookRequest: "CreateWebhookRequest", }); }) ); export function webhookWebhooksAddRequestToJSON( webhookWebhooksAddRequest: WebhookWebhooksAddRequest, ): string { return JSON.stringify( WebhookWebhooksAddRequest$outboundSchema.parse(webhookWebhooksAddRequest), ); } /** @internal */ export const WebhookWebhooksAddResponse$inboundSchema: z.ZodType< WebhookWebhooksAddResponse, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateWebhookResponse: types.optional( components.CreateWebhookResponse$inboundSchema, ), UnexpectedErrorResponse: types.optional( components.UnexpectedErrorResponse$inboundSchema, ), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateWebhookResponse": "createWebhookResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }) ); export function webhookWebhooksAddResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookWebhooksAddResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookWebhooksAddResponse' from JSON`, ); }