export type AccountAddress = {zip?: string | undefined, country?: string | undefined, address3?: string | undefined, address2?: string | undefined, city?: string | undefined, sourceType?: string | undefined, address1?: string | undefined, street?: string | undefined, state?: string | undefined, type?: ('HOME' | 'BUSINESS' | 'POBOX' | 'RETAIL' | 'OFFICE' | 'SMALL_BUSINESS' | 'COMMUNICATION' | 'PERMANENT' | 'STATEMENT_ADDRESS' | 'PAYMENT' | 'PAYOFF' | 'UNKNOWN') | undefined}; export type Money = {amount: number, currency: 'AUD' | 'BRL' | 'CAD' | 'EUR' | 'GBP' | 'HKD' | 'IDR' | 'INR' | 'JPY' | 'NZD' | 'SGD' | 'USD' | 'ZAR' | 'CNY' | 'VND' | 'MYR' | 'CHF'}; export type UpdateAccountInfo = {container?: ('bank' | 'creditCard' | 'investment' | 'insurance' | 'loan' | 'reward' | 'realEstate' | 'otherAssets' | 'otherLiabilities') | undefined, includeInNetWorth?: string | undefined, address?: AccountAddress | undefined, accountName?: string | undefined, dueDate?: string | undefined, memo?: string | undefined, homeValue?: Money | undefined, accountNumber?: string | undefined, frequency?: ('DAILY' | 'ONE_TIME' | 'WEEKLY' | 'EVERY_2_WEEKS' | 'SEMI_MONTHLY' | 'MONTHLY' | 'QUARTERLY' | 'SEMI_ANNUALLY' | 'ANNUALLY' | 'EVERY_2_MONTHS' | 'EBILL' | 'FIRST_DAY_MONTHLY' | 'LAST_DAY_MONTHLY' | 'EVERY_4_WEEKS' | 'UNKNOWN' | 'OTHER') | undefined, accountStatus?: ('ACTIVE' | 'INACTIVE' | 'TO_BE_CLOSED' | 'CLOSED' | 'DELETED') | undefined, amountDue?: Money | undefined, balance?: Money | undefined, isEbillEnrolled?: string | undefined, nickname?: string | undefined}; export type UpdateAccountRequest = {account: UpdateAccountInfo}; export type UpdateApiAccountsAccountIdArgs = {accountId: number, body: UpdateAccountRequest}; export type UpdateApiAccountsAccountIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update Account * * PUT /accounts/{accountId} */ export const updateApiAccountsAccountId = async (args: UpdateApiAccountsAccountIdArgs, options: UpdateApiAccountsAccountIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/accounts/${encodeURIComponent(String(args.accountId))}${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 undefined };