UNPKG

@jellyfin/sdk

Version:
139 lines (136 loc) 7.19 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/. */ /** * ItemRefreshApi - axios parameter creator * @export */ const ItemRefreshApiAxiosParamCreator = function (configuration) { return { /** * * @summary Refreshes metadata for an item. * @param {string} itemId Item id. * @param {MetadataRefreshMode} [metadataRefreshMode] (Optional) Specifies the metadata refresh mode. * @param {MetadataRefreshMode} [imageRefreshMode] (Optional) Specifies the image refresh mode. * @param {boolean} [replaceAllMetadata] (Optional) Determines if metadata should be replaced. Only applicable if mode is FullRefresh. * @param {boolean} [replaceAllImages] (Optional) Determines if images should be replaced. Only applicable if mode is FullRefresh. * @param {*} [options] Override http request option. * @throws {RequiredError} */ refreshItem: async (itemId, metadataRefreshMode, imageRefreshMode, replaceAllMetadata, replaceAllImages, options = {}) => { // verify required parameter 'itemId' is not null or undefined assertParamExists('refreshItem', 'itemId', itemId); const localVarPath = `/Items/{itemId}/Refresh` .replace(`{${"itemId"}}`, encodeURIComponent(String(itemId))); // 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: 'POST', ...baseOptions, ...options }; const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication CustomAuthentication required await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration); if (metadataRefreshMode !== undefined) { localVarQueryParameter['metadataRefreshMode'] = metadataRefreshMode; } if (imageRefreshMode !== undefined) { localVarQueryParameter['imageRefreshMode'] = imageRefreshMode; } if (replaceAllMetadata !== undefined) { localVarQueryParameter['replaceAllMetadata'] = replaceAllMetadata; } if (replaceAllImages !== undefined) { localVarQueryParameter['replaceAllImages'] = replaceAllImages; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * ItemRefreshApi - functional programming interface * @export */ const ItemRefreshApiFp = function (configuration) { const localVarAxiosParamCreator = ItemRefreshApiAxiosParamCreator(configuration); return { /** * * @summary Refreshes metadata for an item. * @param {string} itemId Item id. * @param {MetadataRefreshMode} [metadataRefreshMode] (Optional) Specifies the metadata refresh mode. * @param {MetadataRefreshMode} [imageRefreshMode] (Optional) Specifies the image refresh mode. * @param {boolean} [replaceAllMetadata] (Optional) Determines if metadata should be replaced. Only applicable if mode is FullRefresh. * @param {boolean} [replaceAllImages] (Optional) Determines if images should be replaced. Only applicable if mode is FullRefresh. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async refreshItem(itemId, metadataRefreshMode, imageRefreshMode, replaceAllMetadata, replaceAllImages, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.refreshItem(itemId, metadataRefreshMode, imageRefreshMode, replaceAllMetadata, replaceAllImages, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ItemRefreshApi.refreshItem']) === 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); }, }; }; /** * ItemRefreshApi - factory interface * @export */ const ItemRefreshApiFactory = function (configuration, basePath, axios) { const localVarFp = ItemRefreshApiFp(configuration); return { /** * * @summary Refreshes metadata for an item. * @param {ItemRefreshApiRefreshItemRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ refreshItem(requestParameters, options) { return localVarFp.refreshItem(requestParameters.itemId, requestParameters.metadataRefreshMode, requestParameters.imageRefreshMode, requestParameters.replaceAllMetadata, requestParameters.replaceAllImages, options).then((request) => request(axios, basePath)); }, }; }; /** * ItemRefreshApi - object-oriented interface * @export * @class ItemRefreshApi * @extends {BaseAPI} */ class ItemRefreshApi extends BaseAPI { /** * * @summary Refreshes metadata for an item. * @param {ItemRefreshApiRefreshItemRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ItemRefreshApi */ refreshItem(requestParameters, options) { return ItemRefreshApiFp(this.configuration).refreshItem(requestParameters.itemId, requestParameters.metadataRefreshMode, requestParameters.imageRefreshMode, requestParameters.replaceAllMetadata, requestParameters.replaceAllImages, options).then((request) => request(this.axios, this.basePath)); } } export { ItemRefreshApi, ItemRefreshApiAxiosParamCreator, ItemRefreshApiFactory, ItemRefreshApiFp };