UNPKG

@jellyfin/sdk

Version:
466 lines (463 loc) • 26.7 kB
import globalAxios from 'axios'; import { DUMMY_BASE_URL, setApiKeyToObject, setSearchParams, toPathString, assertParamExists, 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/. */ /** * ChannelsApi - axios parameter creator * @export */ const ChannelsApiAxiosParamCreator = function (configuration) { return { /** * * @summary Get all channel features. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAllChannelFeatures: async (options = {}) => { const localVarPath = `/Channels/Features`; // 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 Get channel features. * @param {string} channelId Channel id. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getChannelFeatures: async (channelId, options = {}) => { // verify required parameter 'channelId' is not null or undefined assertParamExists('getChannelFeatures', 'channelId', channelId); const localVarPath = `/Channels/{channelId}/Features` .replace(`{${"channelId"}}`, encodeURIComponent(String(channelId))); // 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 Get channel items. * @param {string} channelId Channel Id. * @param {string} [folderId] Optional. Folder Id. * @param {string} [userId] Optional. User Id. * @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 {Array<SortOrder>} [sortOrder] Optional. Sort Order - Ascending,Descending. * @param {Array<ItemFilter>} [filters] Optional. Specify additional filters to apply. * @param {Array<ItemSortBy>} [sortBy] Optional. Specify one or more sort orders, comma delimited. Options: Album, AlbumArtist, Artist, Budget, CommunityRating, CriticRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Revenue, Runtime. * @param {Array<ItemFields>} [fields] Optional. Specify additional fields of information to return in the output. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getChannelItems: async (channelId, folderId, userId, startIndex, limit, sortOrder, filters, sortBy, fields, options = {}) => { // verify required parameter 'channelId' is not null or undefined assertParamExists('getChannelItems', 'channelId', channelId); const localVarPath = `/Channels/{channelId}/Items` .replace(`{${"channelId"}}`, encodeURIComponent(String(channelId))); // 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 (folderId !== undefined) { localVarQueryParameter['folderId'] = folderId; } if (userId !== undefined) { localVarQueryParameter['userId'] = userId; } if (startIndex !== undefined) { localVarQueryParameter['startIndex'] = startIndex; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (sortOrder) { localVarQueryParameter['sortOrder'] = sortOrder; } if (filters) { localVarQueryParameter['filters'] = filters; } if (sortBy) { localVarQueryParameter['sortBy'] = sortBy; } if (fields) { localVarQueryParameter['fields'] = fields; } 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 channels. * @param {string} [userId] User Id to filter by. Use System.Guid.Empty to not filter by user. * @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 {boolean} [supportsLatestItems] Optional. Filter by channels that support getting latest items. * @param {boolean} [supportsMediaDeletion] Optional. Filter by channels that support media deletion. * @param {boolean} [isFavorite] Optional. Filter by channels that are favorite. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getChannels: async (userId, startIndex, limit, supportsLatestItems, supportsMediaDeletion, isFavorite, options = {}) => { const localVarPath = `/Channels`; // 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 (startIndex !== undefined) { localVarQueryParameter['startIndex'] = startIndex; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (supportsLatestItems !== undefined) { localVarQueryParameter['supportsLatestItems'] = supportsLatestItems; } if (supportsMediaDeletion !== undefined) { localVarQueryParameter['supportsMediaDeletion'] = supportsMediaDeletion; } if (isFavorite !== undefined) { localVarQueryParameter['isFavorite'] = isFavorite; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Gets latest channel items. * @param {string} [userId] Optional. User Id. * @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 {Array<ItemFilter>} [filters] Optional. Specify additional filters to apply. * @param {Array<ItemFields>} [fields] Optional. Specify additional fields of information to return in the output. * @param {Array<string>} [channelIds] Optional. Specify one or more channel id\&#39;s, comma delimited. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLatestChannelItems: async (userId, startIndex, limit, filters, fields, channelIds, options = {}) => { const localVarPath = `/Channels/Items/Latest`; // 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 (startIndex !== undefined) { localVarQueryParameter['startIndex'] = startIndex; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (filters) { localVarQueryParameter['filters'] = filters; } if (fields) { localVarQueryParameter['fields'] = fields; } if (channelIds) { localVarQueryParameter['channelIds'] = channelIds; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * ChannelsApi - functional programming interface * @export */ const ChannelsApiFp = function (configuration) { const localVarAxiosParamCreator = ChannelsApiAxiosParamCreator(configuration); return { /** * * @summary Get all channel features. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAllChannelFeatures(options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getAllChannelFeatures(options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ChannelsApi.getAllChannelFeatures']) === 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 channel features. * @param {string} channelId Channel id. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getChannelFeatures(channelId, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getChannelFeatures(channelId, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ChannelsApi.getChannelFeatures']) === 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 channel items. * @param {string} channelId Channel Id. * @param {string} [folderId] Optional. Folder Id. * @param {string} [userId] Optional. User Id. * @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 {Array<SortOrder>} [sortOrder] Optional. Sort Order - Ascending,Descending. * @param {Array<ItemFilter>} [filters] Optional. Specify additional filters to apply. * @param {Array<ItemSortBy>} [sortBy] Optional. Specify one or more sort orders, comma delimited. Options: Album, AlbumArtist, Artist, Budget, CommunityRating, CriticRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Revenue, Runtime. * @param {Array<ItemFields>} [fields] Optional. Specify additional fields of information to return in the output. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getChannelItems(channelId, folderId, userId, startIndex, limit, sortOrder, filters, sortBy, fields, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getChannelItems(channelId, folderId, userId, startIndex, limit, sortOrder, filters, sortBy, fields, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ChannelsApi.getChannelItems']) === 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 channels. * @param {string} [userId] User Id to filter by. Use System.Guid.Empty to not filter by user. * @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 {boolean} [supportsLatestItems] Optional. Filter by channels that support getting latest items. * @param {boolean} [supportsMediaDeletion] Optional. Filter by channels that support media deletion. * @param {boolean} [isFavorite] Optional. Filter by channels that are favorite. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getChannels(userId, startIndex, limit, supportsLatestItems, supportsMediaDeletion, isFavorite, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getChannels(userId, startIndex, limit, supportsLatestItems, supportsMediaDeletion, isFavorite, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ChannelsApi.getChannels']) === 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 latest channel items. * @param {string} [userId] Optional. User Id. * @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 {Array<ItemFilter>} [filters] Optional. Specify additional filters to apply. * @param {Array<ItemFields>} [fields] Optional. Specify additional fields of information to return in the output. * @param {Array<string>} [channelIds] Optional. Specify one or more channel id\&#39;s, comma delimited. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getLatestChannelItems(userId, startIndex, limit, filters, fields, channelIds, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.getLatestChannelItems(userId, startIndex, limit, filters, fields, channelIds, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ChannelsApi.getLatestChannelItems']) === 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); }, }; }; /** * ChannelsApi - factory interface * @export */ const ChannelsApiFactory = function (configuration, basePath, axios) { const localVarFp = ChannelsApiFp(configuration); return { /** * * @summary Get all channel features. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAllChannelFeatures(options) { return localVarFp.getAllChannelFeatures(options).then((request) => request(axios, basePath)); }, /** * * @summary Get channel features. * @param {ChannelsApiGetChannelFeaturesRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getChannelFeatures(requestParameters, options) { return localVarFp.getChannelFeatures(requestParameters.channelId, options).then((request) => request(axios, basePath)); }, /** * * @summary Get channel items. * @param {ChannelsApiGetChannelItemsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getChannelItems(requestParameters, options) { return localVarFp.getChannelItems(requestParameters.channelId, requestParameters.folderId, requestParameters.userId, requestParameters.startIndex, requestParameters.limit, requestParameters.sortOrder, requestParameters.filters, requestParameters.sortBy, requestParameters.fields, options).then((request) => request(axios, basePath)); }, /** * * @summary Gets available channels. * @param {ChannelsApiGetChannelsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getChannels(requestParameters = {}, options) { return localVarFp.getChannels(requestParameters.userId, requestParameters.startIndex, requestParameters.limit, requestParameters.supportsLatestItems, requestParameters.supportsMediaDeletion, requestParameters.isFavorite, options).then((request) => request(axios, basePath)); }, /** * * @summary Gets latest channel items. * @param {ChannelsApiGetLatestChannelItemsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLatestChannelItems(requestParameters = {}, options) { return localVarFp.getLatestChannelItems(requestParameters.userId, requestParameters.startIndex, requestParameters.limit, requestParameters.filters, requestParameters.fields, requestParameters.channelIds, options).then((request) => request(axios, basePath)); }, }; }; /** * ChannelsApi - object-oriented interface * @export * @class ChannelsApi * @extends {BaseAPI} */ class ChannelsApi extends BaseAPI { /** * * @summary Get all channel features. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChannelsApi */ getAllChannelFeatures(options) { return ChannelsApiFp(this.configuration).getAllChannelFeatures(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get channel features. * @param {ChannelsApiGetChannelFeaturesRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChannelsApi */ getChannelFeatures(requestParameters, options) { return ChannelsApiFp(this.configuration).getChannelFeatures(requestParameters.channelId, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get channel items. * @param {ChannelsApiGetChannelItemsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChannelsApi */ getChannelItems(requestParameters, options) { return ChannelsApiFp(this.configuration).getChannelItems(requestParameters.channelId, requestParameters.folderId, requestParameters.userId, requestParameters.startIndex, requestParameters.limit, requestParameters.sortOrder, requestParameters.filters, requestParameters.sortBy, requestParameters.fields, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Gets available channels. * @param {ChannelsApiGetChannelsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChannelsApi */ getChannels(requestParameters = {}, options) { return ChannelsApiFp(this.configuration).getChannels(requestParameters.userId, requestParameters.startIndex, requestParameters.limit, requestParameters.supportsLatestItems, requestParameters.supportsMediaDeletion, requestParameters.isFavorite, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Gets latest channel items. * @param {ChannelsApiGetLatestChannelItemsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChannelsApi */ getLatestChannelItems(requestParameters = {}, options) { return ChannelsApiFp(this.configuration).getLatestChannelItems(requestParameters.userId, requestParameters.startIndex, requestParameters.limit, requestParameters.filters, requestParameters.fields, requestParameters.channelIds, options).then((request) => request(this.axios, this.basePath)); } } export { ChannelsApi, ChannelsApiAxiosParamCreator, ChannelsApiFactory, ChannelsApiFp };