/* * 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 { ComputeOffer, ComputeOffer$inboundSchema, ComputeOffer$Outbound, ComputeOffer$outboundSchema, } from "./computeoffer.js"; export type ComputeOfferList = { nextCursor: string | null; total: number; data: Array; }; /** @internal */ export const ComputeOfferList$inboundSchema: z.ZodType< ComputeOfferList, z.ZodTypeDef, unknown > = z.object({ next_cursor: z.nullable(z.string()), total: z.number().int(), data: z.array(ComputeOffer$inboundSchema), }).transform((v) => { return remap$(v, { "next_cursor": "nextCursor", }); }); /** @internal */ export type ComputeOfferList$Outbound = { next_cursor: string | null; total: number; data: Array; }; /** @internal */ export const ComputeOfferList$outboundSchema: z.ZodType< ComputeOfferList$Outbound, z.ZodTypeDef, ComputeOfferList > = z.object({ nextCursor: z.nullable(z.string()), total: z.number().int(), data: z.array(ComputeOffer$outboundSchema), }).transform((v) => { return remap$(v, { nextCursor: "next_cursor", }); }); export function computeOfferListToJSON( computeOfferList: ComputeOfferList, ): string { return JSON.stringify( ComputeOfferList$outboundSchema.parse(computeOfferList), ); } export function computeOfferListFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ComputeOfferList$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ComputeOfferList' from JSON`, ); }