import {z} from 'zod' export type CountryCodeAlpha2 = 'AW' | 'AF' | 'AO' | 'AI' | 'AX' | 'AL' | 'AD' | 'AE' | 'AR' | 'AM' | 'AS' | 'AQ' | 'TF' | 'AG' | 'AU' | 'AT' | 'AZ' | 'BI' | 'BE' | 'BJ' | 'BQ' | 'BF' | 'BD' | 'BG' | 'BH' | 'BS' | 'BA' | 'BL' | 'BY' | 'BZ' | 'BM' | 'BO' | 'BR' | 'BB' | 'BN' | 'BT' | 'BV' | 'BW' | 'CF' | 'CA' | 'CC' | 'CH' | 'CL' | 'CN' | 'CI' | 'CM' | 'CD' | 'CG' | 'CK' | 'CO' | 'KM' | 'CV' | 'CR' | 'CU' | 'CW' | 'CX' | 'KY' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DM' | 'DK' | 'DO' | 'DZ' | 'EC' | 'EG' | 'ER' | 'EH' | 'ES' | 'EE' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FR' | 'FO' | 'FM' | 'GA' | 'GB' | 'GE' | 'GG' | 'GH' | 'GI' | 'GN' | 'GP' | 'GM' | 'GW' | 'GQ' | 'GR' | 'GD' | 'GL' | 'GT' | 'GF' | 'GU' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IM' | 'IN' | 'IO' | 'IE' | 'IR' | 'IQ' | 'IS' | 'IL' | 'IT' | 'JM' | 'JE' | 'JO' | 'JP' | 'KZ' | 'KE' | 'KG' | 'KH' | 'KI' | 'KN' | 'KR' | 'KW' | 'LA' | 'LB' | 'LR' | 'LY' | 'LC' | 'LI' | 'LK' | 'LS' | 'LT' | 'LU' | 'LV' | 'MO' | 'MF' | 'MA' | 'MC' | 'MD' | 'MG' | 'MV' | 'MX' | 'MH' | 'MK' | 'ML' | 'MT' | 'MM' | 'ME' | 'MN' | 'MP' | 'MZ' | 'MR' | 'MS' | 'MQ' | 'MU' | 'MW' | 'MY' | 'YT' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NU' | 'NL' | 'NO' | 'NP' | 'NR' | 'NZ' | 'OM' | 'PK' | 'PA' | 'PN' | 'PE' | 'PH' | 'PW' | 'PG' | 'PL' | 'PR' | 'KP' | 'PT' | 'PY' | 'PS' | 'PF' | 'QA' | 'RE' | 'RO' | 'RU' | 'RW' | 'SA' | 'SD' | 'SN' | 'SG' | 'GS' | 'SH' | 'SJ' | 'SB' | 'SL' | 'SV' | 'SM' | 'SO' | 'PM' | 'RS' | 'SS' | 'ST' | 'SR' | 'SK' | 'SI' | 'SE' | 'SZ' | 'SX' | 'SC' | 'SY' | 'TC' | 'TD' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TM' | 'TL' | 'TO' | 'TT' | 'TN' | 'TR' | 'TV' | 'TW' | 'TZ' | 'UG' | 'UA' | 'UM' | 'UY' | 'US' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'XK' | 'YE' | 'ZA' | 'ZM' | 'ZW'; export type MeowAddressRequest = {street_line_1: string, street_line_2?: (string | null) | undefined, city: string, state?: (string | null) | undefined, country: CountryCodeAlpha2, postal_code?: (string | null) | undefined}; export type TreasuryPrimeAccountType = 'checking' | 'savings'; export type MeowApiAddress = {street_line_1: string, street_line_2?: (string | null) | undefined, city: string, state?: (string | null) | undefined, country: CountryCodeAlpha2, postal_code: string}; export type MeowApiAchSubobject = {account_number: string, account_type: TreasuryPrimeAccountType, routing_number: string, address_on_account?: (MeowApiAddress | null) | undefined}; export type IntermediaryBank = {name: string, routing_number: string, address: MeowApiAddress}; export type MeowApiWireSubobject = {account_number: string, routing_number: string, address_on_account: MeowApiAddress, bank_address: MeowApiAddress, bank_name: string, intermediary_bank?: (IntermediaryBank | null) | undefined}; export type MeowApiCheckSubobject = {address: MeowApiAddress, created_time: string, updated_time: string}; export type MeowApiTchSubobject = {account_number: string, account_type: TreasuryPrimeAccountType, routing_number: string, address_on_account?: (MeowApiAddress | null) | undefined}; export type MeowApiFedNowSubobject = {account_number: string, account_type: TreasuryPrimeAccountType, routing_number: string, address_on_account?: (MeowApiAddress | null) | undefined}; export type MeowApiCrNowSubobject = {account_number: string, account_type: TreasuryPrimeAccountType, routing_number: string, address_on_account?: (MeowApiAddress | null) | undefined}; export type ExtConduitCounterpartyType = 'individual' | 'business'; export type ExtConduitCounterpartyIdentificationType = 'tin' | 'nit' | 'cc' | 'ce' | 'passport' | 'cpf' | 'cnpj' | 'rfc' | 'curp' | 'cuit' | 'cuil'; export type ConduitCounterpartyProfileRequest = {type: ExtConduitCounterpartyType, business_name?: (string | null) | undefined, first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, date_of_birth?: (string | null) | undefined, identification_type?: (ExtConduitCounterpartyIdentificationType | null) | undefined, identification_number?: (string | null) | undefined}; export type CounterpartyDetailsRequest = {ach?: (MeowApiAchSubobject | null) | undefined, wire?: (MeowApiWireSubobject | null) | undefined, check?: (MeowApiCheckSubobject | null) | undefined, tch?: (MeowApiTchSubobject | null) | undefined, fednow?: (MeowApiFedNowSubobject | null) | undefined, crnow?: (MeowApiCrNowSubobject | null) | undefined, name_on_account: string, nickname: string, plaid_processor_token?: (string | null) | undefined, email?: (string | null) | undefined, company_ids?: (Array | null) | undefined, conduit_counterparty_profile?: (ConduitCounterpartyProfileRequest | null) | undefined}; export type InternationalPaymentMethod = 'SWIFT' | 'LOCAL'; export type InternationalBeneficiaryType = 'individual' | 'company'; export type Iso4217Code = 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SLE' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VED' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWG' | 'ZWL'; export type AddressRequest = {street_line_1: string, street_line_2?: (string | null) | undefined, city: string, state?: (string | null) | undefined, country: CountryCodeAlpha2, postal_code?: (string | null) | undefined}; export type InternationalRoutingCodeType = 'SortCode' | 'ABA' | 'BSBCode' | 'InstitutionNo' | 'BankCode' | 'BranchCode' | 'Clabe' | 'Cnaps' | 'Ifsc'; export type CustomerApiInternationalDetailsRequest = {payment_method: InternationalPaymentMethod, beneficiary_type: InternationalBeneficiaryType, currency: Iso4217Code, first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, company_name?: (string | null) | undefined, date_of_birth?: (string | null) | undefined, address?: (AddressRequest | null) | undefined, bank_name?: (string | null) | undefined, bank_country?: (CountryCodeAlpha2 | null) | undefined, bank_address?: (string | null) | undefined, account_number?: (string | null) | undefined, iban?: (string | null) | undefined, bic_swift?: (string | null) | undefined, routing_code_type?: (InternationalRoutingCodeType | null) | undefined, routing_code_value?: (string | null) | undefined, routing_code_type_2?: (InternationalRoutingCodeType | null) | undefined, routing_code_value_2?: (string | null) | undefined, correspondent_bank_name?: (string | null) | undefined, correspondent_bank_bic_swift?: (string | null) | undefined}; export type ExtBridgePaymentRail = 'arbitrum' | 'avalanche_c_chain' | 'base' | 'ethereum' | 'optimism' | 'polygon' | 'solana' | 'stellar' | 'sui' | 'tempo' | 'tron' | 'xdc' | 'ach' | 'ach_push' | 'ach_same_day' | 'fednow' | 'wire' | 'swift' | 'sepa' | 'faster_payments' | 'spei' | 'bridge_transfer'; export type ExtBridgeCryptocurrency = 'usdb' | 'usdc' | 'usdt' | 'dai' | 'pyusd' | 'cash' | 'usdg' | 'usdv' | 'eurc' | 'usd' | 'eur' | 'gbp' | 'mxn' | 'path_usd' | 'ousd'; export type CryptoAddressRequest = {address: string, payment_rail: ExtBridgePaymentRail, currency: ExtBridgeCryptocurrency}; export type UpdateContactRequest = {nickname?: (string | null) | undefined, email?: (string | null) | undefined, address?: (MeowAddressRequest | null) | undefined, counterparty?: (CounterpartyDetailsRequest | null) | undefined, international?: (CustomerApiInternationalDetailsRequest | null) | undefined, crypto_addresses?: (Array | null) | undefined}; export type PatchApiContactsContactIdArgs = {contact_id: string, 'x-entity-id'?: string | undefined, body: UpdateContactRequest}; export type PatchApiContactsContactIdOptions = {baseUrl?: string | undefined, apiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; export const countryCodeAlpha2 = z.enum(["AW", "AF", "AO", "AI", "AX", "AL", "AD", "AE", "AR", "AM", "AS", "AQ", "TF", "AG", "AU", "AT", "AZ", "BI", "BE", "BJ", "BQ", "BF", "BD", "BG", "BH", "BS", "BA", "BL", "BY", "BZ", "BM", "BO", "BR", "BB", "BN", "BT", "BV", "BW", "CF", "CA", "CC", "CH", "CL", "CN", "CI", "CM", "CD", "CG", "CK", "CO", "KM", "CV", "CR", "CU", "CW", "CX", "KY", "CY", "CZ", "DE", "DJ", "DM", "DK", "DO", "DZ", "EC", "EG", "ER", "EH", "ES", "EE", "ET", "FI", "FJ", "FK", "FR", "FO", "FM", "GA", "GB", "GE", "GG", "GH", "GI", "GN", "GP", "GM", "GW", "GQ", "GR", "GD", "GL", "GT", "GF", "GU", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IM", "IN", "IO", "IE", "IR", "IQ", "IS", "IL", "IT", "JM", "JE", "JO", "JP", "KZ", "KE", "KG", "KH", "KI", "KN", "KR", "KW", "LA", "LB", "LR", "LY", "LC", "LI", "LK", "LS", "LT", "LU", "LV", "MO", "MF", "MA", "MC", "MD", "MG", "MV", "MX", "MH", "MK", "ML", "MT", "MM", "ME", "MN", "MP", "MZ", "MR", "MS", "MQ", "MU", "MW", "MY", "YT", "NA", "NC", "NE", "NF", "NG", "NI", "NU", "NL", "NO", "NP", "NR", "NZ", "OM", "PK", "PA", "PN", "PE", "PH", "PW", "PG", "PL", "PR", "KP", "PT", "PY", "PS", "PF", "QA", "RE", "RO", "RU", "RW", "SA", "SD", "SN", "SG", "GS", "SH", "SJ", "SB", "SL", "SV", "SM", "SO", "PM", "RS", "SS", "ST", "SR", "SK", "SI", "SE", "SZ", "SX", "SC", "SY", "TC", "TD", "TG", "TH", "TJ", "TK", "TM", "TL", "TO", "TT", "TN", "TR", "TV", "TW", "TZ", "UG", "UA", "UM", "UY", "US", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "XK", "YE", "ZA", "ZM", "ZW"]); export const addressResponse = z.object({street_line_1: z.string().nullable().optional(), street_line_2: z.string().nullable().optional(), city: z.string().nullable().optional(), state: z.string().nullable().optional(), country: countryCodeAlpha2.nullable().optional(), postal_code: z.string().nullable().optional()}); export const treasuryPrimeAccountType = z.enum(["checking", "savings"]); export const meowApiAddress = z.object({street_line_1: z.string().min(1).max(300), street_line_2: z.string().max(300).nullable().optional(), city: z.string().max(21), state: z.string().max(3).nullable().optional(), country: countryCodeAlpha2, postal_code: z.string().min(1).max(20)}); export const customerApiAchPaymentMethod = z.object({counterparty_id: z.string(), name_on_account: z.string(), nickname: z.string(), account_type: treasuryPrimeAccountType, account_number: z.string(), routing_number: z.string(), address_on_account: meowApiAddress.nullable().optional()}); export const customerApiWireIntermediaryBank = z.object({name: z.string(), routing_number: z.string(), address: meowApiAddress}); export const customerApiWirePaymentMethod = z.object({counterparty_id: z.string(), name_on_account: z.string(), nickname: z.string(), bank_name: z.string(), account_number: z.string(), routing_number: z.string(), beneficiary_address: meowApiAddress, bank_address: meowApiAddress, intermediary_bank: customerApiWireIntermediaryBank.nullable().optional()}); export const customerApiCheckPaymentMethod = z.object({counterparty_id: z.string(), name_on_account: z.string(), nickname: z.string(), mailing_address: meowApiAddress}); export const iso4217Code = z.enum(["AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRU", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SLE", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STN", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "UYI", "UYU", "UYW", "UZS", "VED", "VES", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XSU", "XTS", "XUA", "XXX", "YER", "ZAR", "ZMW", "ZWG", "ZWL"]); export const internationalPaymentMethod = z.enum(["SWIFT", "LOCAL"]); export const internationalBeneficiaryType = z.enum(["individual", "company"]); export const internationalRoutingCodeType = z.enum(["SortCode", "ABA", "BSBCode", "InstitutionNo", "BankCode", "BranchCode", "Clabe", "Cnaps", "Ifsc"]); export const customerApiInternationalPaymentMethod = z.object({beneficiary_id: z.string().nullable().optional(), international_beneficiary_id: z.string().nullable().optional(), preferred_currency: iso4217Code.nullable().optional(), payment_methods: z.array(internationalPaymentMethod).optional(), beneficiary_type: internationalBeneficiaryType.nullable().optional(), first_name: z.string().nullable().optional(), last_name: z.string().nullable().optional(), company_name: z.string().nullable().optional(), date_of_birth: z.string().nullable().optional(), address: addressResponse.nullable().optional(), currency: iso4217Code.nullable().optional(), account_number: z.string().nullable().optional(), iban: z.string().nullable().optional(), bic_swift: z.string().nullable().optional(), bank_name: z.string().nullable().optional(), bank_country: countryCodeAlpha2.nullable().optional(), bank_address: z.string().nullable().optional(), routing_code_type: internationalRoutingCodeType.nullable().optional(), routing_code_value: z.string().nullable().optional(), routing_code_type_2: internationalRoutingCodeType.nullable().optional(), routing_code_value_2: z.string().nullable().optional(), correspondent_bank_name: z.string().nullable().optional(), correspondent_bank_bic_swift: z.string().nullable().optional()}); export const extBridgePaymentRail = z.enum(["arbitrum", "avalanche_c_chain", "base", "ethereum", "optimism", "polygon", "solana", "stellar", "sui", "tempo", "tron", "xdc", "ach", "ach_push", "ach_same_day", "fednow", "wire", "swift", "sepa", "faster_payments", "spei", "bridge_transfer"]); export const extBridgeCryptocurrency = z.enum(["usdb", "usdc", "usdt", "dai", "pyusd", "cash", "usdg", "usdv", "eurc", "usd", "eur", "gbp", "mxn", "path_usd", "ousd"]); export const cryptoCurrency = z.enum(["usdc", "usdt", "pyusd", "cash", "usdg", "usdv", "eurc", "eth", "sol", "btc", "xrp", "path_usd", "ousd"]); export const cryptoNetwork = z.enum(["ethereum", "base", "solana", "arbitrum", "polygon", "optimism", "tron", "stellar", "avalanche_c_chain", "binance", "sui", "tempo", "xdc", "bitcoin", "ripple"]); export const cryptoContactDestinationResponse = z.object({id: z.string(), destination_address: z.string(), destination_payment_rail: extBridgePaymentRail.nullable().optional(), destination_currency: extBridgeCryptocurrency.nullable().optional(), currency: cryptoCurrency.nullable().optional(), network: cryptoNetwork.nullable().optional(), destination_tag: z.string().nullable().optional()}); export const bridgeStaticMemoResponse = z.object({id: z.string(), destination_address: z.string(), destination_payment_rail: extBridgePaymentRail, destination_payment_currency: extBridgeCryptocurrency}); export const customerApiPaymentMethods = z.object({ach: customerApiAchPaymentMethod.nullable().optional(), wire: customerApiWirePaymentMethod.nullable().optional(), check: customerApiCheckPaymentMethod.nullable().optional(), international: customerApiInternationalPaymentMethod.nullable().optional(), crypto: z.array(cryptoContactDestinationResponse).optional(), static_memos: z.array(bridgeStaticMemoResponse).optional()}); export const customerApiPaymentMethodType = z.enum(["ach", "wire", "check", "international", "crypto", "static_memo"]); export const extAwxPaymentReason = z.enum(["audio_visual_services", "bill_payment", "business_expenses", "construction", "donation_charitable_contribution", "education_training", "family_support", "freight", "goods_purchased", "investment_capital", "investment_proceeds", "living_expenses", "loan_credit_repayment", "medical_services", "pension", "personal_remittance", "professional_business_services", "real_estate", "taxes", "technical_services", "transfer_to_own_account", "travel", "wages_salary", "other_services"]); export const customerApiContact = z.object({id: z.string(), nickname: z.string().min(1).max(400), email: z.string().nullable().optional(), address: addressResponse.nullable().optional(), payment_methods: customerApiPaymentMethods, supported_payment_methods: z.array(customerApiPaymentMethodType), last_payment_reason: extAwxPaymentReason.nullable().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 Contact * * PATCH /contacts/{contact_id} */ export const patchApiContactsContactId = async (args: PatchApiContactsContactIdArgs, options?: PatchApiContactsContactIdOptions) => { const {baseUrl = "https://api.meow.com/v1", fetch: fetchFn = fetch, apiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['x-entity-id'] != null) headers.set("x-entity-id", String(args['x-entity-id'])) if (apiKeyAuth !== undefined) headers.set("x-api-key", apiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/contacts/${encodeURIComponent(String(args.contact_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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(customerApiContact, await res.json()) };