/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Cart, Cart$inboundSchema, Cart$Outbound, Cart$outboundSchema, } from "./cart.js"; import { Profile, Profile$inboundSchema, Profile$Outbound, Profile$outboundSchema, } from "./profile.js"; export type Order = { /** * An account's identifying information. */ profile: Profile; cart: Cart; }; /** @internal */ export const Order$inboundSchema: z.ZodType = z .object({ profile: Profile$inboundSchema, cart: Cart$inboundSchema, }); /** @internal */ export type Order$Outbound = { profile: Profile$Outbound; cart: Cart$Outbound; }; /** @internal */ export const Order$outboundSchema: z.ZodType< Order$Outbound, z.ZodTypeDef, Order > = z.object({ profile: Profile$outboundSchema, cart: Cart$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Order$ { /** @deprecated use `Order$inboundSchema` instead. */ export const inboundSchema = Order$inboundSchema; /** @deprecated use `Order$outboundSchema` instead. */ export const outboundSchema = Order$outboundSchema; /** @deprecated use `Order$Outbound` instead. */ export type Outbound = Order$Outbound; } export function orderToJSON(order: Order): string { return JSON.stringify(Order$outboundSchema.parse(order)); } export function orderFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Order$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Order' from JSON`, ); }