UNPKG

@jellyfin/sdk

Version:
275 lines (272 loc) • 16.7 kB
import globalAxios from 'axios'; import { assertParamExists, 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/. */ /** * GenresApi - axios parameter creator * @export */ const GenresApiAxiosParamCreator = function (configuration) { return { /** * * @summary Gets a genre, by name. * @param {string} genreName The genre name. * @param {string} [userId] The user id. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getGenre: async (genreName, userId, options = {}) => { // verify required parameter 'genreName' is not null or undefined assertParamExists('getGenre', 'genreName', genreName); const localVarPath = `/Genres/{genreName}` .replace(`{${"genreName"}}`, encodeURIComponent(String(genreName))); // 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 Gets all genres from a given item, folder, or the entire library. * @param {number} [startIndex] Optional. The record index to start at. All items with a lower index will be dropped from the results. * @param {number} [limit] Optional. The maximum number of records to return. * @param {string} [searchTerm] The search term. * @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. Specify additional fields of information to return in the output. * @param {Array<BaseItemKind>} [excludeItemTypes] Optional. If specified, results will be filtered out based on item type. This allows multiple, comma delimited. * @param {Array<BaseItemKind>} [includeItemTypes] Optional. If specified, results will be filtered in based on item type. This allows multiple, comma delimited. * @param {boolean} [isFavorite] Optional filter by items that are marked as favorite, or not. * @param {number} [imageTypeLimit] Optional, the max number of images to return, per image type. * @param {Array<ImageType>} [enableImageTypes] Optional. The image types to include in the output. * @param {string} [userId] User id. * @param {string} [nameStartsWithOrGreater] Optional filter by items whose name is sorted equally or greater than a given input string. * @param {string} [nameStartsWith] Optional filter by items whose name is sorted equally than a given input string. * @param {string} [nameLessThan] Optional filter by items whose name is equally or lesser than a given input string. * @param {Array<ItemSortBy>} [sortBy] Optional. Specify one or more sort orders, comma delimited. * @param {Array<SortOrder>} [sortOrder] Sort Order - Ascending,Descending. * @param {boolean} [enableImages] Optional, include image information in output. * @param {boolean} [enableTotalRecordCount] Optional. Include total record count. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getGenres: async (startIndex, limit, searchTerm, parentId, fields, excludeItemTypes, includeItemTypes, isFavorite, imageTypeLimit, enableImageTypes, userId, nameStartsWithOrGreater, nameStartsWith, nameLessThan, sortBy, sortOrder, enableImages, enableTotalRecordCount, options = {}) => { const localVarPath = `/Genres`; // 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 (startIndex !== undefined) { localVarQueryParameter['startIndex'] = startIndex; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (searchTerm !== undefined) { localVarQueryParameter['searchTerm'] = searchTerm; } if (parentId !== undefined) { localVarQueryParameter['parentId'] = parentId; } if (fields) { localVarQueryParameter['fields'] = fields; } if (excludeItemTypes) { localVarQueryParameter['excludeItemTypes'] = excludeItemTypes; } if (includeItemTypes) { localVarQueryParameter['includeItemTypes'] = includeItemTypes; } if (isFavorite !== undefined) { localVarQueryParameter['isFavorite'] = isFavorite; } if (imageTypeLimit !== undefined) { localVarQueryParameter['imageTypeLimit'] = imageTypeLimit; } if (enableImageTypes) { localVarQueryParameter['enableImageTypes'] = enableImageTypes; } if (userId !== undefined) { localVarQueryParameter['userId'] = userId; } if (nameStartsWithOrGreater !== undefined) { localVarQueryParameter['nameStartsWithOrGreater'] = nameStartsWithOrGreater; } if (nameStartsWith !== undefined) { localVarQueryParameter['nameStartsWith'] = nameStartsWith; } if (nameLessThan !== undefined) { localVarQueryParameter['nameLessThan'] = nameLessThan; } if (sortBy) { localVarQueryParameter['sortBy'] = sortBy; } if (sortOrder) { localVarQueryParameter['sortOrder'] = sortOrder; } if (enableImages !== undefined) { localVarQueryParameter['enableImages'] = enableImages; } 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, }; }, }; }; /** * GenresApi - functional programming interface * @export */ const GenresApiFp = function (configuration) { const localVarAxiosParamCreator = GenresApiAxiosParamCreator(configuration); return { /** * * @summary Gets a genre, by name. * @param {string} genreName The genre name. * @param {string} [userId] The user id. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getGenre(genreName, userId, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getGenre(genreName, 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['GenresApi.getGenre']) === 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 all genres from a given item, folder, or the entire library. * @param {number} [startIndex] Optional. The record index to start at. All items with a lower index will be dropped from the results. * @param {number} [limit] Optional. The maximum number of records to return. * @param {string} [searchTerm] The search term. * @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. Specify additional fields of information to return in the output. * @param {Array<BaseItemKind>} [excludeItemTypes] Optional. If specified, results will be filtered out based on item type. This allows multiple, comma delimited. * @param {Array<BaseItemKind>} [includeItemTypes] Optional. If specified, results will be filtered in based on item type. This allows multiple, comma delimited. * @param {boolean} [isFavorite] Optional filter by items that are marked as favorite, or not. * @param {number} [imageTypeLimit] Optional, the max number of images to return, per image type. * @param {Array<ImageType>} [enableImageTypes] Optional. The image types to include in the output. * @param {string} [userId] User id. * @param {string} [nameStartsWithOrGreater] Optional filter by items whose name is sorted equally or greater than a given input string. * @param {string} [nameStartsWith] Optional filter by items whose name is sorted equally than a given input string. * @param {string} [nameLessThan] Optional filter by items whose name is equally or lesser than a given input string. * @param {Array<ItemSortBy>} [sortBy] Optional. Specify one or more sort orders, comma delimited. * @param {Array<SortOrder>} [sortOrder] Sort Order - Ascending,Descending. * @param {boolean} [enableImages] Optional, include image information in output. * @param {boolean} [enableTotalRecordCount] Optional. Include total record count. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getGenres(startIndex, limit, searchTerm, parentId, fields, excludeItemTypes, includeItemTypes, isFavorite, imageTypeLimit, enableImageTypes, userId, nameStartsWithOrGreater, nameStartsWith, nameLessThan, sortBy, sortOrder, enableImages, enableTotalRecordCount, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getGenres(startIndex, limit, searchTerm, parentId, fields, excludeItemTypes, includeItemTypes, isFavorite, imageTypeLimit, enableImageTypes, userId, nameStartsWithOrGreater, nameStartsWith, nameLessThan, sortBy, sortOrder, enableImages, 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['GenresApi.getGenres']) === 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); }, }; }; /** * GenresApi - factory interface * @export */ const GenresApiFactory = function (configuration, basePath, axios) { const localVarFp = GenresApiFp(configuration); return { /** * * @summary Gets a genre, by name. * @param {GenresApiGetGenreRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getGenre(requestParameters, options) { return localVarFp.getGenre(requestParameters.genreName, requestParameters.userId, options).then((request) => request(axios, basePath)); }, /** * * @summary Gets all genres from a given item, folder, or the entire library. * @param {GenresApiGetGenresRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getGenres(requestParameters = {}, options) { return localVarFp.getGenres(requestParameters.startIndex, requestParameters.limit, requestParameters.searchTerm, requestParameters.parentId, requestParameters.fields, requestParameters.excludeItemTypes, requestParameters.includeItemTypes, requestParameters.isFavorite, requestParameters.imageTypeLimit, requestParameters.enableImageTypes, requestParameters.userId, requestParameters.nameStartsWithOrGreater, requestParameters.nameStartsWith, requestParameters.nameLessThan, requestParameters.sortBy, requestParameters.sortOrder, requestParameters.enableImages, requestParameters.enableTotalRecordCount, options).then((request) => request(axios, basePath)); }, }; }; /** * GenresApi - object-oriented interface * @export * @class GenresApi * @extends {BaseAPI} */ class GenresApi extends BaseAPI { /** * * @summary Gets a genre, by name. * @param {GenresApiGetGenreRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof GenresApi */ getGenre(requestParameters, options) { return GenresApiFp(this.configuration).getGenre(requestParameters.genreName, requestParameters.userId, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Gets all genres from a given item, folder, or the entire library. * @param {GenresApiGetGenresRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof GenresApi */ getGenres(requestParameters = {}, options) { return GenresApiFp(this.configuration).getGenres(requestParameters.startIndex, requestParameters.limit, requestParameters.searchTerm, requestParameters.parentId, requestParameters.fields, requestParameters.excludeItemTypes, requestParameters.includeItemTypes, requestParameters.isFavorite, requestParameters.imageTypeLimit, requestParameters.enableImageTypes, requestParameters.userId, requestParameters.nameStartsWithOrGreater, requestParameters.nameStartsWith, requestParameters.nameLessThan, requestParameters.sortBy, requestParameters.sortOrder, requestParameters.enableImages, requestParameters.enableTotalRecordCount, options).then((request) => request(this.axios, this.basePath)); } } export { GenresApi, GenresApiAxiosParamCreator, GenresApiFactory, GenresApiFp };