export type DeleteApiV2UserArgs = {email?: string | undefined}; export type DeleteApiV2UserOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * https://api.nordicgamelab.org/v2/user?email={{email}} * * DELETE /v2/user */ export const deleteApiV2User = async (args: DeleteApiV2UserArgs, options?: DeleteApiV2UserOptions) => { const {baseUrl = "https://api.nordicgamelab.org", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args.email != null) query.append("email", String(args.email)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/user${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 res.text() };