/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 { PostalAddressCreate, PostalAddressCreate$inboundSchema, PostalAddressCreate$Outbound, PostalAddressCreate$outboundSchema, } from "./postaladdresscreate.js"; /** * Travel rule party */ export type TravelRulePartyCreate = { /** * Represents a postal address, e.g. for postal delivery or payments addresses. Given a postal address, a postal service can deliver items to a premise, P.O. Box or similar. It is not intended to model geographical locations (roads, towns, mountains). * * @remarks * * In typical usage an address would be created via user input or from importing existing data, depending on the type of process. * * Advice on address input / editing: - Use an i18n-ready address widget such as https://github.com/google/libaddressinput) - Users should not be presented with UI elements for input or editing of fields outside countries where that field is used. * * For more guidance on how to use this schema, please see: https://support.google.com/business/answer/6397478 */ address: PostalAddressCreate; /** * The last name of the party */ familyName: string; /** * The first name of the party as well as any non-primary given names (e.g. middle names) */ givenNames: Array; }; /** @internal */ export const TravelRulePartyCreate$inboundSchema: z.ZodType< TravelRulePartyCreate, z.ZodTypeDef, unknown > = z.object({ address: PostalAddressCreate$inboundSchema, family_name: z.string(), given_names: z.array(z.string()), }).transform((v) => { return remap$(v, { "family_name": "familyName", "given_names": "givenNames", }); }); /** @internal */ export type TravelRulePartyCreate$Outbound = { address: PostalAddressCreate$Outbound; family_name: string; given_names: Array; }; /** @internal */ export const TravelRulePartyCreate$outboundSchema: z.ZodType< TravelRulePartyCreate$Outbound, z.ZodTypeDef, TravelRulePartyCreate > = z.object({ address: PostalAddressCreate$outboundSchema, familyName: z.string(), givenNames: z.array(z.string()), }).transform((v) => { return remap$(v, { familyName: "family_name", givenNames: "given_names", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TravelRulePartyCreate$ { /** @deprecated use `TravelRulePartyCreate$inboundSchema` instead. */ export const inboundSchema = TravelRulePartyCreate$inboundSchema; /** @deprecated use `TravelRulePartyCreate$outboundSchema` instead. */ export const outboundSchema = TravelRulePartyCreate$outboundSchema; /** @deprecated use `TravelRulePartyCreate$Outbound` instead. */ export type Outbound = TravelRulePartyCreate$Outbound; } export function travelRulePartyCreateToJSON( travelRulePartyCreate: TravelRulePartyCreate, ): string { return JSON.stringify( TravelRulePartyCreate$outboundSchema.parse(travelRulePartyCreate), ); } export function travelRulePartyCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TravelRulePartyCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TravelRulePartyCreate' from JSON`, ); }