/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListComputeProvidersRequest = { cursor?: string | undefined; limit?: number | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type ListComputeProvidersResponse = | components.ComputeProviderHealthList | components.ComputeErrorEnvelope; /** @internal */ export const ListComputeProvidersRequest$inboundSchema: z.ZodType< ListComputeProvidersRequest, z.ZodTypeDef, unknown > = z.object({ cursor: z.string().optional(), limit: z.number().int().default(50), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ListComputeProvidersRequest$Outbound = { cursor?: string | undefined; limit: number; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListComputeProvidersRequest$outboundSchema: z.ZodType< ListComputeProvidersRequest$Outbound, z.ZodTypeDef, ListComputeProvidersRequest > = z.object({ cursor: z.string().optional(), limit: z.number().int().default(50), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function listComputeProvidersRequestToJSON( listComputeProvidersRequest: ListComputeProvidersRequest, ): string { return JSON.stringify( ListComputeProvidersRequest$outboundSchema.parse( listComputeProvidersRequest, ), ); } export function listComputeProvidersRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListComputeProvidersRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListComputeProvidersRequest' from JSON`, ); } /** @internal */ export const ListComputeProvidersResponse$inboundSchema: z.ZodType< ListComputeProvidersResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeProviderHealthList$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type ListComputeProvidersResponse$Outbound = | components.ComputeProviderHealthList$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const ListComputeProvidersResponse$outboundSchema: z.ZodType< ListComputeProvidersResponse$Outbound, z.ZodTypeDef, ListComputeProvidersResponse > = z.union([ components.ComputeProviderHealthList$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function listComputeProvidersResponseToJSON( listComputeProvidersResponse: ListComputeProvidersResponse, ): string { return JSON.stringify( ListComputeProvidersResponse$outboundSchema.parse( listComputeProvidersResponse, ), ); } export function listComputeProvidersResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListComputeProvidersResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListComputeProvidersResponse' from JSON`, ); }