1306 lines
60 KiB
TypeScript
1306 lines
60 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 { BaseItemKind } from '../model/baseItemKind';
|
|
import { GeneralCommandType } from '../model/generalCommandType';
|
|
import { NameIdPair } from '../model/nameIdPair';
|
|
import { PlayCommand } from '../model/playCommand';
|
|
import { PlaystateCommand } from '../model/playstateCommand';
|
|
import { PostFullCapabilitiesRequest } from '../model/postFullCapabilitiesRequest';
|
|
import { SendFullGeneralCommandRequest } from '../model/sendFullGeneralCommandRequest';
|
|
import { SendMessageCommandRequest } from '../model/sendMessageCommandRequest';
|
|
import { SessionInfo } from '../model/sessionInfo';
|
|
|
|
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 SessionApiApiKeys {
|
|
CustomAuthentication,
|
|
}
|
|
|
|
export class SessionApi {
|
|
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: SessionApiApiKeys, value: string) {
|
|
(this.authentications as any)[SessionApiApiKeys[key]].apiKey = value;
|
|
}
|
|
|
|
public addInterceptor(interceptor: Interceptor) {
|
|
this.interceptors.push(interceptor);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @summary Adds an additional user to a session.
|
|
* @param sessionId The session id.
|
|
* @param userId The user id.
|
|
*/
|
|
public async addUserToSession (sessionId: string, userId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/{sessionId}/User/{userId}'
|
|
.replace('{' + 'sessionId' + '}', encodeURIComponent(String(sessionId)))
|
|
.replace('{' + 'userId' + '}', encodeURIComponent(String(userId)));
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
// verify required parameter 'sessionId' is not null or undefined
|
|
if (sessionId === null || sessionId === undefined) {
|
|
throw new Error('Required parameter sessionId was null or undefined when calling addUserToSession.');
|
|
}
|
|
|
|
// verify required parameter 'userId' is not null or undefined
|
|
if (userId === null || userId === undefined) {
|
|
throw new Error('Required parameter userId was null or undefined when calling addUserToSession.');
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Instructs a session to browse to an item or view.
|
|
* @param sessionId The session Id.
|
|
* @param itemType The type of item to browse to.
|
|
* @param itemId The Id of the item.
|
|
* @param itemName The name of the item.
|
|
*/
|
|
public async displayContent (sessionId: string, itemType: BaseItemKind, itemId: string, itemName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/{sessionId}/Viewing'
|
|
.replace('{' + 'sessionId' + '}', encodeURIComponent(String(sessionId)));
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
// verify required parameter 'sessionId' is not null or undefined
|
|
if (sessionId === null || sessionId === undefined) {
|
|
throw new Error('Required parameter sessionId was null or undefined when calling displayContent.');
|
|
}
|
|
|
|
// verify required parameter 'itemType' is not null or undefined
|
|
if (itemType === null || itemType === undefined) {
|
|
throw new Error('Required parameter itemType was null or undefined when calling displayContent.');
|
|
}
|
|
|
|
// 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 displayContent.');
|
|
}
|
|
|
|
// verify required parameter 'itemName' is not null or undefined
|
|
if (itemName === null || itemName === undefined) {
|
|
throw new Error('Required parameter itemName was null or undefined when calling displayContent.');
|
|
}
|
|
|
|
if (itemType !== undefined) {
|
|
localVarQueryParameters['itemType'] = ObjectSerializer.serialize(itemType, "BaseItemKind");
|
|
}
|
|
|
|
if (itemId !== undefined) {
|
|
localVarQueryParameters['itemId'] = ObjectSerializer.serialize(itemId, "string");
|
|
}
|
|
|
|
if (itemName !== undefined) {
|
|
localVarQueryParameters['itemName'] = ObjectSerializer.serialize(itemName, "string");
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Get all auth providers.
|
|
*/
|
|
public async getAuthProviders (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<NameIdPair>; }> {
|
|
const localVarPath = this.basePath + '/Auth/Providers';
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
const produces = ['application/json', 'application/json; profile=CamelCase', 'application/json; profile=PascalCase'];
|
|
// give precedence to 'application/json'
|
|
if (produces.indexOf('application/json') >= 0) {
|
|
localVarHeaderParams.Accept = 'application/json';
|
|
} else {
|
|
localVarHeaderParams.Accept = produces.join(',');
|
|
}
|
|
let localVarFormParams: any = {};
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'GET',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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: Array<NameIdPair>; }>((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, "Array<NameIdPair>");
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Get all password reset providers.
|
|
*/
|
|
public async getPasswordResetProviders (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<NameIdPair>; }> {
|
|
const localVarPath = this.basePath + '/Auth/PasswordResetProviders';
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
const produces = ['application/json', 'application/json; profile=CamelCase', 'application/json; profile=PascalCase'];
|
|
// give precedence to 'application/json'
|
|
if (produces.indexOf('application/json') >= 0) {
|
|
localVarHeaderParams.Accept = 'application/json';
|
|
} else {
|
|
localVarHeaderParams.Accept = produces.join(',');
|
|
}
|
|
let localVarFormParams: any = {};
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'GET',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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: Array<NameIdPair>; }>((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, "Array<NameIdPair>");
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Gets a list of sessions.
|
|
* @param controllableByUserId Filter by sessions that a given user is allowed to remote control.
|
|
* @param deviceId Filter by device Id.
|
|
* @param activeWithinSeconds Optional. Filter by sessions that were active in the last n seconds.
|
|
*/
|
|
public async getSessions (controllableByUserId?: string, deviceId?: string, activeWithinSeconds?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<SessionInfo>; }> {
|
|
const localVarPath = this.basePath + '/Sessions';
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
const produces = ['application/json', 'application/json; profile=CamelCase', 'application/json; profile=PascalCase'];
|
|
// give precedence to 'application/json'
|
|
if (produces.indexOf('application/json') >= 0) {
|
|
localVarHeaderParams.Accept = 'application/json';
|
|
} else {
|
|
localVarHeaderParams.Accept = produces.join(',');
|
|
}
|
|
let localVarFormParams: any = {};
|
|
|
|
if (controllableByUserId !== undefined) {
|
|
localVarQueryParameters['controllableByUserId'] = ObjectSerializer.serialize(controllableByUserId, "string");
|
|
}
|
|
|
|
if (deviceId !== undefined) {
|
|
localVarQueryParameters['deviceId'] = ObjectSerializer.serialize(deviceId, "string");
|
|
}
|
|
|
|
if (activeWithinSeconds !== undefined) {
|
|
localVarQueryParameters['activeWithinSeconds'] = ObjectSerializer.serialize(activeWithinSeconds, "number");
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'GET',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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: Array<SessionInfo>; }>((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, "Array<SessionInfo>");
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Instructs a session to play an item.
|
|
* @param sessionId The session id.
|
|
* @param playCommand The type of play command to issue (PlayNow, PlayNext, PlayLast). Clients who have not yet implemented play next and play last may play now.
|
|
* @param itemIds The ids of the items to play, comma delimited.
|
|
* @param startPositionTicks The starting position of the first item.
|
|
* @param mediaSourceId Optional. The media source id.
|
|
* @param audioStreamIndex Optional. The index of the audio stream to play.
|
|
* @param subtitleStreamIndex Optional. The index of the subtitle stream to play.
|
|
* @param startIndex Optional. The start index.
|
|
*/
|
|
public async play (sessionId: string, playCommand: PlayCommand, itemIds: Array<string>, startPositionTicks?: number, mediaSourceId?: string, audioStreamIndex?: number, subtitleStreamIndex?: number, startIndex?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/{sessionId}/Playing'
|
|
.replace('{' + 'sessionId' + '}', encodeURIComponent(String(sessionId)));
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
// verify required parameter 'sessionId' is not null or undefined
|
|
if (sessionId === null || sessionId === undefined) {
|
|
throw new Error('Required parameter sessionId was null or undefined when calling play.');
|
|
}
|
|
|
|
// verify required parameter 'playCommand' is not null or undefined
|
|
if (playCommand === null || playCommand === undefined) {
|
|
throw new Error('Required parameter playCommand was null or undefined when calling play.');
|
|
}
|
|
|
|
// verify required parameter 'itemIds' is not null or undefined
|
|
if (itemIds === null || itemIds === undefined) {
|
|
throw new Error('Required parameter itemIds was null or undefined when calling play.');
|
|
}
|
|
|
|
if (playCommand !== undefined) {
|
|
localVarQueryParameters['playCommand'] = ObjectSerializer.serialize(playCommand, "PlayCommand");
|
|
}
|
|
|
|
if (itemIds !== undefined) {
|
|
localVarQueryParameters['itemIds'] = ObjectSerializer.serialize(itemIds, "Array<string>");
|
|
}
|
|
|
|
if (startPositionTicks !== undefined) {
|
|
localVarQueryParameters['startPositionTicks'] = ObjectSerializer.serialize(startPositionTicks, "number");
|
|
}
|
|
|
|
if (mediaSourceId !== undefined) {
|
|
localVarQueryParameters['mediaSourceId'] = ObjectSerializer.serialize(mediaSourceId, "string");
|
|
}
|
|
|
|
if (audioStreamIndex !== undefined) {
|
|
localVarQueryParameters['audioStreamIndex'] = ObjectSerializer.serialize(audioStreamIndex, "number");
|
|
}
|
|
|
|
if (subtitleStreamIndex !== undefined) {
|
|
localVarQueryParameters['subtitleStreamIndex'] = ObjectSerializer.serialize(subtitleStreamIndex, "number");
|
|
}
|
|
|
|
if (startIndex !== undefined) {
|
|
localVarQueryParameters['startIndex'] = ObjectSerializer.serialize(startIndex, "number");
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Updates capabilities for a device.
|
|
* @param id The session id.
|
|
* @param playableMediaTypes A list of playable media types, comma delimited. Audio, Video, Book, Photo.
|
|
* @param supportedCommands A list of supported remote control commands, comma delimited.
|
|
* @param supportsMediaControl Determines whether media can be played remotely..
|
|
* @param supportsSync Determines whether sync is supported.
|
|
* @param supportsPersistentIdentifier Determines whether the device supports a unique identifier.
|
|
*/
|
|
public async postCapabilities (id?: string, playableMediaTypes?: Array<string>, supportedCommands?: Array<GeneralCommandType>, supportsMediaControl?: boolean, supportsSync?: boolean, supportsPersistentIdentifier?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/Capabilities';
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
if (id !== undefined) {
|
|
localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string");
|
|
}
|
|
|
|
if (playableMediaTypes !== undefined) {
|
|
localVarQueryParameters['playableMediaTypes'] = ObjectSerializer.serialize(playableMediaTypes, "Array<string>");
|
|
}
|
|
|
|
if (supportedCommands !== undefined) {
|
|
localVarQueryParameters['supportedCommands'] = ObjectSerializer.serialize(supportedCommands, "Array<GeneralCommandType>");
|
|
}
|
|
|
|
if (supportsMediaControl !== undefined) {
|
|
localVarQueryParameters['supportsMediaControl'] = ObjectSerializer.serialize(supportsMediaControl, "boolean");
|
|
}
|
|
|
|
if (supportsSync !== undefined) {
|
|
localVarQueryParameters['supportsSync'] = ObjectSerializer.serialize(supportsSync, "boolean");
|
|
}
|
|
|
|
if (supportsPersistentIdentifier !== undefined) {
|
|
localVarQueryParameters['supportsPersistentIdentifier'] = ObjectSerializer.serialize(supportsPersistentIdentifier, "boolean");
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Updates capabilities for a device.
|
|
* @param postFullCapabilitiesRequest The MediaBrowser.Model.Session.ClientCapabilities.
|
|
* @param id The session id.
|
|
*/
|
|
public async postFullCapabilities (postFullCapabilitiesRequest: PostFullCapabilitiesRequest, id?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/Capabilities/Full';
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
// verify required parameter 'postFullCapabilitiesRequest' is not null or undefined
|
|
if (postFullCapabilitiesRequest === null || postFullCapabilitiesRequest === undefined) {
|
|
throw new Error('Required parameter postFullCapabilitiesRequest was null or undefined when calling postFullCapabilities.');
|
|
}
|
|
|
|
if (id !== undefined) {
|
|
localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string");
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
body: ObjectSerializer.serialize(postFullCapabilitiesRequest, "PostFullCapabilitiesRequest")
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Removes an additional user from a session.
|
|
* @param sessionId The session id.
|
|
* @param userId The user id.
|
|
*/
|
|
public async removeUserFromSession (sessionId: string, userId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/{sessionId}/User/{userId}'
|
|
.replace('{' + 'sessionId' + '}', encodeURIComponent(String(sessionId)))
|
|
.replace('{' + 'userId' + '}', encodeURIComponent(String(userId)));
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
// verify required parameter 'sessionId' is not null or undefined
|
|
if (sessionId === null || sessionId === undefined) {
|
|
throw new Error('Required parameter sessionId was null or undefined when calling removeUserFromSession.');
|
|
}
|
|
|
|
// verify required parameter 'userId' is not null or undefined
|
|
if (userId === null || userId === undefined) {
|
|
throw new Error('Required parameter userId was null or undefined when calling removeUserFromSession.');
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'DELETE',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Reports that a session has ended.
|
|
*/
|
|
public async reportSessionEnded (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/Logout';
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Reports that a session is viewing an item.
|
|
* @param itemId The item id.
|
|
* @param sessionId The session id.
|
|
*/
|
|
public async reportViewing (itemId: string, sessionId?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/Viewing';
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
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 reportViewing.');
|
|
}
|
|
|
|
if (sessionId !== undefined) {
|
|
localVarQueryParameters['sessionId'] = ObjectSerializer.serialize(sessionId, "string");
|
|
}
|
|
|
|
if (itemId !== undefined) {
|
|
localVarQueryParameters['itemId'] = ObjectSerializer.serialize(itemId, "string");
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Issues a full general command to a client.
|
|
* @param sessionId The session id.
|
|
* @param sendFullGeneralCommandRequest The MediaBrowser.Model.Session.GeneralCommand.
|
|
*/
|
|
public async sendFullGeneralCommand (sessionId: string, sendFullGeneralCommandRequest: SendFullGeneralCommandRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/{sessionId}/Command'
|
|
.replace('{' + 'sessionId' + '}', encodeURIComponent(String(sessionId)));
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
// verify required parameter 'sessionId' is not null or undefined
|
|
if (sessionId === null || sessionId === undefined) {
|
|
throw new Error('Required parameter sessionId was null or undefined when calling sendFullGeneralCommand.');
|
|
}
|
|
|
|
// verify required parameter 'sendFullGeneralCommandRequest' is not null or undefined
|
|
if (sendFullGeneralCommandRequest === null || sendFullGeneralCommandRequest === undefined) {
|
|
throw new Error('Required parameter sendFullGeneralCommandRequest was null or undefined when calling sendFullGeneralCommand.');
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
body: ObjectSerializer.serialize(sendFullGeneralCommandRequest, "SendFullGeneralCommandRequest")
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Issues a general command to a client.
|
|
* @param sessionId The session id.
|
|
* @param command The command to send.
|
|
*/
|
|
public async sendGeneralCommand (sessionId: string, command: GeneralCommandType, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/{sessionId}/Command/{command}'
|
|
.replace('{' + 'sessionId' + '}', encodeURIComponent(String(sessionId)))
|
|
.replace('{' + 'command' + '}', encodeURIComponent(String(command)));
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
// verify required parameter 'sessionId' is not null or undefined
|
|
if (sessionId === null || sessionId === undefined) {
|
|
throw new Error('Required parameter sessionId was null or undefined when calling sendGeneralCommand.');
|
|
}
|
|
|
|
// verify required parameter 'command' is not null or undefined
|
|
if (command === null || command === undefined) {
|
|
throw new Error('Required parameter command was null or undefined when calling sendGeneralCommand.');
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Issues a command to a client to display a message to the user.
|
|
* @param sessionId The session id.
|
|
* @param sendMessageCommandRequest The MediaBrowser.Model.Session.MessageCommand object containing Header, Message Text, and TimeoutMs.
|
|
*/
|
|
public async sendMessageCommand (sessionId: string, sendMessageCommandRequest: SendMessageCommandRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/{sessionId}/Message'
|
|
.replace('{' + 'sessionId' + '}', encodeURIComponent(String(sessionId)));
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
// verify required parameter 'sessionId' is not null or undefined
|
|
if (sessionId === null || sessionId === undefined) {
|
|
throw new Error('Required parameter sessionId was null or undefined when calling sendMessageCommand.');
|
|
}
|
|
|
|
// verify required parameter 'sendMessageCommandRequest' is not null or undefined
|
|
if (sendMessageCommandRequest === null || sendMessageCommandRequest === undefined) {
|
|
throw new Error('Required parameter sendMessageCommandRequest was null or undefined when calling sendMessageCommand.');
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
body: ObjectSerializer.serialize(sendMessageCommandRequest, "SendMessageCommandRequest")
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Issues a playstate command to a client.
|
|
* @param sessionId The session id.
|
|
* @param command The MediaBrowser.Model.Session.PlaystateCommand.
|
|
* @param seekPositionTicks The optional position ticks.
|
|
* @param controllingUserId The optional controlling user id.
|
|
*/
|
|
public async sendPlaystateCommand (sessionId: string, command: PlaystateCommand, seekPositionTicks?: number, controllingUserId?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/{sessionId}/Playing/{command}'
|
|
.replace('{' + 'sessionId' + '}', encodeURIComponent(String(sessionId)))
|
|
.replace('{' + 'command' + '}', encodeURIComponent(String(command)));
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
// verify required parameter 'sessionId' is not null or undefined
|
|
if (sessionId === null || sessionId === undefined) {
|
|
throw new Error('Required parameter sessionId was null or undefined when calling sendPlaystateCommand.');
|
|
}
|
|
|
|
// verify required parameter 'command' is not null or undefined
|
|
if (command === null || command === undefined) {
|
|
throw new Error('Required parameter command was null or undefined when calling sendPlaystateCommand.');
|
|
}
|
|
|
|
if (seekPositionTicks !== undefined) {
|
|
localVarQueryParameters['seekPositionTicks'] = ObjectSerializer.serialize(seekPositionTicks, "number");
|
|
}
|
|
|
|
if (controllingUserId !== undefined) {
|
|
localVarQueryParameters['controllingUserId'] = ObjectSerializer.serialize(controllingUserId, "string");
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @summary Issues a system command to a client.
|
|
* @param sessionId The session id.
|
|
* @param command The command to send.
|
|
*/
|
|
public async sendSystemCommand (sessionId: string, command: GeneralCommandType, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
const localVarPath = this.basePath + '/Sessions/{sessionId}/System/{command}'
|
|
.replace('{' + 'sessionId' + '}', encodeURIComponent(String(sessionId)))
|
|
.replace('{' + 'command' + '}', encodeURIComponent(String(command)));
|
|
let localVarQueryParameters: any = {};
|
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
let localVarFormParams: any = {};
|
|
|
|
// verify required parameter 'sessionId' is not null or undefined
|
|
if (sessionId === null || sessionId === undefined) {
|
|
throw new Error('Required parameter sessionId was null or undefined when calling sendSystemCommand.');
|
|
}
|
|
|
|
// verify required parameter 'command' is not null or undefined
|
|
if (command === null || command === undefined) {
|
|
throw new Error('Required parameter command was null or undefined when calling sendSystemCommand.');
|
|
}
|
|
|
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
|
|
let localVarUseFormData = false;
|
|
|
|
let localVarRequestOptions: localVarRequest.Options = {
|
|
method: 'POST',
|
|
qs: localVarQueryParameters,
|
|
headers: localVarHeaderParams,
|
|
uri: localVarPath,
|
|
useQuerystring: this._useQuerystring,
|
|
json: true,
|
|
};
|
|
|
|
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?: any; }>((resolve, reject) => {
|
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
resolve({ response: response, body: body });
|
|
} else {
|
|
reject(new HttpError(response, body, response.statusCode));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|