@jellyfin/sdk
Version:
A TypeScript SDK for Jellyfin.
262 lines (259 loc) • 13.4 kB
JavaScript
import globalAxios from 'axios';
import { assertParamExists, DUMMY_BASE_URL, setApiKeyToObject, setSearchParams, toPathString, serializeDataIfNeeded, 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/.
*/
/**
* ItemUpdateApi - axios parameter creator
* @export
*/
const ItemUpdateApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Gets metadata editor info for an item.
* @param {string} itemId The item id.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMetadataEditorInfo: async (itemId, options = {}) => {
// verify required parameter 'itemId' is not null or undefined
assertParamExists('getMetadataEditorInfo', 'itemId', itemId);
const localVarPath = `/Items/{itemId}/MetadataEditor`
.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: '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 Updates an item.
* @param {string} itemId The item id.
* @param {BaseItemDto} baseItemDto The new item properties.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateItem: async (itemId, baseItemDto, options = {}) => {
// verify required parameter 'itemId' is not null or undefined
assertParamExists('updateItem', 'itemId', itemId);
// verify required parameter 'baseItemDto' is not null or undefined
assertParamExists('updateItem', 'baseItemDto', baseItemDto);
const localVarPath = `/Items/{itemId}`
.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);
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
localVarRequestOptions.data = serializeDataIfNeeded(baseItemDto, localVarRequestOptions, configuration);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Updates an item\'s content type.
* @param {string} itemId The item id.
* @param {string} [contentType] The content type of the item.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateItemContentType: async (itemId, contentType, options = {}) => {
// verify required parameter 'itemId' is not null or undefined
assertParamExists('updateItemContentType', 'itemId', itemId);
const localVarPath = `/Items/{itemId}/ContentType`
.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 (contentType !== undefined) {
localVarQueryParameter['contentType'] = contentType;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* ItemUpdateApi - functional programming interface
* @export
*/
const ItemUpdateApiFp = function (configuration) {
const localVarAxiosParamCreator = ItemUpdateApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Gets metadata editor info for an item.
* @param {string} itemId The item id.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getMetadataEditorInfo(itemId, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.getMetadataEditorInfo(itemId, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ItemUpdateApi.getMetadataEditorInfo']) === 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 Updates an item.
* @param {string} itemId The item id.
* @param {BaseItemDto} baseItemDto The new item properties.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async updateItem(itemId, baseItemDto, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.updateItem(itemId, baseItemDto, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ItemUpdateApi.updateItem']) === 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 Updates an item\'s content type.
* @param {string} itemId The item id.
* @param {string} [contentType] The content type of the item.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async updateItemContentType(itemId, contentType, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.updateItemContentType(itemId, contentType, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ItemUpdateApi.updateItemContentType']) === 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);
},
};
};
/**
* ItemUpdateApi - factory interface
* @export
*/
const ItemUpdateApiFactory = function (configuration, basePath, axios) {
const localVarFp = ItemUpdateApiFp(configuration);
return {
/**
*
* @summary Gets metadata editor info for an item.
* @param {ItemUpdateApiGetMetadataEditorInfoRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMetadataEditorInfo(requestParameters, options) {
return localVarFp.getMetadataEditorInfo(requestParameters.itemId, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Updates an item.
* @param {ItemUpdateApiUpdateItemRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateItem(requestParameters, options) {
return localVarFp.updateItem(requestParameters.itemId, requestParameters.baseItemDto, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Updates an item\'s content type.
* @param {ItemUpdateApiUpdateItemContentTypeRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateItemContentType(requestParameters, options) {
return localVarFp.updateItemContentType(requestParameters.itemId, requestParameters.contentType, options).then((request) => request(axios, basePath));
},
};
};
/**
* ItemUpdateApi - object-oriented interface
* @export
* @class ItemUpdateApi
* @extends {BaseAPI}
*/
class ItemUpdateApi extends BaseAPI {
/**
*
* @summary Gets metadata editor info for an item.
* @param {ItemUpdateApiGetMetadataEditorInfoRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ItemUpdateApi
*/
getMetadataEditorInfo(requestParameters, options) {
return ItemUpdateApiFp(this.configuration).getMetadataEditorInfo(requestParameters.itemId, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Updates an item.
* @param {ItemUpdateApiUpdateItemRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ItemUpdateApi
*/
updateItem(requestParameters, options) {
return ItemUpdateApiFp(this.configuration).updateItem(requestParameters.itemId, requestParameters.baseItemDto, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Updates an item\'s content type.
* @param {ItemUpdateApiUpdateItemContentTypeRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ItemUpdateApi
*/
updateItemContentType(requestParameters, options) {
return ItemUpdateApiFp(this.configuration).updateItemContentType(requestParameters.itemId, requestParameters.contentType, options).then((request) => request(this.axios, this.basePath));
}
}
export { ItemUpdateApi, ItemUpdateApiAxiosParamCreator, ItemUpdateApiFactory, ItemUpdateApiFp };