/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 { CompressedOrder, CompressedOrder$inboundSchema, CompressedOrder$Outbound, CompressedOrder$outboundSchema, } from "./compressedorder.js"; /** * The response message for listing compressed orders within a basket */ export type ListCompressedOrdersResponse = { /** * The compressed orders in the basket */ compressedOrders?: Array | undefined; /** * A token to retrieve the next page of results. Pass this value in the `page_token` field in the subsequent call to `ListCompressedOrders` method to retrieve the next page of results. */ nextPageToken?: string | undefined; }; /** @internal */ export const ListCompressedOrdersResponse$inboundSchema: z.ZodType< ListCompressedOrdersResponse, z.ZodTypeDef, unknown > = z.object({ compressed_orders: z.array(CompressedOrder$inboundSchema).optional(), next_page_token: z.string().optional(), }).transform((v) => { return remap$(v, { "compressed_orders": "compressedOrders", "next_page_token": "nextPageToken", }); }); /** @internal */ export type ListCompressedOrdersResponse$Outbound = { compressed_orders?: Array | undefined; next_page_token?: string | undefined; }; /** @internal */ export const ListCompressedOrdersResponse$outboundSchema: z.ZodType< ListCompressedOrdersResponse$Outbound, z.ZodTypeDef, ListCompressedOrdersResponse > = z.object({ compressedOrders: z.array(CompressedOrder$outboundSchema).optional(), nextPageToken: z.string().optional(), }).transform((v) => { return remap$(v, { compressedOrders: "compressed_orders", nextPageToken: "next_page_token", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ListCompressedOrdersResponse$ { /** @deprecated use `ListCompressedOrdersResponse$inboundSchema` instead. */ export const inboundSchema = ListCompressedOrdersResponse$inboundSchema; /** @deprecated use `ListCompressedOrdersResponse$outboundSchema` instead. */ export const outboundSchema = ListCompressedOrdersResponse$outboundSchema; /** @deprecated use `ListCompressedOrdersResponse$Outbound` instead. */ export type Outbound = ListCompressedOrdersResponse$Outbound; } export function listCompressedOrdersResponseToJSON( listCompressedOrdersResponse: ListCompressedOrdersResponse, ): string { return JSON.stringify( ListCompressedOrdersResponse$outboundSchema.parse( listCompressedOrdersResponse, ), ); } export function listCompressedOrdersResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListCompressedOrdersResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListCompressedOrdersResponse' from JSON`, ); }