/* 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 { DocumentVersionInfo } from '../models'; // @ts-ignore import type { RestoreVersionResponse } from '../models'; /** * DocumentVersionControllerApi - axios parameter creator */ export const DocumentVersionControllerApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Downloads the content of a specific stored version of a file document. * @summary Download a specific document version * @param {string} documentId * @param {string} versionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ downloadVersion: async (documentId: string, versionId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('downloadVersion', 'documentId', documentId) // verify required parameter 'versionId' is not null or undefined assertParamExists('downloadVersion', 'versionId', versionId) const localVarPath = `/api/v1/documents/{documentId}/versions/{versionId}/download` .replace('{documentId}', encodeURIComponent(String(documentId))) .replace('{versionId}', encodeURIComponent(String(versionId))); // 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, }; }, /** * Lists all stored versions of a file document, newest first. Requires storage versioning to be enabled (otherwise HTTP 409). * @summary List document versions * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ listVersions: async (documentId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('listVersions', 'documentId', documentId) const localVarPath = `/api/v1/documents/{documentId}/versions` .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, }; }, /** * Restores the selected version as the new latest version. History-preserving: a new version is created on top, no version is deleted, and a RESTORE_DOCUMENT_VERSION audit entry is logged. Restoring the current latest version is rejected (HTTP 400). * @summary Restore a previous document version * @param {string} documentId * @param {string} versionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ restoreVersion: async (documentId: string, versionId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('restoreVersion', 'documentId', documentId) // verify required parameter 'versionId' is not null or undefined assertParamExists('restoreVersion', 'versionId', versionId) const localVarPath = `/api/v1/documents/{documentId}/versions/{versionId}/restore` .replace('{documentId}', encodeURIComponent(String(documentId))) .replace('{versionId}', encodeURIComponent(String(versionId))); // 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['Accept'] = '*/*'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * DocumentVersionControllerApi - functional programming interface */ export const DocumentVersionControllerApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = DocumentVersionControllerApiAxiosParamCreator(configuration) return { /** * Downloads the content of a specific stored version of a file document. * @summary Download a specific document version * @param {string} documentId * @param {string} versionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async downloadVersion(documentId: string, versionId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.downloadVersion(documentId, versionId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentVersionControllerApi.downloadVersion']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Lists all stored versions of a file document, newest first. Requires storage versioning to be enabled (otherwise HTTP 409). * @summary List document versions * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listVersions(documentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.listVersions(documentId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentVersionControllerApi.listVersions']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Restores the selected version as the new latest version. History-preserving: a new version is created on top, no version is deleted, and a RESTORE_DOCUMENT_VERSION audit entry is logged. Restoring the current latest version is rejected (HTTP 400). * @summary Restore a previous document version * @param {string} documentId * @param {string} versionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async restoreVersion(documentId: string, versionId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.restoreVersion(documentId, versionId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DocumentVersionControllerApi.restoreVersion']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * DocumentVersionControllerApi - factory interface */ export const DocumentVersionControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = DocumentVersionControllerApiFp(configuration) return { /** * Downloads the content of a specific stored version of a file document. * @summary Download a specific document version * @param {string} documentId * @param {string} versionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ downloadVersion(documentId: string, versionId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.downloadVersion(documentId, versionId, options).then((request) => request(axios, basePath)); }, /** * Lists all stored versions of a file document, newest first. Requires storage versioning to be enabled (otherwise HTTP 409). * @summary List document versions * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ listVersions(documentId: string, options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.listVersions(documentId, options).then((request) => request(axios, basePath)); }, /** * Restores the selected version as the new latest version. History-preserving: a new version is created on top, no version is deleted, and a RESTORE_DOCUMENT_VERSION audit entry is logged. Restoring the current latest version is rejected (HTTP 400). * @summary Restore a previous document version * @param {string} documentId * @param {string} versionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ restoreVersion(documentId: string, versionId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.restoreVersion(documentId, versionId, options).then((request) => request(axios, basePath)); }, }; }; /** * DocumentVersionControllerApi - object-oriented interface */ export class DocumentVersionControllerApi extends BaseAPI { /** * Downloads the content of a specific stored version of a file document. * @summary Download a specific document version * @param {string} documentId * @param {string} versionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public downloadVersion(documentId: string, versionId: string, options?: RawAxiosRequestConfig) { return DocumentVersionControllerApiFp(this.configuration).downloadVersion(documentId, versionId, options).then((request) => request(this.axios, this.basePath)); } /** * Lists all stored versions of a file document, newest first. Requires storage versioning to be enabled (otherwise HTTP 409). * @summary List document versions * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public listVersions(documentId: string, options?: RawAxiosRequestConfig) { return DocumentVersionControllerApiFp(this.configuration).listVersions(documentId, options).then((request) => request(this.axios, this.basePath)); } /** * Restores the selected version as the new latest version. History-preserving: a new version is created on top, no version is deleted, and a RESTORE_DOCUMENT_VERSION audit entry is logged. Restoring the current latest version is rejected (HTTP 400). * @summary Restore a previous document version * @param {string} documentId * @param {string} versionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public restoreVersion(documentId: string, versionId: string, options?: RawAxiosRequestConfig) { return DocumentVersionControllerApiFp(this.configuration).restoreVersion(documentId, versionId, options).then((request) => request(this.axios, this.basePath)); } }