export type DeleteApiApiV1IndexIndexIdArgs = {apikey: string, index_id: number}; export type DeleteApiApiV1IndexIndexIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Index * * DELETE /api/v1/index/{index_id} */ export const deleteApiApiV1IndexIndexId = async (args: DeleteApiApiV1IndexIndexIdArgs, options?: DeleteApiApiV1IndexIndexIdOptions) => { 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/index/${encodeURIComponent(String(args.index_id))}${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() };