/* * 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"; export type DigitalWalletAddress = { /** * The first line of the address. */ line1: string; /** * The second line of the address. */ line2?: string | null | undefined; /** * The city for the address. */ city: string; /** * The code of state, county, or province for the address in ISO 3166-2 format. */ stateCode: string; /** * The zip or postal code for the address. */ postalCode: string; }; /** @internal */ export const DigitalWalletAddress$inboundSchema: z.ZodType< DigitalWalletAddress, z.ZodTypeDef, unknown > = z.object({ line1: z.string(), line2: z.nullable(z.string()).optional(), city: z.string(), state_code: z.string(), postal_code: z.string(), }).transform((v) => { return remap$(v, { "state_code": "stateCode", "postal_code": "postalCode", }); }); /** @internal */ export type DigitalWalletAddress$Outbound = { line1: string; line2?: string | null | undefined; city: string; state_code: string; postal_code: string; }; /** @internal */ export const DigitalWalletAddress$outboundSchema: z.ZodType< DigitalWalletAddress$Outbound, z.ZodTypeDef, DigitalWalletAddress > = z.object({ line1: z.string(), line2: z.nullable(z.string()).optional(), city: z.string(), stateCode: z.string(), postalCode: z.string(), }).transform((v) => { return remap$(v, { stateCode: "state_code", postalCode: "postal_code", }); }); export function digitalWalletAddressToJSON( digitalWalletAddress: DigitalWalletAddress, ): string { return JSON.stringify( DigitalWalletAddress$outboundSchema.parse(digitalWalletAddress), ); } export function digitalWalletAddressFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DigitalWalletAddress$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DigitalWalletAddress' from JSON`, ); }