/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Address = { addressLine1: string; addressLine2?: string | undefined; city: string; stateOrProvince: string; postalCode: string; country: string; }; /** @internal */ export const Address$inboundSchema: z.ZodType = z.object({ addressLine1: z.string(), addressLine2: z.string().optional(), city: z.string(), stateOrProvince: z.string(), postalCode: z.string(), country: z.string(), }); /** @internal */ export type Address$Outbound = { addressLine1: string; addressLine2?: string | undefined; city: string; stateOrProvince: string; postalCode: string; country: string; }; /** @internal */ export const Address$outboundSchema: z.ZodType< Address$Outbound, z.ZodTypeDef, Address > = z.object({ addressLine1: z.string(), addressLine2: z.string().optional(), city: z.string(), stateOrProvince: z.string(), postalCode: z.string(), country: z.string(), }); export function addressToJSON(address: Address): string { return JSON.stringify(Address$outboundSchema.parse(address)); } export function addressFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Address$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Address' from JSON`, ); }