export type DeleteApiApiV1EsindexIndexNameArgs = {indexName: string}; export type DeleteApiApiV1EsindexIndexNameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * DELETE /api/v1/esindex/{indexName} */ export const deleteApiApiV1EsindexIndexName = async (args: DeleteApiApiV1EsindexIndexNameArgs, options: DeleteApiApiV1EsindexIndexNameOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/esindex/${encodeURIComponent(String(args.indexName))}${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 };