/* * 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 { PhoneNumberCreate, PhoneNumberCreate$inboundSchema, PhoneNumberCreate$Outbound, PhoneNumberCreate$outboundSchema, } from "./phonenumbercreate.js"; import { PostalAddressCreate, PostalAddressCreate$inboundSchema, PostalAddressCreate$Outbound, PostalAddressCreate$outboundSchema, } from "./postaladdresscreate.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 ProspectusDeliveryPreference { 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 ProspectusDeliveryPreferenceOpen = OpenEnum< typeof ProspectusDeliveryPreference >; /** * 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 ProxyDeliveryPreference { 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 ProxyDeliveryPreferenceOpen = OpenEnum< typeof ProxyDeliveryPreference >; /** * Conveys how a person is related to account; Located on each account Party record; Examples are `PRIMARY_OWNER`, `JOINT_OWNER`, `EXECUTOR`, etc. */ export enum RelationType { 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 RelationTypeOpen = OpenEnum; /** * 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 PartyRequestCreateStatementDeliveryPreference { 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 PartyRequestCreateStatementDeliveryPreferenceOpen = OpenEnum< typeof PartyRequestCreateStatementDeliveryPreference >; /** * 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 TaxDocumentDeliveryPreference { 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 TaxDocumentDeliveryPreferenceOpen = OpenEnum< typeof TaxDocumentDeliveryPreference >; /** * 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 PartyRequestCreateTradeConfirmationDeliveryPreference { 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 PartyRequestCreateTradeConfirmationDeliveryPreferenceOpen = OpenEnum; /** * A single record representing an owner or manager of an Account. Contains fully populated Party Identity object. */ export type PartyRequestCreate = { /** * An email address indicated for account communications. */ emailAddress: string; /** * 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: PostalAddressCreate; /** * 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: PhoneNumberCreate; /** * 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?: ProspectusDeliveryPreferenceOpen | 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?: ProxyDeliveryPreferenceOpen | undefined; /** * Conveys how a person is related to account; Located on each account Party record; Examples are `PRIMARY_OWNER`, `JOINT_OWNER`, `EXECUTOR`, etc. */ relationType: RelationTypeOpen; /** * 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?: | PartyRequestCreateStatementDeliveryPreferenceOpen | 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?: TaxDocumentDeliveryPreferenceOpen | 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?: | PartyRequestCreateTradeConfirmationDeliveryPreferenceOpen | undefined; }; /** @internal */ export const ProspectusDeliveryPreference$inboundSchema: z.ZodType< ProspectusDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(ProspectusDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const ProspectusDeliveryPreference$outboundSchema: z.ZodType< ProspectusDeliveryPreferenceOpen, z.ZodTypeDef, ProspectusDeliveryPreferenceOpen > = z.union([ z.nativeEnum(ProspectusDeliveryPreference), 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 ProspectusDeliveryPreference$ { /** @deprecated use `ProspectusDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = ProspectusDeliveryPreference$inboundSchema; /** @deprecated use `ProspectusDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = ProspectusDeliveryPreference$outboundSchema; } /** @internal */ export const ProxyDeliveryPreference$inboundSchema: z.ZodType< ProxyDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(ProxyDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const ProxyDeliveryPreference$outboundSchema: z.ZodType< ProxyDeliveryPreferenceOpen, z.ZodTypeDef, ProxyDeliveryPreferenceOpen > = z.union([ z.nativeEnum(ProxyDeliveryPreference), 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 ProxyDeliveryPreference$ { /** @deprecated use `ProxyDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = ProxyDeliveryPreference$inboundSchema; /** @deprecated use `ProxyDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = ProxyDeliveryPreference$outboundSchema; } /** @internal */ export const RelationType$inboundSchema: z.ZodType< RelationTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(RelationType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const RelationType$outboundSchema: z.ZodType< RelationTypeOpen, z.ZodTypeDef, RelationTypeOpen > = z.union([ z.nativeEnum(RelationType), 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 RelationType$ { /** @deprecated use `RelationType$inboundSchema` instead. */ export const inboundSchema = RelationType$inboundSchema; /** @deprecated use `RelationType$outboundSchema` instead. */ export const outboundSchema = RelationType$outboundSchema; } /** @internal */ export const PartyRequestCreateStatementDeliveryPreference$inboundSchema: z.ZodType< PartyRequestCreateStatementDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PartyRequestCreateStatementDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PartyRequestCreateStatementDeliveryPreference$outboundSchema: z.ZodType< PartyRequestCreateStatementDeliveryPreferenceOpen, z.ZodTypeDef, PartyRequestCreateStatementDeliveryPreferenceOpen > = z.union([ z.nativeEnum(PartyRequestCreateStatementDeliveryPreference), 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 PartyRequestCreateStatementDeliveryPreference$ { /** @deprecated use `PartyRequestCreateStatementDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = PartyRequestCreateStatementDeliveryPreference$inboundSchema; /** @deprecated use `PartyRequestCreateStatementDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = PartyRequestCreateStatementDeliveryPreference$outboundSchema; } /** @internal */ export const TaxDocumentDeliveryPreference$inboundSchema: z.ZodType< TaxDocumentDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TaxDocumentDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TaxDocumentDeliveryPreference$outboundSchema: z.ZodType< TaxDocumentDeliveryPreferenceOpen, z.ZodTypeDef, TaxDocumentDeliveryPreferenceOpen > = z.union([ z.nativeEnum(TaxDocumentDeliveryPreference), 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 TaxDocumentDeliveryPreference$ { /** @deprecated use `TaxDocumentDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = TaxDocumentDeliveryPreference$inboundSchema; /** @deprecated use `TaxDocumentDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = TaxDocumentDeliveryPreference$outboundSchema; } /** @internal */ export const PartyRequestCreateTradeConfirmationDeliveryPreference$inboundSchema: z.ZodType< PartyRequestCreateTradeConfirmationDeliveryPreferenceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PartyRequestCreateTradeConfirmationDeliveryPreference), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PartyRequestCreateTradeConfirmationDeliveryPreference$outboundSchema: z.ZodType< PartyRequestCreateTradeConfirmationDeliveryPreferenceOpen, z.ZodTypeDef, PartyRequestCreateTradeConfirmationDeliveryPreferenceOpen > = z.union([ z.nativeEnum(PartyRequestCreateTradeConfirmationDeliveryPreference), 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 PartyRequestCreateTradeConfirmationDeliveryPreference$ { /** @deprecated use `PartyRequestCreateTradeConfirmationDeliveryPreference$inboundSchema` instead. */ export const inboundSchema = PartyRequestCreateTradeConfirmationDeliveryPreference$inboundSchema; /** @deprecated use `PartyRequestCreateTradeConfirmationDeliveryPreference$outboundSchema` instead. */ export const outboundSchema = PartyRequestCreateTradeConfirmationDeliveryPreference$outboundSchema; } /** @internal */ export const PartyRequestCreate$inboundSchema: z.ZodType< PartyRequestCreate, z.ZodTypeDef, unknown > = z.object({ email_address: z.string(), legal_entity_id: z.string().optional(), legal_natural_person_id: z.string().optional(), mailing_address: PostalAddressCreate$inboundSchema, phone_number: PhoneNumberCreate$inboundSchema, prospectus_delivery_preference: ProspectusDeliveryPreference$inboundSchema .optional(), proxy_delivery_preference: ProxyDeliveryPreference$inboundSchema.optional(), relation_type: RelationType$inboundSchema, statement_delivery_preference: PartyRequestCreateStatementDeliveryPreference$inboundSchema.optional(), tax_document_delivery_preference: TaxDocumentDeliveryPreference$inboundSchema .optional(), trade_confirmation_delivery_preference: PartyRequestCreateTradeConfirmationDeliveryPreference$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 PartyRequestCreate$Outbound = { email_address: string; legal_entity_id?: string | undefined; legal_natural_person_id?: string | undefined; mailing_address: PostalAddressCreate$Outbound; phone_number: PhoneNumberCreate$Outbound; prospectus_delivery_preference?: string | undefined; proxy_delivery_preference?: string | undefined; relation_type: string; statement_delivery_preference?: string | undefined; tax_document_delivery_preference?: string | undefined; trade_confirmation_delivery_preference?: string | undefined; }; /** @internal */ export const PartyRequestCreate$outboundSchema: z.ZodType< PartyRequestCreate$Outbound, z.ZodTypeDef, PartyRequestCreate > = z.object({ emailAddress: z.string(), legalEntityId: z.string().optional(), legalNaturalPersonId: z.string().optional(), mailingAddress: PostalAddressCreate$outboundSchema, phoneNumber: PhoneNumberCreate$outboundSchema, prospectusDeliveryPreference: ProspectusDeliveryPreference$outboundSchema .optional(), proxyDeliveryPreference: ProxyDeliveryPreference$outboundSchema.optional(), relationType: RelationType$outboundSchema, statementDeliveryPreference: PartyRequestCreateStatementDeliveryPreference$outboundSchema.optional(), taxDocumentDeliveryPreference: TaxDocumentDeliveryPreference$outboundSchema .optional(), tradeConfirmationDeliveryPreference: PartyRequestCreateTradeConfirmationDeliveryPreference$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 PartyRequestCreate$ { /** @deprecated use `PartyRequestCreate$inboundSchema` instead. */ export const inboundSchema = PartyRequestCreate$inboundSchema; /** @deprecated use `PartyRequestCreate$outboundSchema` instead. */ export const outboundSchema = PartyRequestCreate$outboundSchema; /** @deprecated use `PartyRequestCreate$Outbound` instead. */ export type Outbound = PartyRequestCreate$Outbound; } export function partyRequestCreateToJSON( partyRequestCreate: PartyRequestCreate, ): string { return JSON.stringify( PartyRequestCreate$outboundSchema.parse(partyRequestCreate), ); } export function partyRequestCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PartyRequestCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PartyRequestCreate' from JSON`, ); }