export type CreateApiV2AccountsAccountIdArchiveArgs = {account_id: string}; export type CreateApiV2AccountsAccountIdArchiveOptions = {baseUrl: string, LedgerUpApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Archive an account. * * POST /v2/accounts/{account_id}/archive */ export const createApiV2AccountsAccountIdArchive = async (args: CreateApiV2AccountsAccountIdArchiveArgs, options: CreateApiV2AccountsAccountIdArchiveOptions) => { const {baseUrl, fetch: fetchFn = fetch, LedgerUpApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (LedgerUpApiKey !== undefined) headers.set("x-api-key", LedgerUpApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v2/accounts/${encodeURIComponent(String(args.account_id))}/archive${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 };