export type CreateApiV1StoragesReindexArgs = {'App-ID': string, 'Auth-Token': string}; export type CreateApiV1StoragesReindexOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Trigger reindexing of all storages * * POST /v1/storages/reindex/ */ export const createApiV1StoragesReindex = async (args: CreateApiV1StoragesReindexArgs, options: CreateApiV1StoragesReindexOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['App-ID'] != null) headers.set("App-ID", String(args['App-ID'])) if (args['Auth-Token'] != null) headers.set("Auth-Token", String(args['Auth-Token'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/storages/reindex/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };