@jellyfin/sdk
Version:
A TypeScript SDK for Jellyfin.
288 lines (285 loc) • 15.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/.
*/
/**
* RemoteImageApi - axios parameter creator
* @export
*/
const RemoteImageApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Downloads a remote image for an item.
* @param {string} itemId Item Id.
* @param {ImageType} type The image type.
* @param {string} [imageUrl] The image url.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
downloadRemoteImage: async (itemId, type, imageUrl, options = {}) => {
// verify required parameter 'itemId' is not null or undefined
assertParamExists('downloadRemoteImage', 'itemId', itemId);
// verify required parameter 'type' is not null or undefined
assertParamExists('downloadRemoteImage', 'type', type);
const localVarPath = `/Items/{itemId}/RemoteImages/Download`
.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 (type !== undefined) {
localVarQueryParameter['type'] = type;
}
if (imageUrl !== undefined) {
localVarQueryParameter['imageUrl'] = imageUrl;
}
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 remote image providers for an item.
* @param {string} itemId Item Id.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRemoteImageProviders: async (itemId, options = {}) => {
// verify required parameter 'itemId' is not null or undefined
assertParamExists('getRemoteImageProviders', 'itemId', itemId);
const localVarPath = `/Items/{itemId}/RemoteImages/Providers`
.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 Gets available remote images for an item.
* @param {string} itemId Item Id.
* @param {ImageType} [type] The image type.
* @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} [providerName] Optional. The image provider to use.
* @param {boolean} [includeAllLanguages] Optional. Include all languages.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRemoteImages: async (itemId, type, startIndex, limit, providerName, includeAllLanguages, options = {}) => {
// verify required parameter 'itemId' is not null or undefined
assertParamExists('getRemoteImages', 'itemId', itemId);
const localVarPath = `/Items/{itemId}/RemoteImages`
.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);
if (type !== undefined) {
localVarQueryParameter['type'] = type;
}
if (startIndex !== undefined) {
localVarQueryParameter['startIndex'] = startIndex;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (providerName !== undefined) {
localVarQueryParameter['providerName'] = providerName;
}
if (includeAllLanguages !== undefined) {
localVarQueryParameter['includeAllLanguages'] = includeAllLanguages;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* RemoteImageApi - functional programming interface
* @export
*/
const RemoteImageApiFp = function (configuration) {
const localVarAxiosParamCreator = RemoteImageApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Downloads a remote image for an item.
* @param {string} itemId Item Id.
* @param {ImageType} type The image type.
* @param {string} [imageUrl] The image url.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async downloadRemoteImage(itemId, type, imageUrl, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.downloadRemoteImage(itemId, type, imageUrl, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['RemoteImageApi.downloadRemoteImage']) === 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 remote image providers for an item.
* @param {string} itemId Item Id.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getRemoteImageProviders(itemId, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.getRemoteImageProviders(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['RemoteImageApi.getRemoteImageProviders']) === 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 remote images for an item.
* @param {string} itemId Item Id.
* @param {ImageType} [type] The image type.
* @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} [providerName] Optional. The image provider to use.
* @param {boolean} [includeAllLanguages] Optional. Include all languages.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getRemoteImages(itemId, type, startIndex, limit, providerName, includeAllLanguages, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.getRemoteImages(itemId, type, startIndex, limit, providerName, includeAllLanguages, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['RemoteImageApi.getRemoteImages']) === 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);
},
};
};
/**
* RemoteImageApi - factory interface
* @export
*/
const RemoteImageApiFactory = function (configuration, basePath, axios) {
const localVarFp = RemoteImageApiFp(configuration);
return {
/**
*
* @summary Downloads a remote image for an item.
* @param {RemoteImageApiDownloadRemoteImageRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
downloadRemoteImage(requestParameters, options) {
return localVarFp.downloadRemoteImage(requestParameters.itemId, requestParameters.type, requestParameters.imageUrl, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Gets available remote image providers for an item.
* @param {RemoteImageApiGetRemoteImageProvidersRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRemoteImageProviders(requestParameters, options) {
return localVarFp.getRemoteImageProviders(requestParameters.itemId, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Gets available remote images for an item.
* @param {RemoteImageApiGetRemoteImagesRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRemoteImages(requestParameters, options) {
return localVarFp.getRemoteImages(requestParameters.itemId, requestParameters.type, requestParameters.startIndex, requestParameters.limit, requestParameters.providerName, requestParameters.includeAllLanguages, options).then((request) => request(axios, basePath));
},
};
};
/**
* RemoteImageApi - object-oriented interface
* @export
* @class RemoteImageApi
* @extends {BaseAPI}
*/
class RemoteImageApi extends BaseAPI {
/**
*
* @summary Downloads a remote image for an item.
* @param {RemoteImageApiDownloadRemoteImageRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof RemoteImageApi
*/
downloadRemoteImage(requestParameters, options) {
return RemoteImageApiFp(this.configuration).downloadRemoteImage(requestParameters.itemId, requestParameters.type, requestParameters.imageUrl, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Gets available remote image providers for an item.
* @param {RemoteImageApiGetRemoteImageProvidersRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof RemoteImageApi
*/
getRemoteImageProviders(requestParameters, options) {
return RemoteImageApiFp(this.configuration).getRemoteImageProviders(requestParameters.itemId, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Gets available remote images for an item.
* @param {RemoteImageApiGetRemoteImagesRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof RemoteImageApi
*/
getRemoteImages(requestParameters, options) {
return RemoteImageApiFp(this.configuration).getRemoteImages(requestParameters.itemId, requestParameters.type, requestParameters.startIndex, requestParameters.limit, requestParameters.providerName, requestParameters.includeAllLanguages, options).then((request) => request(this.axios, this.basePath));
}
}
export { RemoteImageApi, RemoteImageApiAxiosParamCreator, RemoteImageApiFactory, RemoteImageApiFp };