/* * 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 { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PostalAddressUpdate, PostalAddressUpdate$inboundSchema, PostalAddressUpdate$Outbound, PostalAddressUpdate$outboundSchema, } from "./postaladdressupdate.js"; /** * Delivery method instruction for account statements for a given Interested Party; Can be `PHYSICAL`, `SUPPRESS`; Defaults to `PHYSICAL` on party creation */ export enum InterestedPartyUpdateStatementDeliveryPreference { Physical = "PHYSICAL", Suppress = "SUPPRESS", } /** * Delivery method instruction for account statements for a given Interested Party; Can be `PHYSICAL`, `SUPPRESS`; Defaults to `PHYSICAL` on party creation */ export type InterestedPartyUpdateStatementDeliveryPreferenceOpen = OpenEnum< typeof InterestedPartyUpdateStatementDeliveryPreference >; /** * Delivery method instruction for trade confirmations for a given Interested Party record; Can be `PHYSICAL`, `SUPPRESS`; Defaults to `PHYSICAL` on party creation */ export enum InterestedPartyUpdateTradeConfirmationDeliveryPreference { Physical = "PHYSICAL", Suppress = "SUPPRESS", } /** * Delivery method instruction for trade confirmations for a given Interested Party record; Can be `PHYSICAL`, `SUPPRESS`; Defaults to `PHYSICAL` on party creation */ export type InterestedPartyUpdateTradeConfirmationDeliveryPreferenceOpen = OpenEnum; /** * An interested party. */ export type InterestedPartyUpdate = { /** * 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 */ mailingAddress?: PostalAddressUpdate | undefined; /** * The sending address name for mailings to Interested Parties The name of an Interested Party; Used for envelope/communication addressing */ recipient?: string | undefined; /** * Delivery method instruction for account statements for a given Interested Party; Can be `PHYSICAL`, `SUPPRESS`; Defaults to `PHYSICAL` on party creation */ statementDeliveryPreference?: | InterestedPartyUpdateStatementDeliveryPreferenceOpen | undefined; /** * Delivery method instruction for trade confirmations for a given Interested Party record; Can be `PHYSICAL`, `SUPPRESS`; Defaults to `PHYSICAL` on party creation */ tradeConfirmationDeliveryPreference?: | InterestedPartyUpdateTradeConfirmationDeliveryPreferenceOpen | undefined; }; /** @internal */ export const InterestedPartyUpdateStatementDeliveryPreference$inboundSchema: z.ZodType< InterestedPartyUpdateStatementDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(InterestedPartyUpdateStatementDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const InterestedPartyUpdateStatementDeliveryPreference$outboundSchema: z.ZodType< InterestedPartyUpdateStatementDeliveryPreferenceOpen, z.ZodTypeDef, InterestedPartyUpdateStatementDeliveryPreferenceOpen > = z.union([ z.nativeEnum(InterestedPartyUpdateStatementDeliveryPreference), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace InterestedPartyUpdateStatementDeliveryPreference$ { /** @deprecated use `InterestedPartyUpdateStatementDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = InterestedPartyUpdateStatementDeliveryPreference$inboundSchema; /** @deprecated use `InterestedPartyUpdateStatementDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = InterestedPartyUpdateStatementDeliveryPreference$outboundSchema; } /** @internal */ export const InterestedPartyUpdateTradeConfirmationDeliveryPreference$inboundSchema: z.ZodType< InterestedPartyUpdateTradeConfirmationDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(InterestedPartyUpdateTradeConfirmationDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const InterestedPartyUpdateTradeConfirmationDeliveryPreference$outboundSchema: z.ZodType< InterestedPartyUpdateTradeConfirmationDeliveryPreferenceOpen, z.ZodTypeDef, InterestedPartyUpdateTradeConfirmationDeliveryPreferenceOpen > = z.union([ z.nativeEnum(InterestedPartyUpdateTradeConfirmationDeliveryPreference), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace InterestedPartyUpdateTradeConfirmationDeliveryPreference$ { /** @deprecated use `InterestedPartyUpdateTradeConfirmationDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = InterestedPartyUpdateTradeConfirmationDeliveryPreference$inboundSchema; /** @deprecated use `InterestedPartyUpdateTradeConfirmationDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = InterestedPartyUpdateTradeConfirmationDeliveryPreference$outboundSchema; } /** @internal */ export const InterestedPartyUpdate$inboundSchema: z.ZodType< InterestedPartyUpdate, z.ZodTypeDef, unknown > = z.object({ mailing_address: PostalAddressUpdate$inboundSchema.optional(), recipient: z.string().optional(), statement_delivery_preference: InterestedPartyUpdateStatementDeliveryPreference$inboundSchema.optional(), trade_confirmation_delivery_preference: InterestedPartyUpdateTradeConfirmationDeliveryPreference$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "mailing_address": "mailingAddress", "statement_delivery_preference": "statementDeliveryPreference", "trade_confirmation_delivery_preference": "tradeConfirmationDeliveryPreference", }); }); /** @internal */ export type InterestedPartyUpdate$Outbound = { mailing_address?: PostalAddressUpdate$Outbound | undefined; recipient?: string | undefined; statement_delivery_preference?: string | undefined; trade_confirmation_delivery_preference?: string | undefined; }; /** @internal */ export const InterestedPartyUpdate$outboundSchema: z.ZodType< InterestedPartyUpdate$Outbound, z.ZodTypeDef, InterestedPartyUpdate > = z.object({ mailingAddress: PostalAddressUpdate$outboundSchema.optional(), recipient: z.string().optional(), statementDeliveryPreference: InterestedPartyUpdateStatementDeliveryPreference$outboundSchema.optional(), tradeConfirmationDeliveryPreference: InterestedPartyUpdateTradeConfirmationDeliveryPreference$outboundSchema .optional(), }).transform((v) => { return remap$(v, { mailingAddress: "mailing_address", statementDeliveryPreference: "statement_delivery_preference", tradeConfirmationDeliveryPreference: "trade_confirmation_delivery_preference", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace InterestedPartyUpdate$ { /** @deprecated use `InterestedPartyUpdate$inboundSchema` instead. */ export const inboundSchema = InterestedPartyUpdate$inboundSchema; /** @deprecated use `InterestedPartyUpdate$outboundSchema` instead. */ export const outboundSchema = InterestedPartyUpdate$outboundSchema; /** @deprecated use `InterestedPartyUpdate$Outbound` instead. */ export type Outbound = InterestedPartyUpdate$Outbound; } export function interestedPartyUpdateToJSON( interestedPartyUpdate: InterestedPartyUpdate, ): string { return JSON.stringify( InterestedPartyUpdate$outboundSchema.parse(interestedPartyUpdate), ); } export function interestedPartyUpdateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InterestedPartyUpdate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InterestedPartyUpdate' from JSON`, ); }