/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ComputeService, ComputeService$inboundSchema, ComputeService$Outbound, ComputeService$outboundSchema, } from "./computeservice.js"; export type ComputeServiceList = { nextCursor: string | null; total: number; data: Array; }; /** @internal */ export const ComputeServiceList$inboundSchema: z.ZodType< ComputeServiceList, z.ZodTypeDef, unknown > = z.object({ next_cursor: z.nullable(z.string()), total: z.number().int(), data: z.array(ComputeService$inboundSchema), }).transform((v) => { return remap$(v, { "next_cursor": "nextCursor", }); }); /** @internal */ export type ComputeServiceList$Outbound = { next_cursor: string | null; total: number; data: Array; }; /** @internal */ export const ComputeServiceList$outboundSchema: z.ZodType< ComputeServiceList$Outbound, z.ZodTypeDef, ComputeServiceList > = z.object({ nextCursor: z.nullable(z.string()), total: z.number().int(), data: z.array(ComputeService$outboundSchema), }).transform((v) => { return remap$(v, { nextCursor: "next_cursor", }); }); export function computeServiceListToJSON( computeServiceList: ComputeServiceList, ): string { return JSON.stringify( ComputeServiceList$outboundSchema.parse(computeServiceList), ); } export function computeServiceListFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ComputeServiceList$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ComputeServiceList' from JSON`, ); }