/* 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'; /** * FavoritesApi - axios parameter creator */ export const FavoritesApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Add a file or folder to the user\'s favorites * @summary Add document to favorites * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ addFavorite: async (documentId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('addFavorite', 'documentId', documentId) const localVarPath = `/api/v1/favorites/{documentId}` .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) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Check if a document is in the user\'s favorites * @summary Check favorite status * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ isFavorite: async (documentId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('isFavorite', 'documentId', documentId) const localVarPath = `/api/v1/favorites/{documentId}/is-favorite` .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, }; }, /** * Remove a file or folder from the user\'s favorites * @summary Remove document from favorites * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ removeFavorite: async (documentId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('removeFavorite', 'documentId', documentId) const localVarPath = `/api/v1/favorites/{documentId}` .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) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Toggle favorite status for a document (add if not favorited, remove if already favorited) * @summary Toggle favorite status * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ toggleFavorite: async (documentId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('toggleFavorite', 'documentId', documentId) const localVarPath = `/api/v1/favorites/{documentId}/toggle` .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['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, }; }, } }; /** * FavoritesApi - functional programming interface */ export const FavoritesApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = FavoritesApiAxiosParamCreator(configuration) return { /** * Add a file or folder to the user\'s favorites * @summary Add document to favorites * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async addFavorite(documentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.addFavorite(documentId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['FavoritesApi.addFavorite']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Check if a document is in the user\'s favorites * @summary Check favorite status * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async isFavorite(documentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.isFavorite(documentId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['FavoritesApi.isFavorite']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Remove a file or folder from the user\'s favorites * @summary Remove document from favorites * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async removeFavorite(documentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.removeFavorite(documentId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['FavoritesApi.removeFavorite']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Toggle favorite status for a document (add if not favorited, remove if already favorited) * @summary Toggle favorite status * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async toggleFavorite(documentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.toggleFavorite(documentId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['FavoritesApi.toggleFavorite']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * FavoritesApi - factory interface */ export const FavoritesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = FavoritesApiFp(configuration) return { /** * Add a file or folder to the user\'s favorites * @summary Add document to favorites * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ addFavorite(documentId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.addFavorite(documentId, options).then((request) => request(axios, basePath)); }, /** * Check if a document is in the user\'s favorites * @summary Check favorite status * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ isFavorite(documentId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.isFavorite(documentId, options).then((request) => request(axios, basePath)); }, /** * Remove a file or folder from the user\'s favorites * @summary Remove document from favorites * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ removeFavorite(documentId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.removeFavorite(documentId, options).then((request) => request(axios, basePath)); }, /** * Toggle favorite status for a document (add if not favorited, remove if already favorited) * @summary Toggle favorite status * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ toggleFavorite(documentId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.toggleFavorite(documentId, options).then((request) => request(axios, basePath)); }, }; }; /** * FavoritesApi - object-oriented interface */ export class FavoritesApi extends BaseAPI { /** * Add a file or folder to the user\'s favorites * @summary Add document to favorites * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public addFavorite(documentId: string, options?: RawAxiosRequestConfig) { return FavoritesApiFp(this.configuration).addFavorite(documentId, options).then((request) => request(this.axios, this.basePath)); } /** * Check if a document is in the user\'s favorites * @summary Check favorite status * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public isFavorite(documentId: string, options?: RawAxiosRequestConfig) { return FavoritesApiFp(this.configuration).isFavorite(documentId, options).then((request) => request(this.axios, this.basePath)); } /** * Remove a file or folder from the user\'s favorites * @summary Remove document from favorites * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public removeFavorite(documentId: string, options?: RawAxiosRequestConfig) { return FavoritesApiFp(this.configuration).removeFavorite(documentId, options).then((request) => request(this.axios, this.basePath)); } /** * Toggle favorite status for a document (add if not favorited, remove if already favorited) * @summary Toggle favorite status * @param {string} documentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ public toggleFavorite(documentId: string, options?: RawAxiosRequestConfig) { return FavoritesApiFp(this.configuration).toggleFavorite(documentId, options).then((request) => request(this.axios, this.basePath)); } }