jellyfin-discord-bot/jellyfin/api/universalAudioApi.ts

406 lines
18 KiB
TypeScript

/**
* 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 localVarRequest from 'request';
import http from 'http';
/* tslint:disable:no-unused-locals */
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
import { HttpError, RequestFile } from './apis';
let defaultBasePath = 'http://localhost';
// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================
export enum UniversalAudioApiApiKeys {
CustomAuthentication,
}
export class UniversalAudioApi {
protected _basePath = defaultBasePath;
protected _defaultHeaders : any = {};
protected _useQuerystring : boolean = false;
protected authentications = {
'default': <Authentication>new VoidAuth(),
'CustomAuthentication': new ApiKeyAuth('header', 'Authorization'),
}
protected interceptors: Interceptor[] = [];
constructor(basePath?: string);
constructor(basePathOrUsername: string, password?: string, basePath?: string) {
if (password) {
if (basePath) {
this.basePath = basePath;
}
} else {
if (basePathOrUsername) {
this.basePath = basePathOrUsername
}
}
}
set useQuerystring(value: boolean) {
this._useQuerystring = value;
}
set basePath(basePath: string) {
this._basePath = basePath;
}
set defaultHeaders(defaultHeaders: any) {
this._defaultHeaders = defaultHeaders;
}
get defaultHeaders() {
return this._defaultHeaders;
}
get basePath() {
return this._basePath;
}
public setDefaultAuthentication(auth: Authentication) {
this.authentications.default = auth;
}
public setApiKey(key: UniversalAudioApiApiKeys, value: string) {
(this.authentications as any)[UniversalAudioApiApiKeys[key]].apiKey = value;
}
public addInterceptor(interceptor: Interceptor) {
this.interceptors.push(interceptor);
}
/**
*
* @summary Gets an audio stream.
* @param itemId The item id.
* @param container Optional. The audio container.
* @param mediaSourceId The media version id, if playing an alternate version.
* @param deviceId The device id of the client requesting. Used to stop encoding processes when needed.
* @param userId Optional. The user id.
* @param audioCodec Optional. The audio codec to transcode to.
* @param maxAudioChannels Optional. The maximum number of audio channels.
* @param transcodingAudioChannels Optional. The number of how many audio channels to transcode to.
* @param maxStreamingBitrate Optional. The maximum streaming bitrate.
* @param audioBitRate Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.
* @param startTimeTicks Optional. Specify a starting offset, in ticks. 1 tick &#x3D; 10000 ms.
* @param transcodingContainer Optional. The container to transcode to.
* @param transcodingProtocol Optional. The transcoding protocol.
* @param maxAudioSampleRate Optional. The maximum audio sample rate.
* @param maxAudioBitDepth Optional. The maximum audio bit depth.
* @param enableRemoteMedia Optional. Whether to enable remote media.
* @param breakOnNonKeyFrames Optional. Whether to break on non key frames.
* @param enableRedirection Whether to enable redirection. Defaults to true.
*/
public async getUniversalAudioStream (itemId: string, container?: Array<string>, mediaSourceId?: string, deviceId?: string, userId?: string, audioCodec?: string, maxAudioChannels?: number, transcodingAudioChannels?: number, maxStreamingBitrate?: number, audioBitRate?: number, startTimeTicks?: number, transcodingContainer?: string, transcodingProtocol?: string, maxAudioSampleRate?: number, maxAudioBitDepth?: number, enableRemoteMedia?: boolean, breakOnNonKeyFrames?: boolean, enableRedirection?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Buffer; }> {
const localVarPath = this.basePath + '/Audio/{itemId}/universal'
.replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['audio/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'itemId' is not null or undefined
if (itemId === null || itemId === undefined) {
throw new Error('Required parameter itemId was null or undefined when calling getUniversalAudioStream.');
}
if (container !== undefined) {
localVarQueryParameters['container'] = ObjectSerializer.serialize(container, "Array<string>");
}
if (mediaSourceId !== undefined) {
localVarQueryParameters['mediaSourceId'] = ObjectSerializer.serialize(mediaSourceId, "string");
}
if (deviceId !== undefined) {
localVarQueryParameters['deviceId'] = ObjectSerializer.serialize(deviceId, "string");
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (audioCodec !== undefined) {
localVarQueryParameters['audioCodec'] = ObjectSerializer.serialize(audioCodec, "string");
}
if (maxAudioChannels !== undefined) {
localVarQueryParameters['maxAudioChannels'] = ObjectSerializer.serialize(maxAudioChannels, "number");
}
if (transcodingAudioChannels !== undefined) {
localVarQueryParameters['transcodingAudioChannels'] = ObjectSerializer.serialize(transcodingAudioChannels, "number");
}
if (maxStreamingBitrate !== undefined) {
localVarQueryParameters['maxStreamingBitrate'] = ObjectSerializer.serialize(maxStreamingBitrate, "number");
}
if (audioBitRate !== undefined) {
localVarQueryParameters['audioBitRate'] = ObjectSerializer.serialize(audioBitRate, "number");
}
if (startTimeTicks !== undefined) {
localVarQueryParameters['startTimeTicks'] = ObjectSerializer.serialize(startTimeTicks, "number");
}
if (transcodingContainer !== undefined) {
localVarQueryParameters['transcodingContainer'] = ObjectSerializer.serialize(transcodingContainer, "string");
}
if (transcodingProtocol !== undefined) {
localVarQueryParameters['transcodingProtocol'] = ObjectSerializer.serialize(transcodingProtocol, "string");
}
if (maxAudioSampleRate !== undefined) {
localVarQueryParameters['maxAudioSampleRate'] = ObjectSerializer.serialize(maxAudioSampleRate, "number");
}
if (maxAudioBitDepth !== undefined) {
localVarQueryParameters['maxAudioBitDepth'] = ObjectSerializer.serialize(maxAudioBitDepth, "number");
}
if (enableRemoteMedia !== undefined) {
localVarQueryParameters['enableRemoteMedia'] = ObjectSerializer.serialize(enableRemoteMedia, "boolean");
}
if (breakOnNonKeyFrames !== undefined) {
localVarQueryParameters['breakOnNonKeyFrames'] = ObjectSerializer.serialize(breakOnNonKeyFrames, "boolean");
}
if (enableRedirection !== undefined) {
localVarQueryParameters['enableRedirection'] = ObjectSerializer.serialize(enableRedirection, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
encoding: null,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.CustomAuthentication.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.CustomAuthentication.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Buffer; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Buffer");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @summary Gets an audio stream.
* @param itemId The item id.
* @param container Optional. The audio container.
* @param mediaSourceId The media version id, if playing an alternate version.
* @param deviceId The device id of the client requesting. Used to stop encoding processes when needed.
* @param userId Optional. The user id.
* @param audioCodec Optional. The audio codec to transcode to.
* @param maxAudioChannels Optional. The maximum number of audio channels.
* @param transcodingAudioChannels Optional. The number of how many audio channels to transcode to.
* @param maxStreamingBitrate Optional. The maximum streaming bitrate.
* @param audioBitRate Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.
* @param startTimeTicks Optional. Specify a starting offset, in ticks. 1 tick &#x3D; 10000 ms.
* @param transcodingContainer Optional. The container to transcode to.
* @param transcodingProtocol Optional. The transcoding protocol.
* @param maxAudioSampleRate Optional. The maximum audio sample rate.
* @param maxAudioBitDepth Optional. The maximum audio bit depth.
* @param enableRemoteMedia Optional. Whether to enable remote media.
* @param breakOnNonKeyFrames Optional. Whether to break on non key frames.
* @param enableRedirection Whether to enable redirection. Defaults to true.
*/
public async headUniversalAudioStream (itemId: string, container?: Array<string>, mediaSourceId?: string, deviceId?: string, userId?: string, audioCodec?: string, maxAudioChannels?: number, transcodingAudioChannels?: number, maxStreamingBitrate?: number, audioBitRate?: number, startTimeTicks?: number, transcodingContainer?: string, transcodingProtocol?: string, maxAudioSampleRate?: number, maxAudioBitDepth?: number, enableRemoteMedia?: boolean, breakOnNonKeyFrames?: boolean, enableRedirection?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Buffer; }> {
const localVarPath = this.basePath + '/Audio/{itemId}/universal'
.replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['audio/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'itemId' is not null or undefined
if (itemId === null || itemId === undefined) {
throw new Error('Required parameter itemId was null or undefined when calling headUniversalAudioStream.');
}
if (container !== undefined) {
localVarQueryParameters['container'] = ObjectSerializer.serialize(container, "Array<string>");
}
if (mediaSourceId !== undefined) {
localVarQueryParameters['mediaSourceId'] = ObjectSerializer.serialize(mediaSourceId, "string");
}
if (deviceId !== undefined) {
localVarQueryParameters['deviceId'] = ObjectSerializer.serialize(deviceId, "string");
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (audioCodec !== undefined) {
localVarQueryParameters['audioCodec'] = ObjectSerializer.serialize(audioCodec, "string");
}
if (maxAudioChannels !== undefined) {
localVarQueryParameters['maxAudioChannels'] = ObjectSerializer.serialize(maxAudioChannels, "number");
}
if (transcodingAudioChannels !== undefined) {
localVarQueryParameters['transcodingAudioChannels'] = ObjectSerializer.serialize(transcodingAudioChannels, "number");
}
if (maxStreamingBitrate !== undefined) {
localVarQueryParameters['maxStreamingBitrate'] = ObjectSerializer.serialize(maxStreamingBitrate, "number");
}
if (audioBitRate !== undefined) {
localVarQueryParameters['audioBitRate'] = ObjectSerializer.serialize(audioBitRate, "number");
}
if (startTimeTicks !== undefined) {
localVarQueryParameters['startTimeTicks'] = ObjectSerializer.serialize(startTimeTicks, "number");
}
if (transcodingContainer !== undefined) {
localVarQueryParameters['transcodingContainer'] = ObjectSerializer.serialize(transcodingContainer, "string");
}
if (transcodingProtocol !== undefined) {
localVarQueryParameters['transcodingProtocol'] = ObjectSerializer.serialize(transcodingProtocol, "string");
}
if (maxAudioSampleRate !== undefined) {
localVarQueryParameters['maxAudioSampleRate'] = ObjectSerializer.serialize(maxAudioSampleRate, "number");
}
if (maxAudioBitDepth !== undefined) {
localVarQueryParameters['maxAudioBitDepth'] = ObjectSerializer.serialize(maxAudioBitDepth, "number");
}
if (enableRemoteMedia !== undefined) {
localVarQueryParameters['enableRemoteMedia'] = ObjectSerializer.serialize(enableRemoteMedia, "boolean");
}
if (breakOnNonKeyFrames !== undefined) {
localVarQueryParameters['breakOnNonKeyFrames'] = ObjectSerializer.serialize(breakOnNonKeyFrames, "boolean");
}
if (enableRedirection !== undefined) {
localVarQueryParameters['enableRedirection'] = ObjectSerializer.serialize(enableRedirection, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'HEAD',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
encoding: null,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.CustomAuthentication.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.CustomAuthentication.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Buffer; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Buffer");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
}