@jellyfin/sdk
Version:
A TypeScript SDK for Jellyfin.
270 lines (267 loc) • 16.4 kB
JavaScript
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/.
*/
/**
* StudiosApi - axios parameter creator
* @export
*/
const StudiosApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Gets a studio by name.
* @param {string} name Studio name.
* @param {string} [userId] Optional. Filter by user id, and attach user data.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getStudio: async (name, userId, options = {}) => {
// verify required parameter 'name' is not null or undefined
assertParamExists('getStudio', 'name', name);
const localVarPath = `/Studios/{name}`
.replace(`{${"name"}}`, encodeURIComponent(String(name)));
// 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 studios 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] Optional. 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 based on item type. This allows multiple, comma delimited.
* @param {boolean} [isFavorite] Optional filter by items that are marked as favorite, or not.
* @param {boolean} [enableUserData] Optional, include user data.
* @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 {boolean} [enableImages] Optional, include image information in output.
* @param {boolean} [enableTotalRecordCount] Total record count.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getStudios: async (startIndex, limit, searchTerm, parentId, fields, excludeItemTypes, includeItemTypes, isFavorite, enableUserData, imageTypeLimit, enableImageTypes, userId, nameStartsWithOrGreater, nameStartsWith, nameLessThan, enableImages, enableTotalRecordCount, options = {}) => {
const localVarPath = `/Studios`;
// 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 (enableUserData !== undefined) {
localVarQueryParameter['enableUserData'] = enableUserData;
}
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 (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,
};
},
};
};
/**
* StudiosApi - functional programming interface
* @export
*/
const StudiosApiFp = function (configuration) {
const localVarAxiosParamCreator = StudiosApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Gets a studio by name.
* @param {string} name Studio name.
* @param {string} [userId] Optional. Filter by user id, and attach user data.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getStudio(name, userId, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.getStudio(name, 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['StudiosApi.getStudio']) === 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 studios 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] Optional. 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 based on item type. This allows multiple, comma delimited.
* @param {boolean} [isFavorite] Optional filter by items that are marked as favorite, or not.
* @param {boolean} [enableUserData] Optional, include user data.
* @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 {boolean} [enableImages] Optional, include image information in output.
* @param {boolean} [enableTotalRecordCount] Total record count.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getStudios(startIndex, limit, searchTerm, parentId, fields, excludeItemTypes, includeItemTypes, isFavorite, enableUserData, imageTypeLimit, enableImageTypes, userId, nameStartsWithOrGreater, nameStartsWith, nameLessThan, enableImages, enableTotalRecordCount, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.getStudios(startIndex, limit, searchTerm, parentId, fields, excludeItemTypes, includeItemTypes, isFavorite, enableUserData, imageTypeLimit, enableImageTypes, userId, nameStartsWithOrGreater, nameStartsWith, nameLessThan, 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['StudiosApi.getStudios']) === 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);
},
};
};
/**
* StudiosApi - factory interface
* @export
*/
const StudiosApiFactory = function (configuration, basePath, axios) {
const localVarFp = StudiosApiFp(configuration);
return {
/**
*
* @summary Gets a studio by name.
* @param {StudiosApiGetStudioRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getStudio(requestParameters, options) {
return localVarFp.getStudio(requestParameters.name, requestParameters.userId, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Gets all studios from a given item, folder, or the entire library.
* @param {StudiosApiGetStudiosRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getStudios(requestParameters = {}, options) {
return localVarFp.getStudios(requestParameters.startIndex, requestParameters.limit, requestParameters.searchTerm, requestParameters.parentId, requestParameters.fields, requestParameters.excludeItemTypes, requestParameters.includeItemTypes, requestParameters.isFavorite, requestParameters.enableUserData, requestParameters.imageTypeLimit, requestParameters.enableImageTypes, requestParameters.userId, requestParameters.nameStartsWithOrGreater, requestParameters.nameStartsWith, requestParameters.nameLessThan, requestParameters.enableImages, requestParameters.enableTotalRecordCount, options).then((request) => request(axios, basePath));
},
};
};
/**
* StudiosApi - object-oriented interface
* @export
* @class StudiosApi
* @extends {BaseAPI}
*/
class StudiosApi extends BaseAPI {
/**
*
* @summary Gets a studio by name.
* @param {StudiosApiGetStudioRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof StudiosApi
*/
getStudio(requestParameters, options) {
return StudiosApiFp(this.configuration).getStudio(requestParameters.name, requestParameters.userId, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Gets all studios from a given item, folder, or the entire library.
* @param {StudiosApiGetStudiosRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof StudiosApi
*/
getStudios(requestParameters = {}, options) {
return StudiosApiFp(this.configuration).getStudios(requestParameters.startIndex, requestParameters.limit, requestParameters.searchTerm, requestParameters.parentId, requestParameters.fields, requestParameters.excludeItemTypes, requestParameters.includeItemTypes, requestParameters.isFavorite, requestParameters.enableUserData, requestParameters.imageTypeLimit, requestParameters.enableImageTypes, requestParameters.userId, requestParameters.nameStartsWithOrGreater, requestParameters.nameStartsWith, requestParameters.nameLessThan, requestParameters.enableImages, requestParameters.enableTotalRecordCount, options).then((request) => request(this.axios, this.basePath));
}
}
export { StudiosApi, StudiosApiAxiosParamCreator, StudiosApiFactory, StudiosApiFp };