export type DeleteApiV1AuthArgs = {key: string}; export type DeleteApiV1AuthOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete existing auth token * * DELETE /v1/auth */ export const deleteApiV1Auth = async (args: DeleteApiV1AuthArgs, options?: DeleteApiV1AuthOptions) => { const {baseUrl = "https://backend.swap.coffee", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.key != null) query.append("key", String(args.key)) if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/auth${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 };