/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const Vendor = { Nvidia: "nvidia", Amd: "amd", } as const; export type Vendor = ClosedEnum; export type ListAcceleratorsRequest = { vendor?: Vendor | undefined; cursor?: string | undefined; limit?: number | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type ListAcceleratorsResponse = | components.ComputeAcceleratorList | components.ComputeErrorEnvelope; /** @internal */ export const Vendor$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Vendor); /** @internal */ export const Vendor$outboundSchema: z.ZodNativeEnum = Vendor$inboundSchema; /** @internal */ export const ListAcceleratorsRequest$inboundSchema: z.ZodType< ListAcceleratorsRequest, z.ZodTypeDef, unknown > = z.object({ vendor: Vendor$inboundSchema.optional(), 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 ListAcceleratorsRequest$Outbound = { vendor?: string | undefined; cursor?: string | undefined; limit: number; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListAcceleratorsRequest$outboundSchema: z.ZodType< ListAcceleratorsRequest$Outbound, z.ZodTypeDef, ListAcceleratorsRequest > = z.object({ vendor: Vendor$outboundSchema.optional(), 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 listAcceleratorsRequestToJSON( listAcceleratorsRequest: ListAcceleratorsRequest, ): string { return JSON.stringify( ListAcceleratorsRequest$outboundSchema.parse(listAcceleratorsRequest), ); } export function listAcceleratorsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListAcceleratorsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListAcceleratorsRequest' from JSON`, ); } /** @internal */ export const ListAcceleratorsResponse$inboundSchema: z.ZodType< ListAcceleratorsResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeAcceleratorList$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type ListAcceleratorsResponse$Outbound = | components.ComputeAcceleratorList$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const ListAcceleratorsResponse$outboundSchema: z.ZodType< ListAcceleratorsResponse$Outbound, z.ZodTypeDef, ListAcceleratorsResponse > = z.union([ components.ComputeAcceleratorList$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function listAcceleratorsResponseToJSON( listAcceleratorsResponse: ListAcceleratorsResponse, ): string { return JSON.stringify( ListAcceleratorsResponse$outboundSchema.parse(listAcceleratorsResponse), ); } export function listAcceleratorsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListAcceleratorsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListAcceleratorsResponse' from JSON`, ); }