/* * 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 { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; export type ShippingDetailsCreate = { /** * The first name(s) or given name for the buyer. */ firstName?: string | null | undefined; /** * The last name, or family name, of the buyer. */ lastName?: string | null | undefined; /** * The email address for the buyer. */ emailAddress?: string | null | undefined; /** * The phone number for the buyer which should be formatted according to the E164 number standard. */ phoneNumber?: string | null | undefined; /** * The billing address for the buyer. */ address?: Address | null | undefined; }; /** @internal */ export const ShippingDetailsCreate$inboundSchema: z.ZodType< ShippingDetailsCreate, z.ZodTypeDef, unknown > = z.object({ first_name: z.nullable(z.string()).optional(), last_name: z.nullable(z.string()).optional(), email_address: z.nullable(z.string()).optional(), phone_number: z.nullable(z.string()).optional(), address: z.nullable(Address$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "first_name": "firstName", "last_name": "lastName", "email_address": "emailAddress", "phone_number": "phoneNumber", }); }); /** @internal */ export type ShippingDetailsCreate$Outbound = { first_name?: string | null | undefined; last_name?: string | null | undefined; email_address?: string | null | undefined; phone_number?: string | null | undefined; address?: Address$Outbound | null | undefined; }; /** @internal */ export const ShippingDetailsCreate$outboundSchema: z.ZodType< ShippingDetailsCreate$Outbound, z.ZodTypeDef, ShippingDetailsCreate > = z.object({ firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), emailAddress: z.nullable(z.string()).optional(), phoneNumber: z.nullable(z.string()).optional(), address: z.nullable(Address$outboundSchema).optional(), }).transform((v) => { return remap$(v, { firstName: "first_name", lastName: "last_name", emailAddress: "email_address", phoneNumber: "phone_number", }); }); export function shippingDetailsCreateToJSON( shippingDetailsCreate: ShippingDetailsCreate, ): string { return JSON.stringify( ShippingDetailsCreate$outboundSchema.parse(shippingDetailsCreate), ); } export function shippingDetailsCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ShippingDetailsCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ShippingDetailsCreate' from JSON`, ); }