/* tslint:disable */ /* eslint-disable */ /** * openfilz-api * API for Document Management System * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction, replaceWithSerializableTypeIfNeeded } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; // @ts-ignore import type { DocumentInsightView } from '../models'; // @ts-ignore import type { InsightBackfillRequest } from '../models'; // @ts-ignore import type { InsightBackfillStatus } from '../models'; // @ts-ignore import type { InsightCategoryUpdate } from '../models'; // @ts-ignore import type { InsightFacets } from '../models'; /** * DocumentInsightsApi - axios parameter creator */ export const DocumentInsightsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Queues every FILE without a tier-2 insight (or with an older prompt version when force), optionally under one folder, and returns the job at once. Poll GET /backfill/{jobId}. * @summary Enrich existing documents * @param {InsightBackfillRequest} [insightBackfillRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ backfill: async (insightBackfillRequest?: InsightBackfillRequest, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/ai/insights/backfill`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication keycloak_auth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; localVarHeaderParameter['Accept'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(insightBackfillRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Progress of a backfill job * @param {string} jobId * @param {*} [options] Override http request option. * @throws {RequiredError} */ backfillStatus: async (jobId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'jobId' is not null or undefined assertParamExists('backfillStatus', 'jobId', jobId) const localVarPath = `/api/v1/ai/insights/backfill/{jobId}` .replace('{jobId}', encodeURIComponent(String(jobId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication keycloak_auth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) localVarHeaderParameter['Accept'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * How many active files carry each tier-2 category and each detected language, from the document insights (largest first). The keys are what searchDocuments accepts in its \'category\' / \'language\' filters. 404 when the AI features are off (openfilz.ai.active); READER. * @summary The category and language facets of the library * @param {*} [options] Override http request option. * @throws {RequiredError} */ facets: async (options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/ai/insights/facets`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication keycloak_auth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) localVarHeaderParameter['Accept'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Tier 1: the file\'s own metadata (title, author, dates, page count, language) captured at upload. Tier 2: the AI-derived category, summary, keywords and entities when openfilz.ai.insights.active is on. 404 when the document is not visible or has no insights yet. * @summary Get the insights of a document * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getInsights: async (documentId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('getInsights', 'documentId', documentId) const localVarPath = `/api/v1/documents/{documentId}/insights` .replace('{documentId}', encodeURIComponent(String(documentId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication keycloak_auth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) localVarHeaderParameter['Accept'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Sets the tier-2 category to one of the deployment\'s kinds (the category taxonomy: openfilz.ai.insights.categories, or \'other\'), recorded as written by the user: it is never overwritten by a non-forced backfill, it teaches the learned classifier, and the by-kind reorganisation and smart filing use it like a model\'s label. 400 for a kind the deployment does not know; 403 without modify access. * @summary Correct the kind of a document * @param {string} documentId * @param {InsightCategoryUpdate} insightCategoryUpdate * @param {*} [options] Override http request option. * @throws {RequiredError} */ setCategory: async (documentId: string, insightCategoryUpdate: InsightCategoryUpdate, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('setCategory', 'documentId', documentId) // verify required parameter 'insightCategoryUpdate' is not null or undefined assertParamExists('setCategory', 'insightCategoryUpdate', insightCategoryUpdate) const localVarPath = `/api/v1/documents/{documentId}/insights` .replace('{documentId}', encodeURIComponent(String(documentId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication keycloak_auth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; localVarHeaderParameter['Accept'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(insightCategoryUpdate, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * DocumentInsightsApi - functional programming interface */ export const DocumentInsightsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = DocumentInsightsApiAxiosParamCreator(configuration) return { /** * Queues every FILE without a tier-2 insight (or with an older prompt version when force), optionally under one folder, and returns the job at once. Poll GET /backfill/{jobId}. * @summary Enrich existing documents * @param {InsightBackfillRequest} [insightBackfillRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async backfill(insightBackfillRequest?: InsightBackfillRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.backfill(insightBackfillRequest, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentInsightsApi.backfill']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Progress of a backfill job * @param {string} jobId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async backfillStatus(jobId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.backfillStatus(jobId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentInsightsApi.backfillStatus']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * How many active files carry each tier-2 category and each detected language, from the document insights (largest first). The keys are what searchDocuments accepts in its \'category\' / \'language\' filters. 404 when the AI features are off (openfilz.ai.active); READER. * @summary The category and language facets of the library * @param {*} [options] Override http request option. * @throws {RequiredError} */ async facets(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.facets(options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentInsightsApi.facets']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Tier 1: the file\'s own metadata (title, author, dates, page count, language) captured at upload. Tier 2: the AI-derived category, summary, keywords and entities when openfilz.ai.insights.active is on. 404 when the document is not visible or has no insights yet. * @summary Get the insights of a document * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getInsights(documentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getInsights(documentId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentInsightsApi.getInsights']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Sets the tier-2 category to one of the deployment\'s kinds (the category taxonomy: openfilz.ai.insights.categories, or \'other\'), recorded as written by the user: it is never overwritten by a non-forced backfill, it teaches the learned classifier, and the by-kind reorganisation and smart filing use it like a model\'s label. 400 for a kind the deployment does not know; 403 without modify access. * @summary Correct the kind of a document * @param {string} documentId * @param {InsightCategoryUpdate} insightCategoryUpdate * @param {*} [options] Override http request option. * @throws {RequiredError} */ async setCategory(documentId: string, insightCategoryUpdate: InsightCategoryUpdate, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.setCategory(documentId, insightCategoryUpdate, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentInsightsApi.setCategory']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * DocumentInsightsApi - factory interface */ export const DocumentInsightsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = DocumentInsightsApiFp(configuration) return { /** * Queues every FILE without a tier-2 insight (or with an older prompt version when force), optionally under one folder, and returns the job at once. Poll GET /backfill/{jobId}. * @summary Enrich existing documents * @param {InsightBackfillRequest} [insightBackfillRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ backfill(insightBackfillRequest?: InsightBackfillRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.backfill(insightBackfillRequest, options).then((request) => request(axios, basePath)); }, /** * * @summary Progress of a backfill job * @param {string} jobId * @param {*} [options] Override http request option. * @throws {RequiredError} */ backfillStatus(jobId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.backfillStatus(jobId, options).then((request) => request(axios, basePath)); }, /** * How many active files carry each tier-2 category and each detected language, from the document insights (largest first). The keys are what searchDocuments accepts in its \'category\' / \'language\' filters. 404 when the AI features are off (openfilz.ai.active); READER. * @summary The category and language facets of the library * @param {*} [options] Override http request option. * @throws {RequiredError} */ facets(options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.facets(options).then((request) => request(axios, basePath)); }, /** * Tier 1: the file\'s own metadata (title, author, dates, page count, language) captured at upload. Tier 2: the AI-derived category, summary, keywords and entities when openfilz.ai.insights.active is on. 404 when the document is not visible or has no insights yet. * @summary Get the insights of a document * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getInsights(documentId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getInsights(documentId, options).then((request) => request(axios, basePath)); }, /** * Sets the tier-2 category to one of the deployment\'s kinds (the category taxonomy: openfilz.ai.insights.categories, or \'other\'), recorded as written by the user: it is never overwritten by a non-forced backfill, it teaches the learned classifier, and the by-kind reorganisation and smart filing use it like a model\'s label. 400 for a kind the deployment does not know; 403 without modify access. * @summary Correct the kind of a document * @param {string} documentId * @param {InsightCategoryUpdate} insightCategoryUpdate * @param {*} [options] Override http request option. * @throws {RequiredError} */ setCategory(documentId: string, insightCategoryUpdate: InsightCategoryUpdate, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.setCategory(documentId, insightCategoryUpdate, options).then((request) => request(axios, basePath)); }, }; }; /** * DocumentInsightsApi - object-oriented interface */ export class DocumentInsightsApi extends BaseAPI { /** * Queues every FILE without a tier-2 insight (or with an older prompt version when force), optionally under one folder, and returns the job at once. Poll GET /backfill/{jobId}. * @summary Enrich existing documents * @param {InsightBackfillRequest} [insightBackfillRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ public backfill(insightBackfillRequest?: InsightBackfillRequest, options?: RawAxiosRequestConfig) { return DocumentInsightsApiFp(this.configuration).backfill(insightBackfillRequest, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Progress of a backfill job * @param {string} jobId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public backfillStatus(jobId: string, options?: RawAxiosRequestConfig) { return DocumentInsightsApiFp(this.configuration).backfillStatus(jobId, options).then((request) => request(this.axios, this.basePath)); } /** * How many active files carry each tier-2 category and each detected language, from the document insights (largest first). The keys are what searchDocuments accepts in its \'category\' / \'language\' filters. 404 when the AI features are off (openfilz.ai.active); READER. * @summary The category and language facets of the library * @param {*} [options] Override http request option. * @throws {RequiredError} */ public facets(options?: RawAxiosRequestConfig) { return DocumentInsightsApiFp(this.configuration).facets(options).then((request) => request(this.axios, this.basePath)); } /** * Tier 1: the file\'s own metadata (title, author, dates, page count, language) captured at upload. Tier 2: the AI-derived category, summary, keywords and entities when openfilz.ai.insights.active is on. 404 when the document is not visible or has no insights yet. * @summary Get the insights of a document * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getInsights(documentId: string, options?: RawAxiosRequestConfig) { return DocumentInsightsApiFp(this.configuration).getInsights(documentId, options).then((request) => request(this.axios, this.basePath)); } /** * Sets the tier-2 category to one of the deployment\'s kinds (the category taxonomy: openfilz.ai.insights.categories, or \'other\'), recorded as written by the user: it is never overwritten by a non-forced backfill, it teaches the learned classifier, and the by-kind reorganisation and smart filing use it like a model\'s label. 400 for a kind the deployment does not know; 403 without modify access. * @summary Correct the kind of a document * @param {string} documentId * @param {InsightCategoryUpdate} insightCategoryUpdate * @param {*} [options] Override http request option. * @throws {RequiredError} */ public setCategory(documentId: string, insightCategoryUpdate: InsightCategoryUpdate, options?: RawAxiosRequestConfig) { return DocumentInsightsApiFp(this.configuration).setCategory(documentId, insightCategoryUpdate, options).then((request) => request(this.axios, this.basePath)); } }