export type CreateApiV1LibrariesLibraryIdDocumentsDocumentIdReprocessArgs = {library_id: string, document_id: string}; export type CreateApiV1LibrariesLibraryIdDocumentsDocumentIdReprocessOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reprocess a document. * * POST /v1/libraries/{library_id}/documents/{document_id}/reprocess */ export const createApiV1LibrariesLibraryIdDocumentsDocumentIdReprocess = async (args: CreateApiV1LibrariesLibraryIdDocumentsDocumentIdReprocessArgs, options?: CreateApiV1LibrariesLibraryIdDocumentsDocumentIdReprocessOptions) => { const {baseUrl = "https://api.mistral.ai", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKey !== undefined) headers.set('authorization', `Bearer ${ApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/libraries/${encodeURIComponent(String(args.library_id))}/documents/${encodeURIComponent(String(args.document_id))}/reprocess${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 };