/* * 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"; /** * The specified account’s current accreditation type. */ export enum AccreditationType { AccreditationTypeUnspecified = "ACCREDITATION_TYPE_UNSPECIFIED", NetWorthGt1M = "NET_WORTH_GT_1M", IndividualIncomeGt200K = "INDIVIDUAL_INCOME_GT_200K", JointIncomeGt300K = "JOINT_INCOME_GT_300K", ProfessionDesignation = "PROFESSION_DESIGNATION", TrustGt5M = "TRUST_GT_5M", GrantorsAccredited = "GRANTORS_ACCREDITED", EquityOwnersAccredited = "EQUITY_OWNERS_ACCREDITED", TotalAssetsGt5M = "TOTAL_ASSETS_GT_5M", InvestmentCompany = "INVESTMENT_COMPANY", SecOrExemptAdvisor = "SEC_OR_EXEMPT_ADVISOR", KnowledgeableEmployee = "KNOWLEDGEABLE_EMPLOYEE", KnowledgeableExecutive = "KNOWLEDGEABLE_EXECUTIVE", FamilyOfficeGt5M = "FAMILY_OFFICE_GT_5M", NotAccredited = "NOT_ACCREDITED", } /** * The specified account’s current accreditation type. */ export type AccreditationTypeOpen = OpenEnum; /** * An account accreditation */ export type AccountAccreditation = { /** * The ID of the account specified in the request. */ accountId?: string | undefined; /** * The specified account’s current accreditation type. */ accreditationType?: AccreditationTypeOpen | undefined; /** * The resource name of the account accreditation. Note `{account}` will be the `account_id` value. * * @remarks * * Format: accounts/{account}/accreditation */ name?: string | undefined; /** * The date and time when the accreditation was last set or updated. Uses [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). */ updateTime?: Date | null | undefined; }; /** @internal */ export const AccreditationType$inboundSchema: z.ZodType< AccreditationTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccreditationType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccreditationType$outboundSchema: z.ZodType< AccreditationTypeOpen, z.ZodTypeDef, AccreditationTypeOpen > = z.union([ z.nativeEnum(AccreditationType), 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 AccreditationType$ { /** @deprecated use `AccreditationType$inboundSchema` instead. */ export const inboundSchema = AccreditationType$inboundSchema; /** @deprecated use `AccreditationType$outboundSchema` instead. */ export const outboundSchema = AccreditationType$outboundSchema; } /** @internal */ export const AccountAccreditation$inboundSchema: z.ZodType< AccountAccreditation, z.ZodTypeDef, unknown > = z.object({ account_id: z.string().optional(), accreditation_type: AccreditationType$inboundSchema.optional(), name: z.string().optional(), update_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "accreditation_type": "accreditationType", "update_time": "updateTime", }); }); /** @internal */ export type AccountAccreditation$Outbound = { account_id?: string | undefined; accreditation_type?: string | undefined; name?: string | undefined; update_time?: string | null | undefined; }; /** @internal */ export const AccountAccreditation$outboundSchema: z.ZodType< AccountAccreditation$Outbound, z.ZodTypeDef, AccountAccreditation > = z.object({ accountId: z.string().optional(), accreditationType: AccreditationType$outboundSchema.optional(), name: z.string().optional(), updateTime: z.nullable(z.date().transform(v => v.toISOString())).optional(), }).transform((v) => { return remap$(v, { accountId: "account_id", accreditationType: "accreditation_type", updateTime: "update_time", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountAccreditation$ { /** @deprecated use `AccountAccreditation$inboundSchema` instead. */ export const inboundSchema = AccountAccreditation$inboundSchema; /** @deprecated use `AccountAccreditation$outboundSchema` instead. */ export const outboundSchema = AccountAccreditation$outboundSchema; /** @deprecated use `AccountAccreditation$Outbound` instead. */ export type Outbound = AccountAccreditation$Outbound; } export function accountAccreditationToJSON( accountAccreditation: AccountAccreditation, ): string { return JSON.stringify( AccountAccreditation$outboundSchema.parse(accountAccreditation), ); } export function accountAccreditationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountAccreditation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountAccreditation' from JSON`, ); }