/* * 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 { BasketOrderCreate, BasketOrderCreate$inboundSchema, BasketOrderCreate$Outbound, BasketOrderCreate$outboundSchema, } from "./basketordercreate.js"; /** * The message to add a list of basket orders to a basket */ export type AddOrdersRequestCreate = { /** * The orders to add to the basket. A maximum of 1000 orders can be added to a basket at a time. */ basketOrders: Array; /** * Format: correspondents/{correspondent}/baskets/{basket} */ name: string; }; /** @internal */ export const AddOrdersRequestCreate$inboundSchema: z.ZodType< AddOrdersRequestCreate, z.ZodTypeDef, unknown > = z.object({ basket_orders: z.array(BasketOrderCreate$inboundSchema), name: z.string(), }).transform((v) => { return remap$(v, { "basket_orders": "basketOrders", }); }); /** @internal */ export type AddOrdersRequestCreate$Outbound = { basket_orders: Array; name: string; }; /** @internal */ export const AddOrdersRequestCreate$outboundSchema: z.ZodType< AddOrdersRequestCreate$Outbound, z.ZodTypeDef, AddOrdersRequestCreate > = z.object({ basketOrders: z.array(BasketOrderCreate$outboundSchema), name: z.string(), }).transform((v) => { return remap$(v, { basketOrders: "basket_orders", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AddOrdersRequestCreate$ { /** @deprecated use `AddOrdersRequestCreate$inboundSchema` instead. */ export const inboundSchema = AddOrdersRequestCreate$inboundSchema; /** @deprecated use `AddOrdersRequestCreate$outboundSchema` instead. */ export const outboundSchema = AddOrdersRequestCreate$outboundSchema; /** @deprecated use `AddOrdersRequestCreate$Outbound` instead. */ export type Outbound = AddOrdersRequestCreate$Outbound; } export function addOrdersRequestCreateToJSON( addOrdersRequestCreate: AddOrdersRequestCreate, ): string { return JSON.stringify( AddOrdersRequestCreate$outboundSchema.parse(addOrdersRequestCreate), ); } export function addOrdersRequestCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AddOrdersRequestCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AddOrdersRequestCreate' from JSON`, ); }