import {z} from 'zod' export type IdentityStatus = 'PENDING' | 'ERROR' | 'APPROVED' | 'DENIED' | 'DISABLED'; export type IdentityMailingAddress = {country: string, address1: string, address2?: string | undefined, city: string, province: string, zip_code?: string | undefined}; export type IdentityprotoVerifierType = 'PAXOS' | 'PASSTHROUGH' | 'MANUAL'; export type PassthroughVerifierType = 'JUMIO' | 'ALLOY' | 'LEXISNEXIS' | 'MITEK' | 'SUMSUB' | 'MICROBILT' | 'ONFIDO' | 'CUSTOMER' | 'EQUIFAX' | 'ID3_AUTHENTICATE' | 'FIS' | 'PROVE' | 'PERSONA' | 'PLAID' | 'DOTFILE' | 'AIPRISE'; export type PersonDetailsCIPIDType = 'SSN' | 'ID_CARD' | 'ITIN' | 'PASSPORT' | 'DRIVING_LICENSE' | 'VISA'; export type PassthroughVerificationField = 'FULL_LEGAL_NAME' | 'ADDRESS' | 'DATE_OF_BIRTH' | 'CIP_ID'; export type PersonDetails = {id_verification_status?: IdentityStatus | undefined, sanctions_verification_status?: IdentityStatus | undefined, first_name?: string | undefined, last_name?: string | undefined, date_of_birth?: string | undefined, govt_id?: string | undefined, address?: IdentityMailingAddress | undefined, phone_number?: string | undefined, email?: string | undefined, nationality?: string | undefined, verifier_id?: string | undefined, verifier_type?: IdentityprotoVerifierType | undefined, id_verification_url?: string | undefined, passthrough_verifier_type?: PassthroughVerifierType | undefined, passthrough_verified_at?: string | undefined, govt_id_type?: PersonDetailsCIPIDType | undefined, cip_id?: string | undefined, cip_id_type?: PersonDetailsCIPIDType | undefined, cip_id_country?: string | undefined, additional_screening_status?: IdentityStatus | undefined, profession?: string | undefined, middle_name?: string | undefined, country_of_birth?: string | undefined, passthrough_verification_id?: string | undefined, passthrough_verification_status?: IdentityStatus | undefined, passthrough_verification_fields?: Array | undefined}; export type InstitutionType = 'TRUST' | 'CORPORATION' | 'LLC' | 'PARTNERSHIP' | 'SOLE_PROPRIETORSHIP'; export type InstitutionSubType = 'INVESTMENT' | 'HEDGE_FUND' | 'MONEY_SERVICE_BUSINESS' | 'STO_ISSUER' | 'PRECIOUS_METALS' | 'NON_PROFIT' | 'REGISTERED_INVESTMENT_ADVISOR' | 'AGRICULTURE_FORESTRY_FISHING_HUNTING' | 'MINING' | 'UTILITIES' | 'CONSTRUCTION' | 'MANUFACTURING' | 'WHOLESALE_TRADE' | 'RETAIL_TRADE' | 'TRANSPORTATION_WAREHOUSING' | 'INFORMATION' | 'FINANCE_INSURANCE' | 'REAL_ESTATE_RENTAL_LEASING' | 'PROFESSIONAL_SCIENTIFIC_TECHNICAL_SERVICES' | 'MANAGEMENT_OF_COMPANIES_ENTERPRISES' | 'ADMINISTRATIVE_SUPPORT_WASTE_MANAGEMENT_REMEDIATION_SERVICES' | 'EDUCATIONAL_SERVICES' | 'HEALTH_CARE_SOCIAL_ASSISTANCE' | 'ARTS_ENTERTAINMENT_RECREATION' | 'ACCOMMODATION_FOOD_SERVICES' | 'OTHER_SERVICES' | 'PUBLIC_ADMINISTRATION' | 'NOT_CLASSIFIED' | 'ADULT_ENTERTAINMENT' | 'AUCTIONS' | 'AUTOMOBILES' | 'BLOCKCHAIN' | 'CRYPTO' | 'DRUGS' | 'EXPORT_IMPORT' | 'E_COMMERCE' | 'FINANCIAL_INSTITUTION' | 'GAMBLING' | 'INSURANCE' | 'MARKET_MAKER' | 'SHELL_BANK' | 'TRAVEL_TRANSPORT' | 'WEAPONS'; export type InstitutionCIPIDType = 'EIN' | 'SSN' | 'ITIN' | 'REGISTRATION_NUMBER'; export type RegulationStatus = 'US_REGULATED' | 'INTL_REGULATED' | 'NON_REGULATED'; export type TradingType = 'PRIVATE' | 'PUBLIC' | 'PUBLICLY_TRADED_SUBSIDIARY'; export type InstitutionDetails = {sanctions_verification_status?: IdentityStatus | undefined, name?: string | undefined, business_address?: IdentityMailingAddress | undefined, phone_number?: string | undefined, email?: string | undefined, institution_type?: InstitutionType | undefined, institution_sub_type?: InstitutionSubType | undefined, cip_id?: string | undefined, cip_id_type?: InstitutionCIPIDType | undefined, cip_id_country?: string | undefined, govt_registration_date?: string | undefined, incorporation_address?: IdentityMailingAddress | undefined, regulation_status?: RegulationStatus | undefined, trading_type?: TradingType | undefined, listed_exchange?: string | undefined, ticker_symbol?: string | undefined, parent_institution_name?: string | undefined, regulator_name?: string | undefined, regulator_jurisdiction?: string | undefined, regulator_register_number?: string | undefined, document_verification_status?: IdentityStatus | undefined, additional_screening_status?: IdentityStatus | undefined, doing_business_as?: string | undefined, business_description?: string | undefined}; export type TINVerificationStatus = 'TIN_VERIFICATION_PENDING' | 'TIN_VERIFICATION_ERROR' | 'TIN_VERIFICATION_VALID'; export type TaxDetail = {tax_payer_id?: string | undefined, tax_payer_country?: string | undefined, tin_verification_status?: TINVerificationStatus | undefined}; export type CustomerDueDiligenceNetWorthRange = 'NET_WORTH_0_TO_100K' | 'NET_WORTH_100K_TO_500K' | 'NET_WORTH_500K_TO_1M' | 'NET_WORTH_1M_TO_2_5M' | 'NET_WORTH_2_5M_TO_5M' | 'NET_WORTH_5M_TO_7_5M' | 'NET_WORTH_7_5M_TO_10M' | 'NET_WORTH_10M_TO_25M' | 'NET_WORTH_25M_TO_50M' | 'NET_WORTH_OVER_50M'; export type CustomerDueDiligenceYearlyIncomeRange = 'INCOME_0_TO_50K' | 'INCOME_50K_TO_100K' | 'INCOME_100K_TO_250K' | 'INCOME_250K_TO_500K' | 'INCOME_500K_TO_750K' | 'INCOME_750K_TO_1M' | 'INCOME_ABOVE_1M'; export type CustomerDueDiligenceTransferValueRange = 'TRANSFER_VALUE_0_TO_25K' | 'TRANSFER_VALUE_25K_TO_50K' | 'TRANSFER_VALUE_50K_TO_100K' | 'TRANSFER_VALUE_100K_TO_250K' | 'TRANSFER_VALUE_250K_TO_500K' | 'TRANSFER_VALUE_500K_TO_750K' | 'TRANSFER_VALUE_750K_TO_1M' | 'TRANSFER_VALUE_1M_TO_2_5M' | 'TRANSFER_VALUE_2_5M_TO_5M' | 'TRANSFER_VALUE_ABOVE_5M'; export type WealthSource = 'INHERITANCE' | 'INVESTMENT_GAINS' | 'BUSINESS_OWNERSHIP_DIVIDENDS' | 'EMPLOYMENT_INCOME' | 'REAL_ESTATE' | 'OTHER_SOURCE_OF_WEALTH'; export type FundsSource = 'SALARY_DISBURSEMENT' | 'INHERITANCE_DISTRIBUTION' | 'INVESTMENT_RETURNS' | 'BUSINESS_DIVIDENDS_PROFITS' | 'PROPERTY_SALE' | 'LOAN_DISBURSEMENT' | 'SAVINGS_ACCOUNT_WITHDRAWAL' | 'GOVERNMENT_BENEFITS'; export type AccountPurpose = 'INVESTMENT_TRADING' | 'SAVINGS' | 'STABLECOIN_PURCHASE_REDEMPTION'; export type EmploymentStatus = 'CONTRACTUAL' | 'FULL_TIME' | 'PART_TIME' | 'RETIRED' | 'SELF_EMPLOYED' | 'STUDENT' | 'UNEMPLOYED'; export type MerchantFundingSourceFundingSource = 'BUSINESS_LOANS_FINANCING' | 'SALARY_SAVINGS' | 'INVESTMENT_GAINS' | 'INHERITANCE' | 'REAL_ESTATE_INCOME' | 'NON_PROFIT_SOURCES' | 'OTHER_BUSINESS_INCOME'; export type CustomerRegion = 'US_CANADA' | 'MEXICO_CENTRAL_AMERICA' | 'SOUTH_AMERICA' | 'EUROPE' | 'ASIA' | 'AFRICA' | 'OCEANIA'; export type CustomerDueDiligence = {aliases?: Array | undefined, estimated_net_worth?: CustomerDueDiligenceNetWorthRange | undefined, estimated_yearly_income?: CustomerDueDiligenceYearlyIncomeRange | undefined, expected_transfer_value?: CustomerDueDiligenceTransferValueRange | undefined, source_of_wealth?: WealthSource | undefined, source_of_funds?: FundsSource | undefined, purpose_of_account?: AccountPurpose | undefined, employment_status?: EmploymentStatus | undefined, employment_industry_sector?: InstitutionSubType | undefined, industry_sector?: InstitutionSubType | undefined, has_underlying_trust_structure?: boolean | undefined, has_nominee_shareholders?: boolean | undefined, created_at?: string | undefined, is_publicly_traded?: boolean | undefined, merchant_funding_source?: MerchantFundingSourceFundingSource | undefined, customer_regions?: Array | undefined}; export type IdentityPublicUpdateIdentityBody = {person_details?: PersonDetails | undefined, metadata?: {[key: string]: string} | undefined, set_user_disabled?: boolean | undefined, institution_details?: InstitutionDetails | undefined, ref_id?: string | undefined, tax_details?: Array | undefined, set_tax_details_not_required?: boolean | undefined, customer_due_diligence?: CustomerDueDiligence | undefined, is_merchant?: boolean | undefined, last_kyc_refresh_date?: string | undefined}; export type UpdateApiIdentityIdentitiesIdArgs = {id: string, body: IdentityPublicUpdateIdentityBody}; export type UpdateApiIdentityIdentitiesIdOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; export const identityStatus = z.enum(["PENDING", "ERROR", "APPROVED", "DENIED", "DISABLED"]); export const identityControlType = z.enum(["SELL_ONLY", "CLOSED", "FROZEN", "DORMANT"]); export const identityControlSetBy = z.enum(["SET_BY_PAXOS", "SET_BY_CLIENT"]); export const identityControlReasonCode = z.enum(["OTHER", "END_USER_REQUEST", "INACTIVITY", "COMPLIANCE_KYC", "COMPLIANCE_EDD", "COMPLIANCE_SCREENING", "COMPLIANCE_INVESTIGATION", "COMPLIANCE_INCOMPLETE", "RISK_FRAUD", "LEGAL_ORDER", "ADMINISTRATIVE"]); export const identityControl = z.object({id: z.string(), type: identityControlType, set_by: identityControlSetBy, is_overridable: z.boolean().optional(), reason_code: identityControlReasonCode.optional(), reason: z.string().optional(), created_at: z.string(), deleted_at: z.string().optional()}); export const identityRequirementRequirementType = z.enum(["ID_VERIFICATION", "DOCUMENT_VERIFICATION", "SCREENING_CHECK", "COMPLIANCE_CHECK", "ENHANCED_DUE_DILIGENCE", "MEMBERS", "KYC_REFRESH", "TAX_DETAILS_VERIFICATION"]); export const identityRequirementErrorCode = z.enum(["IDENTITY_VERIFICATION_FAILED", "DOCUMENT_VERIFICATION_FAILED", "SCREENING_IN_PROGRESS", "SCREENING_FAILED", "KYC_REFRESH_OVERDUE", "MEMBER_VERIFICATION_FAILED", "MEMBER_VERIFICATION_PENDING", "EDD_DOCUMENTATION_REQUIRED", "COMPLIANCE_REVIEW_REQUIRED", "COMPLIANCE_REVIEW_FAILED", "TIN_NOT_FOUND", "IDENTITY_VERIFICATION_REQUIRED", "DOCUMENT_UPLOAD_REQUIRED", "KYC_REFRESH_REQUIRED"]); export const identityRequirementError = z.object({code: identityRequirementErrorCode, description: z.string()}); export const identityRequirementRequirementStatus = z.enum(["PENDING", "FAILED"]); export const identityRequirementAwaitingActionFrom = z.enum(["CLIENT", "PAXOS"]); export const identityRequirement = z.object({type: identityRequirementRequirementType, errors: z.array(identityRequirementError), status: identityRequirementRequirementStatus, awaiting_action_from: identityRequirementAwaitingActionFrom.optional()}); export const identityStatusDetails = z.object({active_controls: z.array(identityControl).optional(), requirements: z.array(identityRequirement).optional()}); export const identityMailingAddress = z.object({country: z.string().max(35), address1: z.string().max(35), address2: z.string().max(35).optional(), city: z.string().max(35), province: z.string().max(35), zip_code: z.string().max(35).optional()}); export const identityprotoVerifierType = z.enum(["PAXOS", "PASSTHROUGH", "MANUAL"]); export const passthroughVerifierType = z.enum(["JUMIO", "ALLOY", "LEXISNEXIS", "MITEK", "SUMSUB", "MICROBILT", "ONFIDO", "CUSTOMER", "EQUIFAX", "ID3_AUTHENTICATE", "FIS", "PROVE", "PERSONA", "PLAID", "DOTFILE", "AIPRISE"]); export const personDetailsCIPIDType = z.enum(["SSN", "ID_CARD", "ITIN", "PASSPORT", "DRIVING_LICENSE", "VISA"]); export const passthroughVerificationField = z.enum(["FULL_LEGAL_NAME", "ADDRESS", "DATE_OF_BIRTH", "CIP_ID"]); export const personDetails = z.object({id_verification_status: identityStatus.optional(), sanctions_verification_status: identityStatus.optional(), first_name: z.string().max(200).optional(), last_name: z.string().max(200).optional(), date_of_birth: z.string().optional(), govt_id: z.string().max(200).optional(), address: identityMailingAddress.optional(), phone_number: z.string().optional(), email: z.string().optional(), nationality: z.string().optional(), verifier_id: z.string().optional(), verifier_type: identityprotoVerifierType.optional(), id_verification_url: z.string().optional(), passthrough_verifier_type: passthroughVerifierType.optional(), passthrough_verified_at: z.string().optional(), govt_id_type: personDetailsCIPIDType.optional(), cip_id: z.string().max(200).optional(), cip_id_type: personDetailsCIPIDType.optional(), cip_id_country: z.string().optional(), additional_screening_status: identityStatus.optional(), profession: z.string().optional(), middle_name: z.string().max(200).optional(), country_of_birth: z.string().optional(), passthrough_verification_id: z.string().optional(), passthrough_verification_status: identityStatus.optional(), passthrough_verification_fields: z.array(passthroughVerificationField).optional()}); export const identityType = z.enum(["PERSON", "INSTITUTION"]); export const institutionType = z.enum(["TRUST", "CORPORATION", "LLC", "PARTNERSHIP", "SOLE_PROPRIETORSHIP"]); export const institutionSubType = z.enum(["INVESTMENT", "HEDGE_FUND", "MONEY_SERVICE_BUSINESS", "STO_ISSUER", "PRECIOUS_METALS", "NON_PROFIT", "REGISTERED_INVESTMENT_ADVISOR", "AGRICULTURE_FORESTRY_FISHING_HUNTING", "MINING", "UTILITIES", "CONSTRUCTION", "MANUFACTURING", "WHOLESALE_TRADE", "RETAIL_TRADE", "TRANSPORTATION_WAREHOUSING", "INFORMATION", "FINANCE_INSURANCE", "REAL_ESTATE_RENTAL_LEASING", "PROFESSIONAL_SCIENTIFIC_TECHNICAL_SERVICES", "MANAGEMENT_OF_COMPANIES_ENTERPRISES", "ADMINISTRATIVE_SUPPORT_WASTE_MANAGEMENT_REMEDIATION_SERVICES", "EDUCATIONAL_SERVICES", "HEALTH_CARE_SOCIAL_ASSISTANCE", "ARTS_ENTERTAINMENT_RECREATION", "ACCOMMODATION_FOOD_SERVICES", "OTHER_SERVICES", "PUBLIC_ADMINISTRATION", "NOT_CLASSIFIED", "ADULT_ENTERTAINMENT", "AUCTIONS", "AUTOMOBILES", "BLOCKCHAIN", "CRYPTO", "DRUGS", "EXPORT_IMPORT", "E_COMMERCE", "FINANCIAL_INSTITUTION", "GAMBLING", "INSURANCE", "MARKET_MAKER", "SHELL_BANK", "TRAVEL_TRANSPORT", "WEAPONS"]); export const institutionCIPIDType = z.enum(["EIN", "SSN", "ITIN", "REGISTRATION_NUMBER"]); export const regulationStatus = z.enum(["US_REGULATED", "INTL_REGULATED", "NON_REGULATED"]); export const tradingType = z.enum(["PRIVATE", "PUBLIC", "PUBLICLY_TRADED_SUBSIDIARY"]); export const institutionDetails = z.object({sanctions_verification_status: identityStatus.optional(), name: z.string().max(200).optional(), business_address: identityMailingAddress.optional(), phone_number: z.string().optional(), email: z.string().optional(), institution_type: institutionType.optional(), institution_sub_type: institutionSubType.optional(), cip_id: z.string().max(200).optional(), cip_id_type: institutionCIPIDType.optional(), cip_id_country: z.string().optional(), govt_registration_date: z.string().optional(), incorporation_address: identityMailingAddress.optional(), regulation_status: regulationStatus.optional(), trading_type: tradingType.optional(), listed_exchange: z.string().optional(), ticker_symbol: z.string().optional(), parent_institution_name: z.string().optional(), regulator_name: z.string().optional(), regulator_jurisdiction: z.string().optional(), regulator_register_number: z.string().optional(), document_verification_status: identityStatus.optional(), additional_screening_status: identityStatus.optional(), doing_business_as: z.string().optional(), business_description: z.string().optional()}); export const institutionRoleType = z.enum(["BENEFICIAL_OWNER", "ACCOUNT_OPENER", "TRUSTEE", "AUTHORIZED_USER", "GRANTOR", "MANAGEMENT_CONTROL_PERSON", "BENEFICIARY", "SOLE_PROPRIETOR"]); export const institutionMember = z.object({identity_id: z.string(), roles: z.array(institutionRoleType).optional(), ownership: z.string().optional(), position: z.string().optional(), name: z.string().optional(), summary_status: identityStatus.optional(), id: z.string().optional()}); export const tINVerificationStatus = z.enum(["TIN_VERIFICATION_PENDING", "TIN_VERIFICATION_ERROR", "TIN_VERIFICATION_VALID"]); export const taxDetail = z.object({tax_payer_id: z.string().max(35).optional(), tax_payer_country: z.string().optional(), tin_verification_status: tINVerificationStatus.optional()}); export const customerDueDiligenceNetWorthRange = z.enum(["NET_WORTH_0_TO_100K", "NET_WORTH_100K_TO_500K", "NET_WORTH_500K_TO_1M", "NET_WORTH_1M_TO_2_5M", "NET_WORTH_2_5M_TO_5M", "NET_WORTH_5M_TO_7_5M", "NET_WORTH_7_5M_TO_10M", "NET_WORTH_10M_TO_25M", "NET_WORTH_25M_TO_50M", "NET_WORTH_OVER_50M"]); export const customerDueDiligenceYearlyIncomeRange = z.enum(["INCOME_0_TO_50K", "INCOME_50K_TO_100K", "INCOME_100K_TO_250K", "INCOME_250K_TO_500K", "INCOME_500K_TO_750K", "INCOME_750K_TO_1M", "INCOME_ABOVE_1M"]); export const customerDueDiligenceTransferValueRange = z.enum(["TRANSFER_VALUE_0_TO_25K", "TRANSFER_VALUE_25K_TO_50K", "TRANSFER_VALUE_50K_TO_100K", "TRANSFER_VALUE_100K_TO_250K", "TRANSFER_VALUE_250K_TO_500K", "TRANSFER_VALUE_500K_TO_750K", "TRANSFER_VALUE_750K_TO_1M", "TRANSFER_VALUE_1M_TO_2_5M", "TRANSFER_VALUE_2_5M_TO_5M", "TRANSFER_VALUE_ABOVE_5M"]); export const wealthSource = z.enum(["INHERITANCE", "INVESTMENT_GAINS", "BUSINESS_OWNERSHIP_DIVIDENDS", "EMPLOYMENT_INCOME", "REAL_ESTATE", "OTHER_SOURCE_OF_WEALTH"]); export const fundsSource = z.enum(["SALARY_DISBURSEMENT", "INHERITANCE_DISTRIBUTION", "INVESTMENT_RETURNS", "BUSINESS_DIVIDENDS_PROFITS", "PROPERTY_SALE", "LOAN_DISBURSEMENT", "SAVINGS_ACCOUNT_WITHDRAWAL", "GOVERNMENT_BENEFITS"]); export const accountPurpose = z.enum(["INVESTMENT_TRADING", "SAVINGS", "STABLECOIN_PURCHASE_REDEMPTION"]); export const employmentStatus = z.enum(["CONTRACTUAL", "FULL_TIME", "PART_TIME", "RETIRED", "SELF_EMPLOYED", "STUDENT", "UNEMPLOYED"]); export const merchantFundingSourceFundingSource = z.enum(["BUSINESS_LOANS_FINANCING", "SALARY_SAVINGS", "INVESTMENT_GAINS", "INHERITANCE", "REAL_ESTATE_INCOME", "NON_PROFIT_SOURCES", "OTHER_BUSINESS_INCOME"]); export const customerRegion = z.enum(["US_CANADA", "MEXICO_CENTRAL_AMERICA", "SOUTH_AMERICA", "EUROPE", "ASIA", "AFRICA", "OCEANIA"]); export const customerDueDiligence = z.object({aliases: z.array(z.string()).optional(), estimated_net_worth: customerDueDiligenceNetWorthRange.optional(), estimated_yearly_income: customerDueDiligenceYearlyIncomeRange.optional(), expected_transfer_value: customerDueDiligenceTransferValueRange.optional(), source_of_wealth: wealthSource.optional(), source_of_funds: fundsSource.optional(), purpose_of_account: accountPurpose.optional(), employment_status: employmentStatus.optional(), employment_industry_sector: institutionSubType.optional(), industry_sector: institutionSubType.optional(), has_underlying_trust_structure: z.boolean().optional(), has_nominee_shareholders: z.boolean().optional(), created_at: z.string().optional(), is_publicly_traded: z.boolean().optional(), merchant_funding_source: merchantFundingSourceFundingSource.optional(), customer_regions: z.array(customerRegion).optional()}); export const identity = z.object({id: z.string(), metadata: z.record(z.string(), z.string()).optional(), status: identityStatus.optional(), status_details: identityStatusDetails.optional(), summary_status: identityStatus.optional(), user_disabled: z.boolean().optional(), admin_disabled: z.boolean().optional(), person_details: personDetails.optional(), type: identityType.optional(), ref_id: z.string().optional(), institution_details: institutionDetails.optional(), institution_members: z.array(institutionMember).optional(), created_at: z.string().optional(), updated_at: z.string().optional(), tax_details: z.array(taxDetail).optional(), tax_details_not_required: z.boolean().optional(), summary_tin_verification_status: tINVerificationStatus.optional(), customer_due_diligence: customerDueDiligence.optional(), is_merchant: z.boolean().optional(), last_kyc_refresh_date: z.string().optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Update Identity * * PUT /identity/identities/{id} */ export const updateApiIdentityIdentitiesId = async (args: UpdateApiIdentityIdentitiesIdArgs, options?: UpdateApiIdentityIdentitiesIdOptions) => { const {baseUrl = "https://api.paxos.com/v2", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/identity/identities/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(identity, await res.json()) };