/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { smartUnion } from "../../types/smartUnion.js"; import { ListResourceWebhookEndpoint, ListResourceWebhookEndpoint$inboundSchema, } from "../components/listresourcewebhookendpoint.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Filter by organization ID. */ export type QueryParamOrganizationId = string | Array; export type WebhooksListWebhookEndpointsRequest = { /** * Filter by organization ID. */ organizationId?: string | Array | null | undefined; /** * Page number, defaults to 1. */ page?: number | undefined; /** * Size of a page, defaults to 10. Maximum is 100. */ limit?: number | undefined; }; export type WebhooksListWebhookEndpointsResponse = { result: ListResourceWebhookEndpoint; }; /** @internal */ export type QueryParamOrganizationId$Outbound = string | Array; /** @internal */ export const QueryParamOrganizationId$outboundSchema: z.ZodMiniType< QueryParamOrganizationId$Outbound, QueryParamOrganizationId > = smartUnion([z.string(), z.array(z.string())]); export function queryParamOrganizationIdToJSON( queryParamOrganizationId: QueryParamOrganizationId, ): string { return JSON.stringify( QueryParamOrganizationId$outboundSchema.parse(queryParamOrganizationId), ); } /** @internal */ export type WebhooksListWebhookEndpointsRequest$Outbound = { organization_id?: string | Array | null | undefined; page: number; limit: number; }; /** @internal */ export const WebhooksListWebhookEndpointsRequest$outboundSchema: z.ZodMiniType< WebhooksListWebhookEndpointsRequest$Outbound, WebhooksListWebhookEndpointsRequest > = z.pipe( z.object({ organizationId: z.optional( z.nullable(smartUnion([z.string(), z.array(z.string())])), ), page: z._default(z.int(), 1), limit: z._default(z.int(), 10), }), z.transform((v) => { return remap$(v, { organizationId: "organization_id", }); }), ); export function webhooksListWebhookEndpointsRequestToJSON( webhooksListWebhookEndpointsRequest: WebhooksListWebhookEndpointsRequest, ): string { return JSON.stringify( WebhooksListWebhookEndpointsRequest$outboundSchema.parse( webhooksListWebhookEndpointsRequest, ), ); } /** @internal */ export const WebhooksListWebhookEndpointsResponse$inboundSchema: z.ZodMiniType< WebhooksListWebhookEndpointsResponse, unknown > = z.pipe( z.object({ Result: ListResourceWebhookEndpoint$inboundSchema, }), z.transform((v) => { return remap$(v, { "Result": "result", }); }), ); export function webhooksListWebhookEndpointsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhooksListWebhookEndpointsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhooksListWebhookEndpointsResponse' from JSON`, ); }