export type DeleteApiApiV1EsindexReindexArgs = {switch?: boolean | undefined}; export type DeleteApiApiV1EsindexReindexOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * DELETE /api/v1/esindex/reindex */ export const deleteApiApiV1EsindexReindex = async (args: DeleteApiApiV1EsindexReindexArgs, options: DeleteApiApiV1EsindexReindexOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.switch != null) query.append("switch", String(args.switch)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/esindex/reindex${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 (await res.json()) as unknown };