UNPKG

@jellyfin/sdk

Version:
200 lines (197 loc) • 9.75 kB
import globalAxios from 'axios'; import { DUMMY_BASE_URL, setApiKeyToObject, setSearchParams, toPathString, 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/. */ /** * UserViewsApi - axios parameter creator * @export */ const UserViewsApiAxiosParamCreator = function (configuration) { return { /** * * @summary Get user view grouping options. * @param {string} [userId] User id. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getGroupingOptions: async (userId, options = {}) => { const localVarPath = `/UserViews/GroupingOptions`; // 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 (userId !== undefined) { localVarQueryParameter['userId'] = userId; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get user views. * @param {string} [userId] User id. * @param {boolean} [includeExternalContent] Whether or not to include external views such as channels or live tv. * @param {Array<CollectionType>} [presetViews] Preset views. * @param {boolean} [includeHidden] Whether or not to include hidden content. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getUserViews: async (userId, includeExternalContent, presetViews, includeHidden, options = {}) => { const localVarPath = `/UserViews`; // 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 (userId !== undefined) { localVarQueryParameter['userId'] = userId; } if (includeExternalContent !== undefined) { localVarQueryParameter['includeExternalContent'] = includeExternalContent; } if (presetViews) { localVarQueryParameter['presetViews'] = presetViews; } if (includeHidden !== undefined) { localVarQueryParameter['includeHidden'] = includeHidden; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * UserViewsApi - functional programming interface * @export */ const UserViewsApiFp = function (configuration) { const localVarAxiosParamCreator = UserViewsApiAxiosParamCreator(configuration); return { /** * * @summary Get user view grouping options. * @param {string} [userId] User id. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getGroupingOptions(userId, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getGroupingOptions(userId, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['UserViewsApi.getGroupingOptions']) === 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 Get user views. * @param {string} [userId] User id. * @param {boolean} [includeExternalContent] Whether or not to include external views such as channels or live tv. * @param {Array<CollectionType>} [presetViews] Preset views. * @param {boolean} [includeHidden] Whether or not to include hidden content. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getUserViews(userId, includeExternalContent, presetViews, includeHidden, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getUserViews(userId, includeExternalContent, presetViews, includeHidden, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['UserViewsApi.getUserViews']) === 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); }, }; }; /** * UserViewsApi - factory interface * @export */ const UserViewsApiFactory = function (configuration, basePath, axios) { const localVarFp = UserViewsApiFp(configuration); return { /** * * @summary Get user view grouping options. * @param {UserViewsApiGetGroupingOptionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getGroupingOptions(requestParameters = {}, options) { return localVarFp.getGroupingOptions(requestParameters.userId, options).then((request) => request(axios, basePath)); }, /** * * @summary Get user views. * @param {UserViewsApiGetUserViewsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getUserViews(requestParameters = {}, options) { return localVarFp.getUserViews(requestParameters.userId, requestParameters.includeExternalContent, requestParameters.presetViews, requestParameters.includeHidden, options).then((request) => request(axios, basePath)); }, }; }; /** * UserViewsApi - object-oriented interface * @export * @class UserViewsApi * @extends {BaseAPI} */ class UserViewsApi extends BaseAPI { /** * * @summary Get user view grouping options. * @param {UserViewsApiGetGroupingOptionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserViewsApi */ getGroupingOptions(requestParameters = {}, options) { return UserViewsApiFp(this.configuration).getGroupingOptions(requestParameters.userId, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get user views. * @param {UserViewsApiGetUserViewsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserViewsApi */ getUserViews(requestParameters = {}, options) { return UserViewsApiFp(this.configuration).getUserViews(requestParameters.userId, requestParameters.includeExternalContent, requestParameters.presetViews, requestParameters.includeHidden, options).then((request) => request(this.axios, this.basePath)); } } export { UserViewsApi, UserViewsApiAxiosParamCreator, UserViewsApiFactory, UserViewsApiFp };