@jellyfin/sdk
Version:
A TypeScript SDK for Jellyfin.
127 lines (124 loc) • 5.9 kB
JavaScript
import globalAxios from 'axios';
import { assertParamExists, DUMMY_BASE_URL, 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/.
*/
/**
* VideoAttachmentsApi - axios parameter creator
* @export
*/
const VideoAttachmentsApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Get video attachment.
* @param {string} videoId Video ID.
* @param {string} mediaSourceId Media Source ID.
* @param {number} index Attachment Index.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAttachment: async (videoId, mediaSourceId, index, options = {}) => {
// verify required parameter 'videoId' is not null or undefined
assertParamExists('getAttachment', 'videoId', videoId);
// verify required parameter 'mediaSourceId' is not null or undefined
assertParamExists('getAttachment', 'mediaSourceId', mediaSourceId);
// verify required parameter 'index' is not null or undefined
assertParamExists('getAttachment', 'index', index);
const localVarPath = `/Videos/{videoId}/{mediaSourceId}/Attachments/{index}`
.replace(`{${"videoId"}}`, encodeURIComponent(String(videoId)))
.replace(`{${"mediaSourceId"}}`, encodeURIComponent(String(mediaSourceId)))
.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 = {};
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* VideoAttachmentsApi - functional programming interface
* @export
*/
const VideoAttachmentsApiFp = function (configuration) {
const localVarAxiosParamCreator = VideoAttachmentsApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Get video attachment.
* @param {string} videoId Video ID.
* @param {string} mediaSourceId Media Source ID.
* @param {number} index Attachment Index.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getAttachment(videoId, mediaSourceId, index, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.getAttachment(videoId, mediaSourceId, index, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['VideoAttachmentsApi.getAttachment']) === 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);
},
};
};
/**
* VideoAttachmentsApi - factory interface
* @export
*/
const VideoAttachmentsApiFactory = function (configuration, basePath, axios) {
const localVarFp = VideoAttachmentsApiFp(configuration);
return {
/**
*
* @summary Get video attachment.
* @param {VideoAttachmentsApiGetAttachmentRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAttachment(requestParameters, options) {
return localVarFp.getAttachment(requestParameters.videoId, requestParameters.mediaSourceId, requestParameters.index, options).then((request) => request(axios, basePath));
},
};
};
/**
* VideoAttachmentsApi - object-oriented interface
* @export
* @class VideoAttachmentsApi
* @extends {BaseAPI}
*/
class VideoAttachmentsApi extends BaseAPI {
/**
*
* @summary Get video attachment.
* @param {VideoAttachmentsApiGetAttachmentRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof VideoAttachmentsApi
*/
getAttachment(requestParameters, options) {
return VideoAttachmentsApiFp(this.configuration).getAttachment(requestParameters.videoId, requestParameters.mediaSourceId, requestParameters.index, options).then((request) => request(this.axios, this.basePath));
}
}
export { VideoAttachmentsApi, VideoAttachmentsApiAxiosParamCreator, VideoAttachmentsApiFactory, VideoAttachmentsApiFp };