/* * 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 } from "./address.js"; export type ShippingDetails = { /** * 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; /** * The ID for the shipping details. */ id?: string | null | undefined; /** * The ID for the buyer. */ buyerId?: string | null | undefined; /** * Always `shipping-details`. */ type: "shipping-details"; }; /** @internal */ export const ShippingDetails$inboundSchema: z.ZodType< ShippingDetails, 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(), id: z.nullable(z.string()).optional(), buyer_id: z.nullable(z.string()).optional(), type: z.literal("shipping-details").default("shipping-details"), }).transform((v) => { return remap$(v, { "first_name": "firstName", "last_name": "lastName", "email_address": "emailAddress", "phone_number": "phoneNumber", "buyer_id": "buyerId", }); }); export function shippingDetailsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ShippingDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ShippingDetails' from JSON`, ); }