UNPKG

@jellyfin/sdk

Version:
447 lines (444 loc) • 23 kB
import globalAxios from 'axios'; import { DUMMY_BASE_URL, setApiKeyToObject, setSearchParams, toPathString, assertParamExists, serializeDataIfNeeded, createRequestFunction } from '../common.js'; import { operationServerMap, BaseAPI, BASE_PATH } from '../base.js'; /* tslint:disable */ /* eslint-disable */ /** * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit the class manually. * * Jellyfin API * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * EnvironmentApi - axios parameter creator * @export */ const EnvironmentApiAxiosParamCreator = function (configuration) { return { /** * * @summary Get Default directory browser. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDefaultDirectoryBrowser: async (options = {}) => { const localVarPath = `/Environment/DefaultDirectoryBrowser`; // 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 = {}; const localVarQueryParameter = {}; // authentication CustomAuthentication required await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Gets the contents of a given directory in the file system. * @param {string} path The path. * @param {boolean} [includeFiles] An optional filter to include or exclude files from the results. true/false. * @param {boolean} [includeDirectories] An optional filter to include or exclude folders from the results. true/false. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDirectoryContents: async (path, includeFiles, includeDirectories, options = {}) => { // verify required parameter 'path' is not null or undefined assertParamExists('getDirectoryContents', 'path', path); const localVarPath = `/Environment/DirectoryContents`; // 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 = {}; const localVarQueryParameter = {}; // authentication CustomAuthentication required await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration); if (path !== undefined) { localVarQueryParameter['path'] = path; } if (includeFiles !== undefined) { localVarQueryParameter['includeFiles'] = includeFiles; } if (includeDirectories !== undefined) { localVarQueryParameter['includeDirectories'] = includeDirectories; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Gets available drives from the server\'s file system. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDrives: async (options = {}) => { const localVarPath = `/Environment/Drives`; // 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 = {}; const localVarQueryParameter = {}; // authentication CustomAuthentication required await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Gets network paths. * @param {*} [options] Override http request option. * @deprecated * @throws {RequiredError} */ getNetworkShares: async (options = {}) => { const localVarPath = `/Environment/NetworkShares`; // 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 = {}; const localVarQueryParameter = {}; // authentication CustomAuthentication required await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Gets the parent path of a given path. * @param {string} path The path. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getParentPath: async (path, options = {}) => { // verify required parameter 'path' is not null or undefined assertParamExists('getParentPath', 'path', path); const localVarPath = `/Environment/ParentPath`; // 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 = {}; const localVarQueryParameter = {}; // authentication CustomAuthentication required await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration); if (path !== undefined) { localVarQueryParameter['path'] = path; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Validates path. * @param {ValidatePathDto} validatePathDto Validate request object. * @param {*} [options] Override http request option. * @throws {RequiredError} */ validatePath: async (validatePathDto, options = {}) => { // verify required parameter 'validatePathDto' is not null or undefined assertParamExists('validatePath', 'validatePathDto', validatePathDto); const localVarPath = `/Environment/ValidatePath`; // 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 = {}; const localVarQueryParameter = {}; // authentication CustomAuthentication required await setApiKeyToObject(localVarHeaderParameter, "Authorization", 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(validatePathDto, localVarRequestOptions, configuration); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * EnvironmentApi - functional programming interface * @export */ const EnvironmentApiFp = function (configuration) { const localVarAxiosParamCreator = EnvironmentApiAxiosParamCreator(configuration); return { /** * * @summary Get Default directory browser. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDefaultDirectoryBrowser(options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getDefaultDirectoryBrowser(options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['EnvironmentApi.getDefaultDirectoryBrowser']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Gets the contents of a given directory in the file system. * @param {string} path The path. * @param {boolean} [includeFiles] An optional filter to include or exclude files from the results. true/false. * @param {boolean} [includeDirectories] An optional filter to include or exclude folders from the results. true/false. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDirectoryContents(path, includeFiles, includeDirectories, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getDirectoryContents(path, includeFiles, includeDirectories, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['EnvironmentApi.getDirectoryContents']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Gets available drives from the server\'s file system. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDrives(options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getDrives(options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['EnvironmentApi.getDrives']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Gets network paths. * @param {*} [options] Override http request option. * @deprecated * @throws {RequiredError} */ async getNetworkShares(options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getNetworkShares(options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['EnvironmentApi.getNetworkShares']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Gets the parent path of a given path. * @param {string} path The path. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getParentPath(path, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getParentPath(path, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['EnvironmentApi.getParentPath']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Validates path. * @param {ValidatePathDto} validatePathDto Validate request object. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async validatePath(validatePathDto, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.validatePath(validatePathDto, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['EnvironmentApi.validatePath']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * EnvironmentApi - factory interface * @export */ const EnvironmentApiFactory = function (configuration, basePath, axios) { const localVarFp = EnvironmentApiFp(configuration); return { /** * * @summary Get Default directory browser. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDefaultDirectoryBrowser(options) { return localVarFp.getDefaultDirectoryBrowser(options).then((request) => request(axios, basePath)); }, /** * * @summary Gets the contents of a given directory in the file system. * @param {EnvironmentApiGetDirectoryContentsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDirectoryContents(requestParameters, options) { return localVarFp.getDirectoryContents(requestParameters.path, requestParameters.includeFiles, requestParameters.includeDirectories, options).then((request) => request(axios, basePath)); }, /** * * @summary Gets available drives from the server\'s file system. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDrives(options) { return localVarFp.getDrives(options).then((request) => request(axios, basePath)); }, /** * * @summary Gets network paths. * @param {*} [options] Override http request option. * @deprecated * @throws {RequiredError} */ getNetworkShares(options) { return localVarFp.getNetworkShares(options).then((request) => request(axios, basePath)); }, /** * * @summary Gets the parent path of a given path. * @param {EnvironmentApiGetParentPathRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getParentPath(requestParameters, options) { return localVarFp.getParentPath(requestParameters.path, options).then((request) => request(axios, basePath)); }, /** * * @summary Validates path. * @param {EnvironmentApiValidatePathRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ validatePath(requestParameters, options) { return localVarFp.validatePath(requestParameters.validatePathDto, options).then((request) => request(axios, basePath)); }, }; }; /** * EnvironmentApi - object-oriented interface * @export * @class EnvironmentApi * @extends {BaseAPI} */ class EnvironmentApi extends BaseAPI { /** * * @summary Get Default directory browser. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EnvironmentApi */ getDefaultDirectoryBrowser(options) { return EnvironmentApiFp(this.configuration).getDefaultDirectoryBrowser(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Gets the contents of a given directory in the file system. * @param {EnvironmentApiGetDirectoryContentsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EnvironmentApi */ getDirectoryContents(requestParameters, options) { return EnvironmentApiFp(this.configuration).getDirectoryContents(requestParameters.path, requestParameters.includeFiles, requestParameters.includeDirectories, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Gets available drives from the server\'s file system. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EnvironmentApi */ getDrives(options) { return EnvironmentApiFp(this.configuration).getDrives(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Gets network paths. * @param {*} [options] Override http request option. * @deprecated * @throws {RequiredError} * @memberof EnvironmentApi */ getNetworkShares(options) { return EnvironmentApiFp(this.configuration).getNetworkShares(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Gets the parent path of a given path. * @param {EnvironmentApiGetParentPathRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EnvironmentApi */ getParentPath(requestParameters, options) { return EnvironmentApiFp(this.configuration).getParentPath(requestParameters.path, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Validates path. * @param {EnvironmentApiValidatePathRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EnvironmentApi */ validatePath(requestParameters, options) { return EnvironmentApiFp(this.configuration).validatePath(requestParameters.validatePathDto, options).then((request) => request(this.axios, this.basePath)); } } export { EnvironmentApi, EnvironmentApiAxiosParamCreator, EnvironmentApiFactory, EnvironmentApiFp };