/* 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 { AncestorInfo } from '../models'; // @ts-ignore import type { CreateBlankDocumentRequest } from '../models'; // @ts-ignore import type { DeleteMetadataRequest } from '../models'; // @ts-ignore import type { DocumentInfo } from '../models'; // @ts-ignore import type { DocumentIntegrityRecord } from '../models'; // @ts-ignore import type { DocumentPosition } from '../models'; // @ts-ignore import type { ElementInfo } from '../models'; // @ts-ignore import type { SearchByMetadataRequest } from '../models'; // @ts-ignore import type { SearchMetadataRequest } from '../models'; // @ts-ignore import type { UpdateMetadataRequest } from '../models'; // @ts-ignore import type { UploadResponse } from '../models'; /** * DocumentControllerApi - axios parameter creator */ export const DocumentControllerApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Creates a new blank document (Word, Excel, PowerPoint, or Text) from a template in the specified folder. * @summary Create a blank document from template * @param {CreateBlankDocumentRequest} createBlankDocumentRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ createBlankDocument: async (createBlankDocumentRequest: CreateBlankDocumentRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'createBlankDocumentRequest' is not null or undefined assertParamExists('createBlankDocument', 'createBlankDocumentRequest', createBlankDocumentRequest) const localVarPath = `/api/v1/documents/create-blank`; // 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'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(createBlankDocumentRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Deletes specified metadata keys from a document. * @summary Delete specific metadata keys * @param {string} documentId * @param {DeleteMetadataRequest} deleteMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteDocumentMetadata: async (documentId: string, deleteMetadataRequest: DeleteMetadataRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('deleteDocumentMetadata', 'documentId', documentId) // verify required parameter 'deleteMetadataRequest' is not null or undefined assertParamExists('deleteDocumentMetadata', 'deleteMetadataRequest', deleteMetadataRequest) const localVarPath = `/api/v1/documents/{documentId}/metadata` .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: 'DELETE', ...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'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(deleteMetadataRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Downloads a single file document. * @summary Download a document * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ downloadDocument: async (documentId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('downloadDocument', 'documentId', documentId) const localVarPath = `/api/v1/documents/{documentId}/download` .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'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Internal endpoint for OnlyOffice DocumentServer to fetch document content. Uses token-based authentication. * @summary Download document for OnlyOffice * @param {string} documentId * @param {string} token * @param {string} [versionId] * @param {*} [options] Override http request option. * @throws {RequiredError} */ downloadForOnlyOffice: async (documentId: string, token: string, versionId?: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('downloadForOnlyOffice', 'documentId', documentId) // verify required parameter 'token' is not null or undefined assertParamExists('downloadForOnlyOffice', 'token', token) const localVarPath = `/api/v1/documents/{documentId}/onlyoffice-download` .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) if (token !== undefined) { localVarQueryParameter['token'] = token; } if (versionId !== undefined) { localVarQueryParameter['versionId'] = versionId; } localVarHeaderParameter['Accept'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Downloads multiple documents as a single ZIP file. * @summary Download multiple documents as ZIP * @param {Array} requestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ downloadMultipleDocumentsAsZip: async (requestBody: Array, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'requestBody' is not null or undefined assertParamExists('downloadMultipleDocumentsAsZip', 'requestBody', requestBody) const localVarPath = `/api/v1/documents/download-multiple`; // 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'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Retrieves all ancestor folders (parent path) of a document, ordered from root to immediate parent. * @summary Get document ancestors * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDocumentAncestors: async (documentId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('getDocumentAncestors', 'documentId', documentId) const localVarPath = `/api/v1/documents/{documentId}/ancestors` .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'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Retrieves information for a document. * @summary Get information of a document * @param {string} documentId * @param {boolean} [withMetadata] if false : only name, type and parentId are sent (when not null) - if true : metadata and size are added in the response * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDocumentInfo: async (documentId: string, withMetadata?: boolean, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('getDocumentInfo', 'documentId', documentId) const localVarPath = `/api/v1/documents/{documentId}/info` .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) if (withMetadata !== undefined) { localVarQueryParameter['withMetadata'] = withMetadata; } localVarHeaderParameter['Accept'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Append-only history of what this document\'s content hashed to, newest first. Unlike the sha256 in metadata, these entries cannot be modified or deleted — a database trigger refuses UPDATE and DELETE on the table. Empty for documents uploaded before the ledger existed, or when openfilz.calculate-checksum is off. * @summary Get a document\'s integrity ledger * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDocumentIntegrity: async (documentId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('getDocumentIntegrity', 'documentId', documentId) const localVarPath = `/api/v1/documents/{documentId}/integrity` .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'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Retrieves metadata for a document. Can filter by keys. * @summary Search metadata of a document * @param {string} documentId * @param {SearchMetadataRequest} [searchMetadataRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDocumentMetadata: async (documentId: string, searchMetadataRequest?: SearchMetadataRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('getDocumentMetadata', 'documentId', documentId) const localVarPath = `/api/v1/documents/{documentId}/search/metadata` .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: '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'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(searchMetadataRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Retrieves the position of a document within its parent folder, useful for pagination. * @summary Get document position in folder * @param {string} documentId * @param {string} [sortBy] Field to sort by (name, updated_at, created_at, size, type). Defaults to \'name\'. * @param {string} [sortOrder] Sort order (ASC or DESC). Defaults to \'ASC\'. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDocumentPosition: async (documentId: string, sortBy?: string, sortOrder?: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('getDocumentPosition', 'documentId', documentId) const localVarPath = `/api/v1/documents/{documentId}/position` .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) if (sortBy !== undefined) { localVarQueryParameter['sortBy'] = sortBy; } if (sortOrder !== undefined) { localVarQueryParameter['sortOrder'] = sortOrder; } localVarHeaderParameter['Accept'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Replaces the content of an existing file document. * @summary Replace document content * @param {string} documentId * @param {File} file * @param {*} [options] Override http request option. * @throws {RequiredError} */ replaceDocumentContent: async (documentId: string, file: File, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('replaceDocumentContent', 'documentId', documentId) // verify required parameter 'file' is not null or undefined assertParamExists('replaceDocumentContent', 'file', file) const localVarPath = `/api/v1/documents/{documentId}/replace-content` .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: 'PUT', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); // authentication keycloak_auth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) if (file !== undefined) { localVarFormParams.append('file', file as any); } localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; localVarHeaderParameter['Accept'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Replaces all metadata of a document (file or folder). * @summary Replace document metadata * @param {string} documentId * @param {{ [key: string]: any; }} requestBody New metadata map. Replaces all existing metadata. * @param {*} [options] Override http request option. * @throws {RequiredError} */ replaceDocumentMetadata: async (documentId: string, requestBody: { [key: string]: any; }, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('replaceDocumentMetadata', 'documentId', documentId) // verify required parameter 'requestBody' is not null or undefined assertParamExists('replaceDocumentMetadata', 'requestBody', requestBody) const localVarPath = `/api/v1/documents/{documentId}/replace-metadata` .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: 'PUT', ...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'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Finds document IDs matching all provided metadata criteria. * @summary Search document IDs by metadata * @param {SearchByMetadataRequest} searchByMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ searchDocumentIdsByMetadata: async (searchByMetadataRequest: SearchByMetadataRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'searchByMetadataRequest' is not null or undefined assertParamExists('searchDocumentIdsByMetadata', 'searchByMetadataRequest', searchByMetadataRequest) const localVarPath = `/api/v1/documents/search/ids-by-metadata`; // 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'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(searchByMetadataRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Updates or adds specific metadata fields for a document. * @summary Update document metadata * @param {string} documentId * @param {UpdateMetadataRequest} updateMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateDocumentMetadata: async (documentId: string, updateMetadataRequest: UpdateMetadataRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('updateDocumentMetadata', 'documentId', documentId) // verify required parameter 'updateMetadataRequest' is not null or undefined assertParamExists('updateDocumentMetadata', 'updateMetadataRequest', updateMetadataRequest) const localVarPath = `/api/v1/documents/{documentId}/metadata` .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'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(updateMetadataRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Uploads multiple files, optionally with metadata and a parent folder ID. Returns HTTP 200 if all uploads succeed, HTTP 207 (Multi-Status) if some succeed and some fail, or an appropriate error status (404, 409, 403, 500) if all uploads fail. * @summary Upload multiple documents * @param {Array} file * @param {boolean} [allowDuplicateFileNames] When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. * @param {boolean} [autoFile] Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent = the user\'s own switch. Needs openfilz.ai.auto-file.active. * @param {string} [parametersByFilename] Paste the JSON array here<br>This array provides optional metadata and attributes for the uploaded files<br><section> <h3>Each object in the array must contain:</h3> <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>filename</code></td> <td><code>String</code></td> <td>Must match the filename of one of the uploaded files. Filenames must be unique in the upload request.</td> </tr> <tr> <td><code>fileAttributes</code></td> <td><code>JSON Object</code></td> <td>Container for metadata and other file-specific attributes.</td> </tr> </tbody> </table> <h4>Inside <code>fileAttributes</code>:</h4> <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>parentFolderId</code></td> <td><code>UUID</code></td> <td>UUID of the target folder to upload the file (if not provided : the file will be uploaded at the root level)</td> </tr> <tr> <td><code>metadata</code></td> <td><code>Map&lt;String, JSON Object&gt;</code></td> <td>Arbitrary metadata to associate with the file (key/value pairs).</td> </tr> </tbody> </table> <h4>Example of <code>parametersByFilename</code> JSON array :</h4> <pre><code>[ { \\\"filename\\\": \\\"file1.txt\\\", \\\"fileAttributes\\\": { \\\"parentFolderId\\\": \\\"f8c3de3d-1fea-4d7c-a8b0-29f63c4c3454\\\", \\\"metadata\\\": { \\\"country\\\": \\\"UK\\\", \\\"owner\\\": { \\\"name\\\": \\\"Joe\\\", \\\"owner_id\\\": 1234568 } } } }, { \\\"filename\\\": \\\"file2.md\\\", \\\"fileAttributes\\\": { \\\"metadata\\\": { \\\"key1\\\": \\\"value1\\\", \\\"key2\\\": \\\"value2\\\", \\\"key3\\\": \\\"value3\\\" } } } ]</code></pre> </section> * @param {*} [options] Override http request option. * @throws {RequiredError} */ uploadDocument: async (file: Array, allowDuplicateFileNames?: boolean, autoFile?: boolean, parametersByFilename?: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'file' is not null or undefined assertParamExists('uploadDocument', 'file', file) const localVarPath = `/api/v1/documents/upload-multiple`; // 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; const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); // authentication keycloak_auth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) if (allowDuplicateFileNames !== undefined) { localVarQueryParameter['allowDuplicateFileNames'] = allowDuplicateFileNames; } if (autoFile !== undefined) { localVarQueryParameter['autoFile'] = autoFile; } if (file) { file.forEach((element) => { localVarFormParams.append('file', element as any); }) } if (parametersByFilename !== undefined) { localVarFormParams.append('parametersByFilename', parametersByFilename as any); } localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; localVarHeaderParameter['Accept'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Uploads a single file, optionally with metadata and a parent folder ID. * @summary Upload a single document * @param {File} file * @param {boolean} [allowDuplicateFileNames] When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. * @param {boolean} [autoFile] Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent = the user\'s own switch. Needs openfilz.ai.auto-file.active. * @param {string} [parentFolderId] Target parent folder ID to store the file; if not sent or null, the file is stored at the root level * @param {string} [metadata] * @param {*} [options] Override http request option. * @throws {RequiredError} */ uploadDocument1: async (file: File, allowDuplicateFileNames?: boolean, autoFile?: boolean, parentFolderId?: string, metadata?: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'file' is not null or undefined assertParamExists('uploadDocument1', 'file', file) const localVarPath = `/api/v1/documents/upload`; // 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; const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); // authentication keycloak_auth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) if (allowDuplicateFileNames !== undefined) { localVarQueryParameter['allowDuplicateFileNames'] = allowDuplicateFileNames; } if (autoFile !== undefined) { localVarQueryParameter['autoFile'] = autoFile; } if (file !== undefined) { localVarFormParams.append('file', file as any); } if (parentFolderId !== undefined) { localVarFormParams.append('parentFolderId', parentFolderId as any); } if (metadata !== undefined) { localVarFormParams.append('metadata', metadata as any); } localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; localVarHeaderParameter['Accept'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * DocumentControllerApi - functional programming interface */ export const DocumentControllerApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = DocumentControllerApiAxiosParamCreator(configuration) return { /** * Creates a new blank document (Word, Excel, PowerPoint, or Text) from a template in the specified folder. * @summary Create a blank document from template * @param {CreateBlankDocumentRequest} createBlankDocumentRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createBlankDocument(createBlankDocumentRequest: CreateBlankDocumentRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createBlankDocument(createBlankDocumentRequest, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.createBlankDocument']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Deletes specified metadata keys from a document. * @summary Delete specific metadata keys * @param {string} documentId * @param {DeleteMetadataRequest} deleteMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async deleteDocumentMetadata(documentId: string, deleteMetadataRequest: DeleteMetadataRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteDocumentMetadata(documentId, deleteMetadataRequest, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.deleteDocumentMetadata']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Downloads a single file document. * @summary Download a document * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async downloadDocument(documentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.downloadDocument(documentId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.downloadDocument']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Internal endpoint for OnlyOffice DocumentServer to fetch document content. Uses token-based authentication. * @summary Download document for OnlyOffice * @param {string} documentId * @param {string} token * @param {string} [versionId] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async downloadForOnlyOffice(documentId: string, token: string, versionId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.downloadForOnlyOffice(documentId, token, versionId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.downloadForOnlyOffice']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Downloads multiple documents as a single ZIP file. * @summary Download multiple documents as ZIP * @param {Array} requestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ async downloadMultipleDocumentsAsZip(requestBody: Array, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.downloadMultipleDocumentsAsZip(requestBody, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.downloadMultipleDocumentsAsZip']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Retrieves all ancestor folders (parent path) of a document, ordered from root to immediate parent. * @summary Get document ancestors * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDocumentAncestors(documentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getDocumentAncestors(documentId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.getDocumentAncestors']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Retrieves information for a document. * @summary Get information of a document * @param {string} documentId * @param {boolean} [withMetadata] if false : only name, type and parentId are sent (when not null) - if true : metadata and size are added in the response * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDocumentInfo(documentId: string, withMetadata?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getDocumentInfo(documentId, withMetadata, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.getDocumentInfo']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Append-only history of what this document\'s content hashed to, newest first. Unlike the sha256 in metadata, these entries cannot be modified or deleted — a database trigger refuses UPDATE and DELETE on the table. Empty for documents uploaded before the ledger existed, or when openfilz.calculate-checksum is off. * @summary Get a document\'s integrity ledger * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDocumentIntegrity(documentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getDocumentIntegrity(documentId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.getDocumentIntegrity']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Retrieves metadata for a document. Can filter by keys. * @summary Search metadata of a document * @param {string} documentId * @param {SearchMetadataRequest} [searchMetadataRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDocumentMetadata(documentId: string, searchMetadataRequest?: SearchMetadataRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: any; }>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getDocumentMetadata(documentId, searchMetadataRequest, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.getDocumentMetadata']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Retrieves the position of a document within its parent folder, useful for pagination. * @summary Get document position in folder * @param {string} documentId * @param {string} [sortBy] Field to sort by (name, updated_at, created_at, size, type). Defaults to \'name\'. * @param {string} [sortOrder] Sort order (ASC or DESC). Defaults to \'ASC\'. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDocumentPosition(documentId: string, sortBy?: string, sortOrder?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getDocumentPosition(documentId, sortBy, sortOrder, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.getDocumentPosition']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Replaces the content of an existing file document. * @summary Replace document content * @param {string} documentId * @param {File} file * @param {*} [options] Override http request option. * @throws {RequiredError} */ async replaceDocumentContent(documentId: string, file: File, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.replaceDocumentContent(documentId, file, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.replaceDocumentContent']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Replaces all metadata of a document (file or folder). * @summary Replace document metadata * @param {string} documentId * @param {{ [key: string]: any; }} requestBody New metadata map. Replaces all existing metadata. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async replaceDocumentMetadata(documentId: string, requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.replaceDocumentMetadata(documentId, requestBody, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.replaceDocumentMetadata']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Finds document IDs matching all provided metadata criteria. * @summary Search document IDs by metadata * @param {SearchByMetadataRequest} searchByMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async searchDocumentIdsByMetadata(searchByMetadataRequest: SearchByMetadataRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.searchDocumentIdsByMetadata(searchByMetadataRequest, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.searchDocumentIdsByMetadata']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Updates or adds specific metadata fields for a document. * @summary Update document metadata * @param {string} documentId * @param {UpdateMetadataRequest} updateMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateDocumentMetadata(documentId: string, updateMetadataRequest: UpdateMetadataRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.updateDocumentMetadata(documentId, updateMetadataRequest, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.updateDocumentMetadata']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Uploads multiple files, optionally with metadata and a parent folder ID. Returns HTTP 200 if all uploads succeed, HTTP 207 (Multi-Status) if some succeed and some fail, or an appropriate error status (404, 409, 403, 500) if all uploads fail. * @summary Upload multiple documents * @param {Array} file * @param {boolean} [allowDuplicateFileNames] When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. * @param {boolean} [autoFile] Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent = the user\'s own switch. Needs openfilz.ai.auto-file.active. * @param {string} [parametersByFilename] Paste the JSON array here<br>This array provides optional metadata and attributes for the uploaded files<br><section> <h3>Each object in the array must contain:</h3> <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>filename</code></td> <td><code>String</code></td> <td>Must match the filename of one of the uploaded files. Filenames must be unique in the upload request.</td> </tr> <tr> <td><code>fileAttributes</code></td> <td><code>JSON Object</code></td> <td>Container for metadata and other file-specific attributes.</td> </tr> </tbody> </table> <h4>Inside <code>fileAttributes</code>:</h4> <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>parentFolderId</code></td> <td><code>UUID</code></td> <td>UUID of the target folder to upload the file (if not provided : the file will be uploaded at the root level)</td> </tr> <tr> <td><code>metadata</code></td> <td><code>Map&lt;String, JSON Object&gt;</code></td> <td>Arbitrary metadata to associate with the file (key/value pairs).</td> </tr> </tbody> </table> <h4>Example of <code>parametersByFilename</code> JSON array :</h4> <pre><code>[ { \\\"filename\\\": \\\"file1.txt\\\", \\\"fileAttributes\\\": { \\\"parentFolderId\\\": \\\"f8c3de3d-1fea-4d7c-a8b0-29f63c4c3454\\\", \\\"metadata\\\": { \\\"country\\\": \\\"UK\\\", \\\"owner\\\": { \\\"name\\\": \\\"Joe\\\", \\\"owner_id\\\": 1234568 } } } }, { \\\"filename\\\": \\\"file2.md\\\", \\\"fileAttributes\\\": { \\\"metadata\\\": { \\\"key1\\\": \\\"value1\\\", \\\"key2\\\": \\\"value2\\\", \\\"key3\\\": \\\"value3\\\" } } } ]</code></pre> </section> * @param {*} [options] Override http request option. * @throws {RequiredError} */ async uploadDocument(file: Array, allowDuplicateFileNames?: boolean, autoFile?: boolean, parametersByFilename?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.uploadDocument(file, allowDuplicateFileNames, autoFile, parametersByFilename, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.uploadDocument']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Uploads a single file, optionally with metadata and a parent folder ID. * @summary Upload a single document * @param {File} file * @param {boolean} [allowDuplicateFileNames] When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. * @param {boolean} [autoFile] Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent = the user\'s own switch. Needs openfilz.ai.auto-file.active. * @param {string} [parentFolderId] Target parent folder ID to store the file; if not sent or null, the file is stored at the root level * @param {string} [metadata] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async uploadDocument1(file: File, allowDuplicateFileNames?: boolean, autoFile?: boolean, parentFolderId?: string, metadata?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.uploadDocument1(file, allowDuplicateFileNames, autoFile, parentFolderId, metadata, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentControllerApi.uploadDocument1']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * DocumentControllerApi - factory interface */ export const DocumentControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = DocumentControllerApiFp(configuration) return { /** * Creates a new blank document (Word, Excel, PowerPoint, or Text) from a template in the specified folder. * @summary Create a blank document from template * @param {CreateBlankDocumentRequest} createBlankDocumentRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ createBlankDocument(createBlankDocumentRequest: CreateBlankDocumentRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.createBlankDocument(createBlankDocumentRequest, options).then((request) => request(axios, basePath)); }, /** * Deletes specified metadata keys from a document. * @summary Delete specific metadata keys * @param {string} documentId * @param {DeleteMetadataRequest} deleteMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteDocumentMetadata(documentId: string, deleteMetadataRequest: DeleteMetadataRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.deleteDocumentMetadata(documentId, deleteMetadataRequest, options).then((request) => request(axios, basePath)); }, /** * Downloads a single file document. * @summary Download a document * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ downloadDocument(documentId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.downloadDocument(documentId, options).then((request) => request(axios, basePath)); }, /** * Internal endpoint for OnlyOffice DocumentServer to fetch document content. Uses token-based authentication. * @summary Download document for OnlyOffice * @param {string} documentId * @param {string} token * @param {string} [versionId] * @param {*} [options] Override http request option. * @throws {RequiredError} */ downloadForOnlyOffice(documentId: string, token: string, versionId?: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.downloadForOnlyOffice(documentId, token, versionId, options).then((request) => request(axios, basePath)); }, /** * Downloads multiple documents as a single ZIP file. * @summary Download multiple documents as ZIP * @param {Array} requestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ downloadMultipleDocumentsAsZip(requestBody: Array, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.downloadMultipleDocumentsAsZip(requestBody, options).then((request) => request(axios, basePath)); }, /** * Retrieves all ancestor folders (parent path) of a document, ordered from root to immediate parent. * @summary Get document ancestors * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDocumentAncestors(documentId: string, options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.getDocumentAncestors(documentId, options).then((request) => request(axios, basePath)); }, /** * Retrieves information for a document. * @summary Get information of a document * @param {string} documentId * @param {boolean} [withMetadata] if false : only name, type and parentId are sent (when not null) - if true : metadata and size are added in the response * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDocumentInfo(documentId: string, withMetadata?: boolean, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getDocumentInfo(documentId, withMetadata, options).then((request) => request(axios, basePath)); }, /** * Append-only history of what this document\'s content hashed to, newest first. Unlike the sha256 in metadata, these entries cannot be modified or deleted — a database trigger refuses UPDATE and DELETE on the table. Empty for documents uploaded before the ledger existed, or when openfilz.calculate-checksum is off. * @summary Get a document\'s integrity ledger * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDocumentIntegrity(documentId: string, options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.getDocumentIntegrity(documentId, options).then((request) => request(axios, basePath)); }, /** * Retrieves metadata for a document. Can filter by keys. * @summary Search metadata of a document * @param {string} documentId * @param {SearchMetadataRequest} [searchMetadataRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDocumentMetadata(documentId: string, searchMetadataRequest?: SearchMetadataRequest, options?: RawAxiosRequestConfig): AxiosPromise<{ [key: string]: any; }> { return localVarFp.getDocumentMetadata(documentId, searchMetadataRequest, options).then((request) => request(axios, basePath)); }, /** * Retrieves the position of a document within its parent folder, useful for pagination. * @summary Get document position in folder * @param {string} documentId * @param {string} [sortBy] Field to sort by (name, updated_at, created_at, size, type). Defaults to \'name\'. * @param {string} [sortOrder] Sort order (ASC or DESC). Defaults to \'ASC\'. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDocumentPosition(documentId: string, sortBy?: string, sortOrder?: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getDocumentPosition(documentId, sortBy, sortOrder, options).then((request) => request(axios, basePath)); }, /** * Replaces the content of an existing file document. * @summary Replace document content * @param {string} documentId * @param {File} file * @param {*} [options] Override http request option. * @throws {RequiredError} */ replaceDocumentContent(documentId: string, file: File, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.replaceDocumentContent(documentId, file, options).then((request) => request(axios, basePath)); }, /** * Replaces all metadata of a document (file or folder). * @summary Replace document metadata * @param {string} documentId * @param {{ [key: string]: any; }} requestBody New metadata map. Replaces all existing metadata. * @param {*} [options] Override http request option. * @throws {RequiredError} */ replaceDocumentMetadata(documentId: string, requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.replaceDocumentMetadata(documentId, requestBody, options).then((request) => request(axios, basePath)); }, /** * Finds document IDs matching all provided metadata criteria. * @summary Search document IDs by metadata * @param {SearchByMetadataRequest} searchByMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ searchDocumentIdsByMetadata(searchByMetadataRequest: SearchByMetadataRequest, options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.searchDocumentIdsByMetadata(searchByMetadataRequest, options).then((request) => request(axios, basePath)); }, /** * Updates or adds specific metadata fields for a document. * @summary Update document metadata * @param {string} documentId * @param {UpdateMetadataRequest} updateMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateDocumentMetadata(documentId: string, updateMetadataRequest: UpdateMetadataRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.updateDocumentMetadata(documentId, updateMetadataRequest, options).then((request) => request(axios, basePath)); }, /** * Uploads multiple files, optionally with metadata and a parent folder ID. Returns HTTP 200 if all uploads succeed, HTTP 207 (Multi-Status) if some succeed and some fail, or an appropriate error status (404, 409, 403, 500) if all uploads fail. * @summary Upload multiple documents * @param {Array} file * @param {boolean} [allowDuplicateFileNames] When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. * @param {boolean} [autoFile] Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent = the user\'s own switch. Needs openfilz.ai.auto-file.active. * @param {string} [parametersByFilename] Paste the JSON array here<br>This array provides optional metadata and attributes for the uploaded files<br><section> <h3>Each object in the array must contain:</h3> <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>filename</code></td> <td><code>String</code></td> <td>Must match the filename of one of the uploaded files. Filenames must be unique in the upload request.</td> </tr> <tr> <td><code>fileAttributes</code></td> <td><code>JSON Object</code></td> <td>Container for metadata and other file-specific attributes.</td> </tr> </tbody> </table> <h4>Inside <code>fileAttributes</code>:</h4> <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>parentFolderId</code></td> <td><code>UUID</code></td> <td>UUID of the target folder to upload the file (if not provided : the file will be uploaded at the root level)</td> </tr> <tr> <td><code>metadata</code></td> <td><code>Map&lt;String, JSON Object&gt;</code></td> <td>Arbitrary metadata to associate with the file (key/value pairs).</td> </tr> </tbody> </table> <h4>Example of <code>parametersByFilename</code> JSON array :</h4> <pre><code>[ { \\\"filename\\\": \\\"file1.txt\\\", \\\"fileAttributes\\\": { \\\"parentFolderId\\\": \\\"f8c3de3d-1fea-4d7c-a8b0-29f63c4c3454\\\", \\\"metadata\\\": { \\\"country\\\": \\\"UK\\\", \\\"owner\\\": { \\\"name\\\": \\\"Joe\\\", \\\"owner_id\\\": 1234568 } } } }, { \\\"filename\\\": \\\"file2.md\\\", \\\"fileAttributes\\\": { \\\"metadata\\\": { \\\"key1\\\": \\\"value1\\\", \\\"key2\\\": \\\"value2\\\", \\\"key3\\\": \\\"value3\\\" } } } ]</code></pre> </section> * @param {*} [options] Override http request option. * @throws {RequiredError} */ uploadDocument(file: Array, allowDuplicateFileNames?: boolean, autoFile?: boolean, parametersByFilename?: string, options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.uploadDocument(file, allowDuplicateFileNames, autoFile, parametersByFilename, options).then((request) => request(axios, basePath)); }, /** * Uploads a single file, optionally with metadata and a parent folder ID. * @summary Upload a single document * @param {File} file * @param {boolean} [allowDuplicateFileNames] When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. * @param {boolean} [autoFile] Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent = the user\'s own switch. Needs openfilz.ai.auto-file.active. * @param {string} [parentFolderId] Target parent folder ID to store the file; if not sent or null, the file is stored at the root level * @param {string} [metadata] * @param {*} [options] Override http request option. * @throws {RequiredError} */ uploadDocument1(file: File, allowDuplicateFileNames?: boolean, autoFile?: boolean, parentFolderId?: string, metadata?: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.uploadDocument1(file, allowDuplicateFileNames, autoFile, parentFolderId, metadata, options).then((request) => request(axios, basePath)); }, }; }; /** * DocumentControllerApi - object-oriented interface */ export class DocumentControllerApi extends BaseAPI { /** * Creates a new blank document (Word, Excel, PowerPoint, or Text) from a template in the specified folder. * @summary Create a blank document from template * @param {CreateBlankDocumentRequest} createBlankDocumentRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ public createBlankDocument(createBlankDocumentRequest: CreateBlankDocumentRequest, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).createBlankDocument(createBlankDocumentRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Deletes specified metadata keys from a document. * @summary Delete specific metadata keys * @param {string} documentId * @param {DeleteMetadataRequest} deleteMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ public deleteDocumentMetadata(documentId: string, deleteMetadataRequest: DeleteMetadataRequest, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).deleteDocumentMetadata(documentId, deleteMetadataRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Downloads a single file document. * @summary Download a document * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public downloadDocument(documentId: string, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).downloadDocument(documentId, options).then((request) => request(this.axios, this.basePath)); } /** * Internal endpoint for OnlyOffice DocumentServer to fetch document content. Uses token-based authentication. * @summary Download document for OnlyOffice * @param {string} documentId * @param {string} token * @param {string} [versionId] * @param {*} [options] Override http request option. * @throws {RequiredError} */ public downloadForOnlyOffice(documentId: string, token: string, versionId?: string, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).downloadForOnlyOffice(documentId, token, versionId, options).then((request) => request(this.axios, this.basePath)); } /** * Downloads multiple documents as a single ZIP file. * @summary Download multiple documents as ZIP * @param {Array} requestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ public downloadMultipleDocumentsAsZip(requestBody: Array, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).downloadMultipleDocumentsAsZip(requestBody, options).then((request) => request(this.axios, this.basePath)); } /** * Retrieves all ancestor folders (parent path) of a document, ordered from root to immediate parent. * @summary Get document ancestors * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getDocumentAncestors(documentId: string, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).getDocumentAncestors(documentId, options).then((request) => request(this.axios, this.basePath)); } /** * Retrieves information for a document. * @summary Get information of a document * @param {string} documentId * @param {boolean} [withMetadata] if false : only name, type and parentId are sent (when not null) - if true : metadata and size are added in the response * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getDocumentInfo(documentId: string, withMetadata?: boolean, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).getDocumentInfo(documentId, withMetadata, options).then((request) => request(this.axios, this.basePath)); } /** * Append-only history of what this document\'s content hashed to, newest first. Unlike the sha256 in metadata, these entries cannot be modified or deleted — a database trigger refuses UPDATE and DELETE on the table. Empty for documents uploaded before the ledger existed, or when openfilz.calculate-checksum is off. * @summary Get a document\'s integrity ledger * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getDocumentIntegrity(documentId: string, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).getDocumentIntegrity(documentId, options).then((request) => request(this.axios, this.basePath)); } /** * Retrieves metadata for a document. Can filter by keys. * @summary Search metadata of a document * @param {string} documentId * @param {SearchMetadataRequest} [searchMetadataRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getDocumentMetadata(documentId: string, searchMetadataRequest?: SearchMetadataRequest, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).getDocumentMetadata(documentId, searchMetadataRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Retrieves the position of a document within its parent folder, useful for pagination. * @summary Get document position in folder * @param {string} documentId * @param {string} [sortBy] Field to sort by (name, updated_at, created_at, size, type). Defaults to \'name\'. * @param {string} [sortOrder] Sort order (ASC or DESC). Defaults to \'ASC\'. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getDocumentPosition(documentId: string, sortBy?: string, sortOrder?: string, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).getDocumentPosition(documentId, sortBy, sortOrder, options).then((request) => request(this.axios, this.basePath)); } /** * Replaces the content of an existing file document. * @summary Replace document content * @param {string} documentId * @param {File} file * @param {*} [options] Override http request option. * @throws {RequiredError} */ public replaceDocumentContent(documentId: string, file: File, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).replaceDocumentContent(documentId, file, options).then((request) => request(this.axios, this.basePath)); } /** * Replaces all metadata of a document (file or folder). * @summary Replace document metadata * @param {string} documentId * @param {{ [key: string]: any; }} requestBody New metadata map. Replaces all existing metadata. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public replaceDocumentMetadata(documentId: string, requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).replaceDocumentMetadata(documentId, requestBody, options).then((request) => request(this.axios, this.basePath)); } /** * Finds document IDs matching all provided metadata criteria. * @summary Search document IDs by metadata * @param {SearchByMetadataRequest} searchByMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ public searchDocumentIdsByMetadata(searchByMetadataRequest: SearchByMetadataRequest, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).searchDocumentIdsByMetadata(searchByMetadataRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Updates or adds specific metadata fields for a document. * @summary Update document metadata * @param {string} documentId * @param {UpdateMetadataRequest} updateMetadataRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ public updateDocumentMetadata(documentId: string, updateMetadataRequest: UpdateMetadataRequest, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).updateDocumentMetadata(documentId, updateMetadataRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Uploads multiple files, optionally with metadata and a parent folder ID. Returns HTTP 200 if all uploads succeed, HTTP 207 (Multi-Status) if some succeed and some fail, or an appropriate error status (404, 409, 403, 500) if all uploads fail. * @summary Upload multiple documents * @param {Array} file * @param {boolean} [allowDuplicateFileNames] When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. * @param {boolean} [autoFile] Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent = the user\'s own switch. Needs openfilz.ai.auto-file.active. * @param {string} [parametersByFilename] Paste the JSON array here<br>This array provides optional metadata and attributes for the uploaded files<br><section> <h3>Each object in the array must contain:</h3> <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>filename</code></td> <td><code>String</code></td> <td>Must match the filename of one of the uploaded files. Filenames must be unique in the upload request.</td> </tr> <tr> <td><code>fileAttributes</code></td> <td><code>JSON Object</code></td> <td>Container for metadata and other file-specific attributes.</td> </tr> </tbody> </table> <h4>Inside <code>fileAttributes</code>:</h4> <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>parentFolderId</code></td> <td><code>UUID</code></td> <td>UUID of the target folder to upload the file (if not provided : the file will be uploaded at the root level)</td> </tr> <tr> <td><code>metadata</code></td> <td><code>Map&lt;String, JSON Object&gt;</code></td> <td>Arbitrary metadata to associate with the file (key/value pairs).</td> </tr> </tbody> </table> <h4>Example of <code>parametersByFilename</code> JSON array :</h4> <pre><code>[ { \\\"filename\\\": \\\"file1.txt\\\", \\\"fileAttributes\\\": { \\\"parentFolderId\\\": \\\"f8c3de3d-1fea-4d7c-a8b0-29f63c4c3454\\\", \\\"metadata\\\": { \\\"country\\\": \\\"UK\\\", \\\"owner\\\": { \\\"name\\\": \\\"Joe\\\", \\\"owner_id\\\": 1234568 } } } }, { \\\"filename\\\": \\\"file2.md\\\", \\\"fileAttributes\\\": { \\\"metadata\\\": { \\\"key1\\\": \\\"value1\\\", \\\"key2\\\": \\\"value2\\\", \\\"key3\\\": \\\"value3\\\" } } } ]</code></pre> </section> * @param {*} [options] Override http request option. * @throws {RequiredError} */ public uploadDocument(file: Array, allowDuplicateFileNames?: boolean, autoFile?: boolean, parametersByFilename?: string, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).uploadDocument(file, allowDuplicateFileNames, autoFile, parametersByFilename, options).then((request) => request(this.axios, this.basePath)); } /** * Uploads a single file, optionally with metadata and a parent folder ID. * @summary Upload a single document * @param {File} file * @param {boolean} [allowDuplicateFileNames] When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. * @param {boolean} [autoFile] Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent = the user\'s own switch. Needs openfilz.ai.auto-file.active. * @param {string} [parentFolderId] Target parent folder ID to store the file; if not sent or null, the file is stored at the root level * @param {string} [metadata] * @param {*} [options] Override http request option. * @throws {RequiredError} */ public uploadDocument1(file: File, allowDuplicateFileNames?: boolean, autoFile?: boolean, parentFolderId?: string, metadata?: string, options?: RawAxiosRequestConfig) { return DocumentControllerApiFp(this.configuration).uploadDocument1(file, allowDuplicateFileNames, autoFile, parentFolderId, metadata, options).then((request) => request(this.axios, this.basePath)); } }