/* * 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 { Order, Order$inboundSchema, Order$Outbound, Order$outboundSchema, } from "./order.js"; /** * The response message containing a list of orders for an account */ export type ListAccountOrdersResponse = { /** * The token that must be provided on the next List request to retrieve the next page of data. This field will be empty if there are no more pages. */ nextPageToken?: string | undefined; /** * The orders belonging to the requested account, and which match the filter criteria. */ orders?: Array | undefined; }; /** @internal */ export const ListAccountOrdersResponse$inboundSchema: z.ZodType< ListAccountOrdersResponse, z.ZodTypeDef, unknown > = z.object({ next_page_token: z.string().optional(), orders: z.array(Order$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "next_page_token": "nextPageToken", }); }); /** @internal */ export type ListAccountOrdersResponse$Outbound = { next_page_token?: string | undefined; orders?: Array | undefined; }; /** @internal */ export const ListAccountOrdersResponse$outboundSchema: z.ZodType< ListAccountOrdersResponse$Outbound, z.ZodTypeDef, ListAccountOrdersResponse > = z.object({ nextPageToken: z.string().optional(), orders: z.array(Order$outboundSchema).optional(), }).transform((v) => { return remap$(v, { 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 ListAccountOrdersResponse$ { /** @deprecated use `ListAccountOrdersResponse$inboundSchema` instead. */ export const inboundSchema = ListAccountOrdersResponse$inboundSchema; /** @deprecated use `ListAccountOrdersResponse$outboundSchema` instead. */ export const outboundSchema = ListAccountOrdersResponse$outboundSchema; /** @deprecated use `ListAccountOrdersResponse$Outbound` instead. */ export type Outbound = ListAccountOrdersResponse$Outbound; } export function listAccountOrdersResponseToJSON( listAccountOrdersResponse: ListAccountOrdersResponse, ): string { return JSON.stringify( ListAccountOrdersResponse$outboundSchema.parse(listAccountOrdersResponse), ); } export function listAccountOrdersResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListAccountOrdersResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListAccountOrdersResponse' from JSON`, ); }