@jellyfin/sdk
Version:
A TypeScript SDK for Jellyfin.
210 lines (207 loc) • 11.1 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/.
*/
/**
* TrickplayApi - axios parameter creator
* @export
*/
const TrickplayApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Gets an image tiles playlist for trickplay.
* @param {string} itemId The item id.
* @param {number} width The width of a single tile.
* @param {string} [mediaSourceId] The media version id, if using an alternate version.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getTrickplayHlsPlaylist: async (itemId, width, mediaSourceId, options = {}) => {
// verify required parameter 'itemId' is not null or undefined
assertParamExists('getTrickplayHlsPlaylist', 'itemId', itemId);
// verify required parameter 'width' is not null or undefined
assertParamExists('getTrickplayHlsPlaylist', 'width', width);
const localVarPath = `/Videos/{itemId}/Trickplay/{width}/tiles.m3u8`
.replace(`{${"itemId"}}`, encodeURIComponent(String(itemId)))
.replace(`{${"width"}}`, encodeURIComponent(String(width)));
// 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 (mediaSourceId !== undefined) {
localVarQueryParameter['mediaSourceId'] = mediaSourceId;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Gets a trickplay tile image.
* @param {string} itemId The item id.
* @param {number} width The width of a single tile.
* @param {number} index The index of the desired tile.
* @param {string} [mediaSourceId] The media version id, if using an alternate version.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getTrickplayTileImage: async (itemId, width, index, mediaSourceId, options = {}) => {
// verify required parameter 'itemId' is not null or undefined
assertParamExists('getTrickplayTileImage', 'itemId', itemId);
// verify required parameter 'width' is not null or undefined
assertParamExists('getTrickplayTileImage', 'width', width);
// verify required parameter 'index' is not null or undefined
assertParamExists('getTrickplayTileImage', 'index', index);
const localVarPath = `/Videos/{itemId}/Trickplay/{width}/{index}.jpg`
.replace(`{${"itemId"}}`, encodeURIComponent(String(itemId)))
.replace(`{${"width"}}`, encodeURIComponent(String(width)))
.replace(`{${"index"}}`, encodeURIComponent(String(index)));
// 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 (mediaSourceId !== undefined) {
localVarQueryParameter['mediaSourceId'] = mediaSourceId;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* TrickplayApi - functional programming interface
* @export
*/
const TrickplayApiFp = function (configuration) {
const localVarAxiosParamCreator = TrickplayApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Gets an image tiles playlist for trickplay.
* @param {string} itemId The item id.
* @param {number} width The width of a single tile.
* @param {string} [mediaSourceId] The media version id, if using an alternate version.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getTrickplayHlsPlaylist(itemId, width, mediaSourceId, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.getTrickplayHlsPlaylist(itemId, width, mediaSourceId, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['TrickplayApi.getTrickplayHlsPlaylist']) === 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 a trickplay tile image.
* @param {string} itemId The item id.
* @param {number} width The width of a single tile.
* @param {number} index The index of the desired tile.
* @param {string} [mediaSourceId] The media version id, if using an alternate version.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getTrickplayTileImage(itemId, width, index, mediaSourceId, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.getTrickplayTileImage(itemId, width, index, mediaSourceId, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['TrickplayApi.getTrickplayTileImage']) === 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);
},
};
};
/**
* TrickplayApi - factory interface
* @export
*/
const TrickplayApiFactory = function (configuration, basePath, axios) {
const localVarFp = TrickplayApiFp(configuration);
return {
/**
*
* @summary Gets an image tiles playlist for trickplay.
* @param {TrickplayApiGetTrickplayHlsPlaylistRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getTrickplayHlsPlaylist(requestParameters, options) {
return localVarFp.getTrickplayHlsPlaylist(requestParameters.itemId, requestParameters.width, requestParameters.mediaSourceId, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Gets a trickplay tile image.
* @param {TrickplayApiGetTrickplayTileImageRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getTrickplayTileImage(requestParameters, options) {
return localVarFp.getTrickplayTileImage(requestParameters.itemId, requestParameters.width, requestParameters.index, requestParameters.mediaSourceId, options).then((request) => request(axios, basePath));
},
};
};
/**
* TrickplayApi - object-oriented interface
* @export
* @class TrickplayApi
* @extends {BaseAPI}
*/
class TrickplayApi extends BaseAPI {
/**
*
* @summary Gets an image tiles playlist for trickplay.
* @param {TrickplayApiGetTrickplayHlsPlaylistRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof TrickplayApi
*/
getTrickplayHlsPlaylist(requestParameters, options) {
return TrickplayApiFp(this.configuration).getTrickplayHlsPlaylist(requestParameters.itemId, requestParameters.width, requestParameters.mediaSourceId, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Gets a trickplay tile image.
* @param {TrickplayApiGetTrickplayTileImageRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof TrickplayApi
*/
getTrickplayTileImage(requestParameters, options) {
return TrickplayApiFp(this.configuration).getTrickplayTileImage(requestParameters.itemId, requestParameters.width, requestParameters.index, requestParameters.mediaSourceId, options).then((request) => request(this.axios, this.basePath));
}
}
export { TrickplayApi, TrickplayApiAxiosParamCreator, TrickplayApiFactory, TrickplayApiFp };