jellyfin-discord-bot/server/jellyfin/apis/MediaInfoApi.ts

372 lines
14 KiB
TypeScript
Raw Permalink Normal View History

2023-05-04 23:34:53 +02:00
/* tslint:disable */
/* eslint-disable */
/**
* Jellyfin API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 10.8.9
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
GetPostedPlaybackInfoRequest,
LiveStreamResponse,
OpenLiveStreamRequest,
PlaybackInfoResponse,
} from '../models';
import {
GetPostedPlaybackInfoRequestFromJSON,
GetPostedPlaybackInfoRequestToJSON,
LiveStreamResponseFromJSON,
LiveStreamResponseToJSON,
OpenLiveStreamRequestFromJSON,
OpenLiveStreamRequestToJSON,
PlaybackInfoResponseFromJSON,
PlaybackInfoResponseToJSON,
} from '../models';
export interface CloseLiveStreamRequest {
liveStreamId: string;
}
export interface GetBitrateTestBytesRequest {
size?: number;
}
export interface GetPlaybackInfoRequest {
itemId: string;
userId: string;
}
export interface GetPostedPlaybackInfoOperationRequest {
itemId: string;
userId?: string;
maxStreamingBitrate?: number;
startTimeTicks?: number;
audioStreamIndex?: number;
subtitleStreamIndex?: number;
maxAudioChannels?: number;
mediaSourceId?: string;
liveStreamId?: string;
autoOpenLiveStream?: boolean;
enableDirectPlay?: boolean;
enableDirectStream?: boolean;
enableTranscoding?: boolean;
allowVideoStreamCopy?: boolean;
allowAudioStreamCopy?: boolean;
getPostedPlaybackInfoRequest?: GetPostedPlaybackInfoRequest;
}
export interface OpenLiveStreamOperationRequest {
openToken?: string;
userId?: string;
playSessionId?: string;
maxStreamingBitrate?: number;
startTimeTicks?: number;
audioStreamIndex?: number;
subtitleStreamIndex?: number;
maxAudioChannels?: number;
itemId?: string;
enableDirectPlay?: boolean;
enableDirectStream?: boolean;
openLiveStreamRequest?: OpenLiveStreamRequest;
}
/**
*
*/
export class MediaInfoApi extends runtime.BaseAPI {
/**
* Closes a media source.
*/
async closeLiveStreamRaw(requestParameters: CloseLiveStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.liveStreamId === null || requestParameters.liveStreamId === undefined) {
throw new runtime.RequiredError('liveStreamId','Required parameter requestParameters.liveStreamId was null or undefined when calling closeLiveStream.');
}
const queryParameters: any = {};
if (requestParameters.liveStreamId !== undefined) {
queryParameters['liveStreamId'] = requestParameters.liveStreamId;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/LiveStreams/Close`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Closes a media source.
*/
async closeLiveStream(requestParameters: CloseLiveStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.closeLiveStreamRaw(requestParameters, initOverrides);
}
/**
* Tests the network with a request with the size of the bitrate.
*/
async getBitrateTestBytesRaw(requestParameters: GetBitrateTestBytesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>> {
const queryParameters: any = {};
if (requestParameters.size !== undefined) {
queryParameters['size'] = requestParameters.size;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Playback/BitrateTest`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.BlobApiResponse(response);
}
/**
* Tests the network with a request with the size of the bitrate.
*/
async getBitrateTestBytes(requestParameters: GetBitrateTestBytesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
const response = await this.getBitrateTestBytesRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Gets live playback media info for an item.
*/
async getPlaybackInfoRaw(requestParameters: GetPlaybackInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PlaybackInfoResponse>> {
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getPlaybackInfo.');
}
if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getPlaybackInfo.');
}
const queryParameters: any = {};
if (requestParameters.userId !== undefined) {
queryParameters['userId'] = requestParameters.userId;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Items/{itemId}/PlaybackInfo`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => PlaybackInfoResponseFromJSON(jsonValue));
}
/**
* Gets live playback media info for an item.
*/
async getPlaybackInfo(requestParameters: GetPlaybackInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PlaybackInfoResponse> {
const response = await this.getPlaybackInfoRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* For backwards compatibility parameters can be sent via Query or Body, with Query having higher precedence. Query parameters are obsolete.
* Gets live playback media info for an item.
*/
async getPostedPlaybackInfoRaw(requestParameters: GetPostedPlaybackInfoOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PlaybackInfoResponse>> {
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getPostedPlaybackInfo.');
}
const queryParameters: any = {};
if (requestParameters.userId !== undefined) {
queryParameters['userId'] = requestParameters.userId;
}
if (requestParameters.maxStreamingBitrate !== undefined) {
queryParameters['maxStreamingBitrate'] = requestParameters.maxStreamingBitrate;
}
if (requestParameters.startTimeTicks !== undefined) {
queryParameters['startTimeTicks'] = requestParameters.startTimeTicks;
}
if (requestParameters.audioStreamIndex !== undefined) {
queryParameters['audioStreamIndex'] = requestParameters.audioStreamIndex;
}
if (requestParameters.subtitleStreamIndex !== undefined) {
queryParameters['subtitleStreamIndex'] = requestParameters.subtitleStreamIndex;
}
if (requestParameters.maxAudioChannels !== undefined) {
queryParameters['maxAudioChannels'] = requestParameters.maxAudioChannels;
}
if (requestParameters.mediaSourceId !== undefined) {
queryParameters['mediaSourceId'] = requestParameters.mediaSourceId;
}
if (requestParameters.liveStreamId !== undefined) {
queryParameters['liveStreamId'] = requestParameters.liveStreamId;
}
if (requestParameters.autoOpenLiveStream !== undefined) {
queryParameters['autoOpenLiveStream'] = requestParameters.autoOpenLiveStream;
}
if (requestParameters.enableDirectPlay !== undefined) {
queryParameters['enableDirectPlay'] = requestParameters.enableDirectPlay;
}
if (requestParameters.enableDirectStream !== undefined) {
queryParameters['enableDirectStream'] = requestParameters.enableDirectStream;
}
if (requestParameters.enableTranscoding !== undefined) {
queryParameters['enableTranscoding'] = requestParameters.enableTranscoding;
}
if (requestParameters.allowVideoStreamCopy !== undefined) {
queryParameters['allowVideoStreamCopy'] = requestParameters.allowVideoStreamCopy;
}
if (requestParameters.allowAudioStreamCopy !== undefined) {
queryParameters['allowAudioStreamCopy'] = requestParameters.allowAudioStreamCopy;
}
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Items/{itemId}/PlaybackInfo`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: GetPostedPlaybackInfoRequestToJSON(requestParameters.getPostedPlaybackInfoRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => PlaybackInfoResponseFromJSON(jsonValue));
}
/**
* For backwards compatibility parameters can be sent via Query or Body, with Query having higher precedence. Query parameters are obsolete.
* Gets live playback media info for an item.
*/
async getPostedPlaybackInfo(requestParameters: GetPostedPlaybackInfoOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PlaybackInfoResponse> {
const response = await this.getPostedPlaybackInfoRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Opens a media source.
*/
async openLiveStreamRaw(requestParameters: OpenLiveStreamOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LiveStreamResponse>> {
const queryParameters: any = {};
if (requestParameters.openToken !== undefined) {
queryParameters['openToken'] = requestParameters.openToken;
}
if (requestParameters.userId !== undefined) {
queryParameters['userId'] = requestParameters.userId;
}
if (requestParameters.playSessionId !== undefined) {
queryParameters['playSessionId'] = requestParameters.playSessionId;
}
if (requestParameters.maxStreamingBitrate !== undefined) {
queryParameters['maxStreamingBitrate'] = requestParameters.maxStreamingBitrate;
}
if (requestParameters.startTimeTicks !== undefined) {
queryParameters['startTimeTicks'] = requestParameters.startTimeTicks;
}
if (requestParameters.audioStreamIndex !== undefined) {
queryParameters['audioStreamIndex'] = requestParameters.audioStreamIndex;
}
if (requestParameters.subtitleStreamIndex !== undefined) {
queryParameters['subtitleStreamIndex'] = requestParameters.subtitleStreamIndex;
}
if (requestParameters.maxAudioChannels !== undefined) {
queryParameters['maxAudioChannels'] = requestParameters.maxAudioChannels;
}
if (requestParameters.itemId !== undefined) {
queryParameters['itemId'] = requestParameters.itemId;
}
if (requestParameters.enableDirectPlay !== undefined) {
queryParameters['enableDirectPlay'] = requestParameters.enableDirectPlay;
}
if (requestParameters.enableDirectStream !== undefined) {
queryParameters['enableDirectStream'] = requestParameters.enableDirectStream;
}
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/LiveStreams/Open`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: OpenLiveStreamRequestToJSON(requestParameters.openLiveStreamRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => LiveStreamResponseFromJSON(jsonValue));
}
/**
* Opens a media source.
*/
async openLiveStream(requestParameters: OpenLiveStreamOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiveStreamResponse> {
const response = await this.openLiveStreamRaw(requestParameters, initOverrides);
return await response.value();
}
}