/* * 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 WebhookWebhooksAllGlobals = { /** * The ID of your Unify application */ appId?: string | undefined; }; export type WebhookWebhooksAllRequest = { /** * The ID of your Unify application */ appId?: string | undefined; /** * Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. */ cursor?: string | null | undefined; /** * Number of results to return. Minimum 1, Maximum 200, Default 20 */ limit?: number | undefined; }; export type WebhookWebhooksAllResponse = { httpMeta: components.HTTPMetadata; /** * Webhooks */ getWebhooksResponse?: components.GetWebhooksResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export type WebhookWebhooksAllRequest$Outbound = { appId?: string | undefined; cursor?: string | null | undefined; limit: number; }; /** @internal */ export const WebhookWebhooksAllRequest$outboundSchema: z.ZodType< WebhookWebhooksAllRequest$Outbound, z.ZodTypeDef, WebhookWebhooksAllRequest > = /* @__PURE__ */ lazySchema$(() => z.object({ appId: z.string().optional(), cursor: z.nullable(z.string()).optional(), limit: z.number().int().default(20), }) ); export function webhookWebhooksAllRequestToJSON( webhookWebhooksAllRequest: WebhookWebhooksAllRequest, ): string { return JSON.stringify( WebhookWebhooksAllRequest$outboundSchema.parse(webhookWebhooksAllRequest), ); } /** @internal */ export const WebhookWebhooksAllResponse$inboundSchema: z.ZodType< WebhookWebhooksAllResponse, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, GetWebhooksResponse: types.optional( components.GetWebhooksResponse$inboundSchema, ), UnexpectedErrorResponse: types.optional( components.UnexpectedErrorResponse$inboundSchema, ), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "GetWebhooksResponse": "getWebhooksResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }) ); export function webhookWebhooksAllResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookWebhooksAllResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookWebhooksAllResponse' from JSON`, ); }