export type CreateApiV1CollectionsCollectionIdReindexContentsArgs = {'App-ID': string, 'Auth-Token': string, collection_id: string, low_priority_indexing?: boolean | undefined}; export type CreateApiV1CollectionsCollectionIdReindexContentsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Reindex collection and its content * * POST /v1/collections/{collection_id}/reindex/contents/ */ export const createApiV1CollectionsCollectionIdReindexContents = async (args: CreateApiV1CollectionsCollectionIdReindexContentsArgs, options: CreateApiV1CollectionsCollectionIdReindexContentsOptions) => { 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'])) if (args.low_priority_indexing != null) query.append("low_priority_indexing", String(args.low_priority_indexing)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/collections/${encodeURIComponent(String(args.collection_id))}/reindex/contents/${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 };