export type PatchAccountRequest = {account_name?: unknown | undefined, external_id?: unknown | undefined}; export type PatchApiV1AccountsAccountIdArgs = {account_id: string, body: PatchAccountRequest}; export type PatchApiV1AccountsAccountIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update account data * * PATCH /v1/accounts/{account_id} */ export const patchApiV1AccountsAccountId = async (args: PatchApiV1AccountsAccountIdArgs, options?: PatchApiV1AccountsAccountIdOptions) => { const {baseUrl = "https://auth-sandbox.fuse.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/accounts/${encodeURIComponent(String(args.account_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 undefined };