export type BankAccount = {currency: string, data?: string | undefined, iban?: string | undefined, id?: string | undefined, name: string, type: 'iban' | 'custom'}; export type PatchApiBankAccountsBankAccountIdArgs = {body: {bankAccount: BankAccount} | BankAccount}; export type PatchApiBankAccountsBankAccountIdOptions = {baseUrl: string, ApiKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update an invoice payment account * * PATCH /bank-accounts/{bankAccountId} * * Also accepts auth: FirebaseIdToken */ export const patchApiBankAccountsBankAccountId = async (args: PatchApiBankAccountsBankAccountIdArgs, options: PatchApiBankAccountsBankAccountIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyHeader !== undefined) headers.set("X-API-Key", ApiKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/bank-accounts/${encodeURIComponent(String(args.bankAccountId))}${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 undefined };