export type DeleteApiApiV1ApikeyArgs = {apikey: string}; export type DeleteApiApiV1ApikeyOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete API Key * * DELETE /api/v1/apikey */ export const deleteApiApiV1Apikey = async (args: DeleteApiApiV1ApikeyArgs, options?: DeleteApiApiV1ApikeyOptions) => { const {baseUrl = "http://127.0.0.1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args.apikey != null) headers.set("apikey", String(args.apikey)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/apikey${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() };