export type CreateApiV1AccountsAccountIdVirtualIbanCloseArgs = {accountId: number, iban: string}; export type CreateApiV1AccountsAccountIdVirtualIbanCloseOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Close Virtual Account * * POST /v1/accounts/{accountId}/virtual/{iban}/close */ export const createApiV1AccountsAccountIdVirtualIbanClose = async (args: CreateApiV1AccountsAccountIdVirtualIbanCloseArgs, options?: CreateApiV1AccountsAccountIdVirtualIbanCloseOptions) => { const {baseUrl = "https://api.bcb.group", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/accounts/${encodeURIComponent(String(args.accountId))}/virtual/${encodeURIComponent(String(args.iban))}/close${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };