UNPKG

@jellyfin/sdk

Version:
144 lines (141 loc) 6.71 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/. */ /** * SuggestionsApi - axios parameter creator * @export */ const SuggestionsApiAxiosParamCreator = function (configuration) { return { /** * * @summary Gets suggestions. * @param {string} [userId] The user id. * @param {Array<MediaType>} [mediaType] The media types. * @param {Array<BaseItemKind>} [type] The type. * @param {number} [startIndex] Optional. The start index. * @param {number} [limit] Optional. The limit. * @param {boolean} [enableTotalRecordCount] Whether to enable the total record count. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getSuggestions: async (userId, mediaType, type, startIndex, limit, enableTotalRecordCount, options = {}) => { const localVarPath = `/Items/Suggestions`; // 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 (mediaType) { localVarQueryParameter['mediaType'] = mediaType; } if (type) { localVarQueryParameter['type'] = type; } if (startIndex !== undefined) { localVarQueryParameter['startIndex'] = startIndex; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (enableTotalRecordCount !== undefined) { localVarQueryParameter['enableTotalRecordCount'] = enableTotalRecordCount; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * SuggestionsApi - functional programming interface * @export */ const SuggestionsApiFp = function (configuration) { const localVarAxiosParamCreator = SuggestionsApiAxiosParamCreator(configuration); return { /** * * @summary Gets suggestions. * @param {string} [userId] The user id. * @param {Array<MediaType>} [mediaType] The media types. * @param {Array<BaseItemKind>} [type] The type. * @param {number} [startIndex] Optional. The start index. * @param {number} [limit] Optional. The limit. * @param {boolean} [enableTotalRecordCount] Whether to enable the total record count. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getSuggestions(userId, mediaType, type, startIndex, limit, enableTotalRecordCount, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getSuggestions(userId, mediaType, type, startIndex, limit, enableTotalRecordCount, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['SuggestionsApi.getSuggestions']) === 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); }, }; }; /** * SuggestionsApi - factory interface * @export */ const SuggestionsApiFactory = function (configuration, basePath, axios) { const localVarFp = SuggestionsApiFp(configuration); return { /** * * @summary Gets suggestions. * @param {SuggestionsApiGetSuggestionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getSuggestions(requestParameters = {}, options) { return localVarFp.getSuggestions(requestParameters.userId, requestParameters.mediaType, requestParameters.type, requestParameters.startIndex, requestParameters.limit, requestParameters.enableTotalRecordCount, options).then((request) => request(axios, basePath)); }, }; }; /** * SuggestionsApi - object-oriented interface * @export * @class SuggestionsApi * @extends {BaseAPI} */ class SuggestionsApi extends BaseAPI { /** * * @summary Gets suggestions. * @param {SuggestionsApiGetSuggestionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SuggestionsApi */ getSuggestions(requestParameters = {}, options) { return SuggestionsApiFp(this.configuration).getSuggestions(requestParameters.userId, requestParameters.mediaType, requestParameters.type, requestParameters.startIndex, requestParameters.limit, requestParameters.enableTotalRecordCount, options).then((request) => request(this.axios, this.basePath)); } } export { SuggestionsApi, SuggestionsApiAxiosParamCreator, SuggestionsApiFactory, SuggestionsApiFp };