@jellyfin/sdk
Version:
A TypeScript SDK for Jellyfin.
139 lines (136 loc) • 6.64 kB
JavaScript
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/.
*/
/**
* MoviesApi - axios parameter creator
* @export
*/
const MoviesApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Gets movie recommendations.
* @param {string} [userId] Optional. Filter by user id, and attach user data.
* @param {string} [parentId] Specify this to localize the search to a specific item or folder. Omit to use the root.
* @param {Array<ItemFields>} [fields] Optional. The fields to return.
* @param {number} [categoryLimit] The max number of categories to return.
* @param {number} [itemLimit] The max number of items to return per category.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMovieRecommendations: async (userId, parentId, fields, categoryLimit, itemLimit, options = {}) => {
const localVarPath = `/Movies/Recommendations`;
// 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 (parentId !== undefined) {
localVarQueryParameter['parentId'] = parentId;
}
if (fields) {
localVarQueryParameter['fields'] = fields;
}
if (categoryLimit !== undefined) {
localVarQueryParameter['categoryLimit'] = categoryLimit;
}
if (itemLimit !== undefined) {
localVarQueryParameter['itemLimit'] = itemLimit;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* MoviesApi - functional programming interface
* @export
*/
const MoviesApiFp = function (configuration) {
const localVarAxiosParamCreator = MoviesApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Gets movie recommendations.
* @param {string} [userId] Optional. Filter by user id, and attach user data.
* @param {string} [parentId] Specify this to localize the search to a specific item or folder. Omit to use the root.
* @param {Array<ItemFields>} [fields] Optional. The fields to return.
* @param {number} [categoryLimit] The max number of categories to return.
* @param {number} [itemLimit] The max number of items to return per category.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getMovieRecommendations(userId, parentId, fields, categoryLimit, itemLimit, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.getMovieRecommendations(userId, parentId, fields, categoryLimit, itemLimit, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['MoviesApi.getMovieRecommendations']) === 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);
},
};
};
/**
* MoviesApi - factory interface
* @export
*/
const MoviesApiFactory = function (configuration, basePath, axios) {
const localVarFp = MoviesApiFp(configuration);
return {
/**
*
* @summary Gets movie recommendations.
* @param {MoviesApiGetMovieRecommendationsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMovieRecommendations(requestParameters = {}, options) {
return localVarFp.getMovieRecommendations(requestParameters.userId, requestParameters.parentId, requestParameters.fields, requestParameters.categoryLimit, requestParameters.itemLimit, options).then((request) => request(axios, basePath));
},
};
};
/**
* MoviesApi - object-oriented interface
* @export
* @class MoviesApi
* @extends {BaseAPI}
*/
class MoviesApi extends BaseAPI {
/**
*
* @summary Gets movie recommendations.
* @param {MoviesApiGetMovieRecommendationsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof MoviesApi
*/
getMovieRecommendations(requestParameters = {}, options) {
return MoviesApiFp(this.configuration).getMovieRecommendations(requestParameters.userId, requestParameters.parentId, requestParameters.fields, requestParameters.categoryLimit, requestParameters.itemLimit, options).then((request) => request(this.axios, this.basePath));
}
}
export { MoviesApi, MoviesApiAxiosParamCreator, MoviesApiFactory, MoviesApiFp };