/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * An object representing a shipping or billing address. */ export type EcommerceAddress = { /** * Address line 1 of the billing address. */ line1?: string | null | undefined; /** * Address line 2 of the billing address. */ line2?: string | null | undefined; /** * Company name of the customer */ companyName?: string | null | undefined; /** * City of the billing address. */ city?: string | null | undefined; /** * State/province of the billing address. */ state?: string | null | undefined; /** * Postal/ZIP code of the billing address. */ postalCode?: string | null | undefined; /** * Country of the billing address. */ country?: string | null | undefined; }; /** @internal */ export const EcommerceAddress$inboundSchema: z.ZodType< EcommerceAddress, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ line1: z.nullable(types.string()).optional(), line2: z.nullable(types.string()).optional(), company_name: z.nullable(types.string()).optional(), city: z.nullable(types.string()).optional(), state: z.nullable(types.string()).optional(), postal_code: z.nullable(types.string()).optional(), country: z.nullable(types.string()).optional(), }).transform((v) => { return remap$(v, { "company_name": "companyName", "postal_code": "postalCode", }); }) ); export function ecommerceAddressFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EcommerceAddress$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EcommerceAddress' from JSON`, ); }