/* * 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 { PhoneNumberUpdate, PhoneNumberUpdate$inboundSchema, PhoneNumberUpdate$Outbound, PhoneNumberUpdate$outboundSchema, } from "./phonenumberupdate.js"; import { PostalAddressUpdate, PostalAddressUpdate$inboundSchema, PostalAddressUpdate$Outbound, PostalAddressUpdate$outboundSchema, } from "./postaladdressupdate.js"; /** * Delivery method instruction for prospectuses for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ export enum PartyRequestUpdateProspectusDeliveryPreference { DeliveryPreferenceUnspecified = "DELIVERY_PREFERENCE_UNSPECIFIED", Digital = "DIGITAL", Physical = "PHYSICAL", Suppress = "SUPPRESS", } /** * Delivery method instruction for prospectuses for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ export type PartyRequestUpdateProspectusDeliveryPreferenceOpen = OpenEnum< typeof PartyRequestUpdateProspectusDeliveryPreference >; /** * Delivery method instruction for proxy voting for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ export enum PartyRequestUpdateProxyDeliveryPreference { DeliveryPreferenceUnspecified = "DELIVERY_PREFERENCE_UNSPECIFIED", Digital = "DIGITAL", Physical = "PHYSICAL", Suppress = "SUPPRESS", } /** * Delivery method instruction for proxy voting for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ export type PartyRequestUpdateProxyDeliveryPreferenceOpen = OpenEnum< typeof PartyRequestUpdateProxyDeliveryPreference >; /** * Conveys how a person is related to account; Located on each account Party record; Examples are `PRIMARY_OWNER`, `JOINT_OWNER`, `EXECUTOR`, etc. */ export enum PartyRequestUpdateRelationType { PartyRelationTypeUnspecified = "PARTY_RELATION_TYPE_UNSPECIFIED", PrimaryOwner = "PRIMARY_OWNER", JointOwner = "JOINT_OWNER", Custodian = "CUSTODIAN", Executor = "EXECUTOR", AuthorizedSigner = "AUTHORIZED_SIGNER", BeneficialOwner = "BENEFICIAL_OWNER", ControlPerson = "CONTROL_PERSON", AuthorizedRepresentative = "AUTHORIZED_REPRESENTATIVE", Trustee = "TRUSTEE", AuthTrusteeRep = "AUTH_TRUSTEE_REP", } /** * Conveys how a person is related to account; Located on each account Party record; Examples are `PRIMARY_OWNER`, `JOINT_OWNER`, `EXECUTOR`, etc. */ export type PartyRequestUpdateRelationTypeOpen = OpenEnum< typeof PartyRequestUpdateRelationType >; /** * Delivery method instruction for account statements for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ export enum PartyRequestUpdateStatementDeliveryPreference { DeliveryPreferenceUnspecified = "DELIVERY_PREFERENCE_UNSPECIFIED", Digital = "DIGITAL", Physical = "PHYSICAL", Suppress = "SUPPRESS", } /** * Delivery method instruction for account statements for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ export type PartyRequestUpdateStatementDeliveryPreferenceOpen = OpenEnum< typeof PartyRequestUpdateStatementDeliveryPreference >; /** * Delivery method instruction for tax documents for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated; Per regulation, selected tax forms will be mailed by regulation regardless of this setting */ export enum PartyRequestUpdateTaxDocumentDeliveryPreference { DeliveryPreferenceUnspecified = "DELIVERY_PREFERENCE_UNSPECIFIED", Digital = "DIGITAL", Physical = "PHYSICAL", Suppress = "SUPPRESS", } /** * Delivery method instruction for tax documents for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated; Per regulation, selected tax forms will be mailed by regulation regardless of this setting */ export type PartyRequestUpdateTaxDocumentDeliveryPreferenceOpen = OpenEnum< typeof PartyRequestUpdateTaxDocumentDeliveryPreference >; /** * Delivery method instruction for trade confirmations for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ export enum PartyRequestUpdateTradeConfirmationDeliveryPreference { DeliveryPreferenceUnspecified = "DELIVERY_PREFERENCE_UNSPECIFIED", Digital = "DIGITAL", Physical = "PHYSICAL", Suppress = "SUPPRESS", } /** * Delivery method instruction for trade confirmations for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ export type PartyRequestUpdateTradeConfirmationDeliveryPreferenceOpen = OpenEnum; /** * A single record representing an owner or manager of an Account. Contains fully populated Party Identity object. */ export type PartyRequestUpdate = { /** * An email address indicated for account communications. */ emailAddress?: string | undefined; /** * Legal entity ID. */ legalEntityId?: string | undefined; /** * Legal natural person ID. */ legalNaturalPersonId?: string | undefined; /** * 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; /** * An object representing a phone number, suitable as an API wire format. * * @remarks * * This representation: * * - should not be used for locale-specific formatting of a phone number, such as "+1 (650) 253-0000 ext. 123" * * - is not designed for efficient storage - may not be suitable for dialing - specialized libraries (see references) should be used to parse the number for that purpose * * To do something meaningful with this number, such as format it for various use-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first. * * For instance, in Java this would be: * * com.google.type.PhoneNumber wireProto = com.google.type.PhoneNumber.newBuilder().build(); com.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber = PhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), "ZZ"); if (!wireProto.getExtension().isEmpty()) { phoneNumber.setExtension(wireProto.getExtension()); } * * Reference(s): * - https://github.com/google/libphonenumber */ phoneNumber?: PhoneNumberUpdate | undefined; /** * Delivery method instruction for prospectuses for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ prospectusDeliveryPreference?: | PartyRequestUpdateProspectusDeliveryPreferenceOpen | undefined; /** * Delivery method instruction for proxy voting for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ proxyDeliveryPreference?: | PartyRequestUpdateProxyDeliveryPreferenceOpen | undefined; /** * Conveys how a person is related to account; Located on each account Party record; Examples are `PRIMARY_OWNER`, `JOINT_OWNER`, `EXECUTOR`, etc. */ relationType?: PartyRequestUpdateRelationTypeOpen | undefined; /** * Delivery method instruction for account statements for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ statementDeliveryPreference?: | PartyRequestUpdateStatementDeliveryPreferenceOpen | undefined; /** * Delivery method instruction for tax documents for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated; Per regulation, selected tax forms will be mailed by regulation regardless of this setting */ taxDocumentDeliveryPreference?: | PartyRequestUpdateTaxDocumentDeliveryPreferenceOpen | undefined; /** * Delivery method instruction for trade confirmations for a given Party record; Can be `DIGITAL`, `PHYSICAL`, `SUPPRESS`; Defaults to `DIGITAL` on account creation but may be updated */ tradeConfirmationDeliveryPreference?: | PartyRequestUpdateTradeConfirmationDeliveryPreferenceOpen | undefined; }; /** @internal */ export const PartyRequestUpdateProspectusDeliveryPreference$inboundSchema: z.ZodType< PartyRequestUpdateProspectusDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PartyRequestUpdateProspectusDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PartyRequestUpdateProspectusDeliveryPreference$outboundSchema: z.ZodType< PartyRequestUpdateProspectusDeliveryPreferenceOpen, z.ZodTypeDef, PartyRequestUpdateProspectusDeliveryPreferenceOpen > = z.union([ z.nativeEnum(PartyRequestUpdateProspectusDeliveryPreference), 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 PartyRequestUpdateProspectusDeliveryPreference$ { /** @deprecated use `PartyRequestUpdateProspectusDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = PartyRequestUpdateProspectusDeliveryPreference$inboundSchema; /** @deprecated use `PartyRequestUpdateProspectusDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = PartyRequestUpdateProspectusDeliveryPreference$outboundSchema; } /** @internal */ export const PartyRequestUpdateProxyDeliveryPreference$inboundSchema: z.ZodType< PartyRequestUpdateProxyDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PartyRequestUpdateProxyDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PartyRequestUpdateProxyDeliveryPreference$outboundSchema: z.ZodType< PartyRequestUpdateProxyDeliveryPreferenceOpen, z.ZodTypeDef, PartyRequestUpdateProxyDeliveryPreferenceOpen > = z.union([ z.nativeEnum(PartyRequestUpdateProxyDeliveryPreference), 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 PartyRequestUpdateProxyDeliveryPreference$ { /** @deprecated use `PartyRequestUpdateProxyDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = PartyRequestUpdateProxyDeliveryPreference$inboundSchema; /** @deprecated use `PartyRequestUpdateProxyDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = PartyRequestUpdateProxyDeliveryPreference$outboundSchema; } /** @internal */ export const PartyRequestUpdateRelationType$inboundSchema: z.ZodType< PartyRequestUpdateRelationTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PartyRequestUpdateRelationType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PartyRequestUpdateRelationType$outboundSchema: z.ZodType< PartyRequestUpdateRelationTypeOpen, z.ZodTypeDef, PartyRequestUpdateRelationTypeOpen > = z.union([ z.nativeEnum(PartyRequestUpdateRelationType), 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 PartyRequestUpdateRelationType$ { /** @deprecated use `PartyRequestUpdateRelationType$inboundSchema` instead. */ export const inboundSchema = PartyRequestUpdateRelationType$inboundSchema; /** @deprecated use `PartyRequestUpdateRelationType$outboundSchema` instead. */ export const outboundSchema = PartyRequestUpdateRelationType$outboundSchema; } /** @internal */ export const PartyRequestUpdateStatementDeliveryPreference$inboundSchema: z.ZodType< PartyRequestUpdateStatementDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PartyRequestUpdateStatementDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PartyRequestUpdateStatementDeliveryPreference$outboundSchema: z.ZodType< PartyRequestUpdateStatementDeliveryPreferenceOpen, z.ZodTypeDef, PartyRequestUpdateStatementDeliveryPreferenceOpen > = z.union([ z.nativeEnum(PartyRequestUpdateStatementDeliveryPreference), 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 PartyRequestUpdateStatementDeliveryPreference$ { /** @deprecated use `PartyRequestUpdateStatementDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = PartyRequestUpdateStatementDeliveryPreference$inboundSchema; /** @deprecated use `PartyRequestUpdateStatementDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = PartyRequestUpdateStatementDeliveryPreference$outboundSchema; } /** @internal */ export const PartyRequestUpdateTaxDocumentDeliveryPreference$inboundSchema: z.ZodType< PartyRequestUpdateTaxDocumentDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PartyRequestUpdateTaxDocumentDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PartyRequestUpdateTaxDocumentDeliveryPreference$outboundSchema: z.ZodType< PartyRequestUpdateTaxDocumentDeliveryPreferenceOpen, z.ZodTypeDef, PartyRequestUpdateTaxDocumentDeliveryPreferenceOpen > = z.union([ z.nativeEnum(PartyRequestUpdateTaxDocumentDeliveryPreference), 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 PartyRequestUpdateTaxDocumentDeliveryPreference$ { /** @deprecated use `PartyRequestUpdateTaxDocumentDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = PartyRequestUpdateTaxDocumentDeliveryPreference$inboundSchema; /** @deprecated use `PartyRequestUpdateTaxDocumentDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = PartyRequestUpdateTaxDocumentDeliveryPreference$outboundSchema; } /** @internal */ export const PartyRequestUpdateTradeConfirmationDeliveryPreference$inboundSchema: z.ZodType< PartyRequestUpdateTradeConfirmationDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PartyRequestUpdateTradeConfirmationDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PartyRequestUpdateTradeConfirmationDeliveryPreference$outboundSchema: z.ZodType< PartyRequestUpdateTradeConfirmationDeliveryPreferenceOpen, z.ZodTypeDef, PartyRequestUpdateTradeConfirmationDeliveryPreferenceOpen > = z.union([ z.nativeEnum(PartyRequestUpdateTradeConfirmationDeliveryPreference), 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 PartyRequestUpdateTradeConfirmationDeliveryPreference$ { /** @deprecated use `PartyRequestUpdateTradeConfirmationDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = PartyRequestUpdateTradeConfirmationDeliveryPreference$inboundSchema; /** @deprecated use `PartyRequestUpdateTradeConfirmationDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = PartyRequestUpdateTradeConfirmationDeliveryPreference$outboundSchema; } /** @internal */ export const PartyRequestUpdate$inboundSchema: z.ZodType< PartyRequestUpdate, z.ZodTypeDef, unknown > = z.object({ email_address: z.string().optional(), legal_entity_id: z.string().optional(), legal_natural_person_id: z.string().optional(), mailing_address: PostalAddressUpdate$inboundSchema.optional(), phone_number: PhoneNumberUpdate$inboundSchema.optional(), prospectus_delivery_preference: PartyRequestUpdateProspectusDeliveryPreference$inboundSchema.optional(), proxy_delivery_preference: PartyRequestUpdateProxyDeliveryPreference$inboundSchema.optional(), relation_type: PartyRequestUpdateRelationType$inboundSchema.optional(), statement_delivery_preference: PartyRequestUpdateStatementDeliveryPreference$inboundSchema.optional(), tax_document_delivery_preference: PartyRequestUpdateTaxDocumentDeliveryPreference$inboundSchema.optional(), trade_confirmation_delivery_preference: PartyRequestUpdateTradeConfirmationDeliveryPreference$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "email_address": "emailAddress", "legal_entity_id": "legalEntityId", "legal_natural_person_id": "legalNaturalPersonId", "mailing_address": "mailingAddress", "phone_number": "phoneNumber", "prospectus_delivery_preference": "prospectusDeliveryPreference", "proxy_delivery_preference": "proxyDeliveryPreference", "relation_type": "relationType", "statement_delivery_preference": "statementDeliveryPreference", "tax_document_delivery_preference": "taxDocumentDeliveryPreference", "trade_confirmation_delivery_preference": "tradeConfirmationDeliveryPreference", }); }); /** @internal */ export type PartyRequestUpdate$Outbound = { email_address?: string | undefined; legal_entity_id?: string | undefined; legal_natural_person_id?: string | undefined; mailing_address?: PostalAddressUpdate$Outbound | undefined; phone_number?: PhoneNumberUpdate$Outbound | undefined; prospectus_delivery_preference?: string | undefined; proxy_delivery_preference?: string | undefined; relation_type?: string | undefined; statement_delivery_preference?: string | undefined; tax_document_delivery_preference?: string | undefined; trade_confirmation_delivery_preference?: string | undefined; }; /** @internal */ export const PartyRequestUpdate$outboundSchema: z.ZodType< PartyRequestUpdate$Outbound, z.ZodTypeDef, PartyRequestUpdate > = z.object({ emailAddress: z.string().optional(), legalEntityId: z.string().optional(), legalNaturalPersonId: z.string().optional(), mailingAddress: PostalAddressUpdate$outboundSchema.optional(), phoneNumber: PhoneNumberUpdate$outboundSchema.optional(), prospectusDeliveryPreference: PartyRequestUpdateProspectusDeliveryPreference$outboundSchema.optional(), proxyDeliveryPreference: PartyRequestUpdateProxyDeliveryPreference$outboundSchema.optional(), relationType: PartyRequestUpdateRelationType$outboundSchema.optional(), statementDeliveryPreference: PartyRequestUpdateStatementDeliveryPreference$outboundSchema.optional(), taxDocumentDeliveryPreference: PartyRequestUpdateTaxDocumentDeliveryPreference$outboundSchema.optional(), tradeConfirmationDeliveryPreference: PartyRequestUpdateTradeConfirmationDeliveryPreference$outboundSchema .optional(), }).transform((v) => { return remap$(v, { emailAddress: "email_address", legalEntityId: "legal_entity_id", legalNaturalPersonId: "legal_natural_person_id", mailingAddress: "mailing_address", phoneNumber: "phone_number", prospectusDeliveryPreference: "prospectus_delivery_preference", proxyDeliveryPreference: "proxy_delivery_preference", relationType: "relation_type", statementDeliveryPreference: "statement_delivery_preference", taxDocumentDeliveryPreference: "tax_document_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 PartyRequestUpdate$ { /** @deprecated use `PartyRequestUpdate$inboundSchema` instead. */ export const inboundSchema = PartyRequestUpdate$inboundSchema; /** @deprecated use `PartyRequestUpdate$outboundSchema` instead. */ export const outboundSchema = PartyRequestUpdate$outboundSchema; /** @deprecated use `PartyRequestUpdate$Outbound` instead. */ export type Outbound = PartyRequestUpdate$Outbound; } export function partyRequestUpdateToJSON( partyRequestUpdate: PartyRequestUpdate, ): string { return JSON.stringify( PartyRequestUpdate$outboundSchema.parse(partyRequestUpdate), ); } export function partyRequestUpdateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PartyRequestUpdate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PartyRequestUpdate' from JSON`, ); }