export type DeleteApiApiV2AccountsAccountIdArgs = {accountId: string, eraseMemberData?: boolean | undefined}; export type DeleteApiApiV2AccountsAccountIdOptions = {baseUrl?: string | undefined, mms?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete an account * * DELETE /api/v2/accounts/{accountId} */ export const deleteApiApiV2AccountsAccountId = async (args: DeleteApiApiV2AccountsAccountIdArgs, options?: DeleteApiApiV2AccountsAccountIdOptions) => { const {baseUrl = "https://mms.api.ed.ts.egym.coffee", fetch: fetchFn = fetch, mms} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.eraseMemberData != null) query.append("eraseMemberData", String(args.eraseMemberData)) if (mms !== undefined) headers.set("x-api-key", mms) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/accounts/${encodeURIComponent(String(args.accountId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };