/** * 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 { PlayMethod } from '../model/playMethod'; import { RepeatMode } from '../model/repeatMode'; import { ReportPlaybackProgressRequest } from '../model/reportPlaybackProgressRequest'; import { ReportPlaybackStartRequest } from '../model/reportPlaybackStartRequest'; import { ReportPlaybackStoppedRequest } from '../model/reportPlaybackStoppedRequest'; import { UserItemDataDto } from '../model/userItemDataDto'; 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 PlaystateApiApiKeys { CustomAuthentication, } export class PlaystateApi { protected _basePath = defaultBasePath; protected _defaultHeaders : any = {}; protected _useQuerystring : boolean = false; protected authentications = { 'default': 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: PlaystateApiApiKeys, value: string) { (this.authentications as any)[PlaystateApiApiKeys[key]].apiKey = value; } public addInterceptor(interceptor: Interceptor) { this.interceptors.push(interceptor); } /** * * @summary Marks an item as played for user. * @param userId User id. * @param itemId Item id. * @param datePlayed Optional. The date the item was played. */ public async markPlayedItem (userId: string, itemId: string, datePlayed?: Date, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: UserItemDataDto; }> { const localVarPath = this.basePath + '/Users/{userId}/PlayedItems/{itemId}' .replace('{' + 'userId' + '}', encodeURIComponent(String(userId))) .replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: 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 = {}; // 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 markPlayedItem.'); } // 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 markPlayedItem.'); } if (datePlayed !== undefined) { localVarQueryParameters['datePlayed'] = ObjectSerializer.serialize(datePlayed, "Date"); } (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) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.IncomingMessage; body: UserItemDataDto; }>((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, "UserItemDataDto"); resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * * @summary Marks an item as unplayed for user. * @param userId User id. * @param itemId Item id. */ public async markUnplayedItem (userId: string, itemId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: UserItemDataDto; }> { const localVarPath = this.basePath + '/Users/{userId}/PlayedItems/{itemId}' .replace('{' + 'userId' + '}', encodeURIComponent(String(userId))) .replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: 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 = {}; // 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 markUnplayedItem.'); } // 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 markUnplayedItem.'); } (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) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.IncomingMessage; body: UserItemDataDto; }>((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, "UserItemDataDto"); resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * * @summary Reports a user\'s playback progress. * @param userId User id. * @param itemId Item id. * @param mediaSourceId The id of the MediaSource. * @param positionTicks Optional. The current position, in ticks. 1 tick = 10000 ms. * @param audioStreamIndex The audio stream index. * @param subtitleStreamIndex The subtitle stream index. * @param volumeLevel Scale of 0-100. * @param playMethod The play method. * @param liveStreamId The live stream id. * @param playSessionId The play session id. * @param repeatMode The repeat mode. * @param isPaused Indicates if the player is paused. * @param isMuted Indicates if the player is muted. */ public async onPlaybackProgress (userId: string, itemId: string, mediaSourceId?: string, positionTicks?: number, audioStreamIndex?: number, subtitleStreamIndex?: number, volumeLevel?: number, playMethod?: PlayMethod, liveStreamId?: string, playSessionId?: string, repeatMode?: RepeatMode, isPaused?: boolean, isMuted?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { const localVarPath = this.basePath + '/Users/{userId}/PlayingItems/{itemId}/Progress' .replace('{' + 'userId' + '}', encodeURIComponent(String(userId))) .replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); let localVarFormParams: any = {}; // 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 onPlaybackProgress.'); } // 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 onPlaybackProgress.'); } if (mediaSourceId !== undefined) { localVarQueryParameters['mediaSourceId'] = ObjectSerializer.serialize(mediaSourceId, "string"); } if (positionTicks !== undefined) { localVarQueryParameters['positionTicks'] = ObjectSerializer.serialize(positionTicks, "number"); } if (audioStreamIndex !== undefined) { localVarQueryParameters['audioStreamIndex'] = ObjectSerializer.serialize(audioStreamIndex, "number"); } if (subtitleStreamIndex !== undefined) { localVarQueryParameters['subtitleStreamIndex'] = ObjectSerializer.serialize(subtitleStreamIndex, "number"); } if (volumeLevel !== undefined) { localVarQueryParameters['volumeLevel'] = ObjectSerializer.serialize(volumeLevel, "number"); } if (playMethod !== undefined) { localVarQueryParameters['playMethod'] = ObjectSerializer.serialize(playMethod, "PlayMethod"); } if (liveStreamId !== undefined) { localVarQueryParameters['liveStreamId'] = ObjectSerializer.serialize(liveStreamId, "string"); } if (playSessionId !== undefined) { localVarQueryParameters['playSessionId'] = ObjectSerializer.serialize(playSessionId, "string"); } if (repeatMode !== undefined) { localVarQueryParameters['repeatMode'] = ObjectSerializer.serialize(repeatMode, "RepeatMode"); } if (isPaused !== undefined) { localVarQueryParameters['isPaused'] = ObjectSerializer.serialize(isPaused, "boolean"); } if (isMuted !== undefined) { localVarQueryParameters['isMuted'] = ObjectSerializer.serialize(isMuted, "boolean"); } (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) { (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 user has begun playing an item. * @param userId User id. * @param itemId Item id. * @param mediaSourceId The id of the MediaSource. * @param audioStreamIndex The audio stream index. * @param subtitleStreamIndex The subtitle stream index. * @param playMethod The play method. * @param liveStreamId The live stream id. * @param playSessionId The play session id. * @param canSeek Indicates if the client can seek. */ public async onPlaybackStart (userId: string, itemId: string, mediaSourceId?: string, audioStreamIndex?: number, subtitleStreamIndex?: number, playMethod?: PlayMethod, liveStreamId?: string, playSessionId?: string, canSeek?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { const localVarPath = this.basePath + '/Users/{userId}/PlayingItems/{itemId}' .replace('{' + 'userId' + '}', encodeURIComponent(String(userId))) .replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); let localVarFormParams: any = {}; // 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 onPlaybackStart.'); } // 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 onPlaybackStart.'); } 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 (playMethod !== undefined) { localVarQueryParameters['playMethod'] = ObjectSerializer.serialize(playMethod, "PlayMethod"); } if (liveStreamId !== undefined) { localVarQueryParameters['liveStreamId'] = ObjectSerializer.serialize(liveStreamId, "string"); } if (playSessionId !== undefined) { localVarQueryParameters['playSessionId'] = ObjectSerializer.serialize(playSessionId, "string"); } if (canSeek !== undefined) { localVarQueryParameters['canSeek'] = ObjectSerializer.serialize(canSeek, "boolean"); } (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) { (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 user has stopped playing an item. * @param userId User id. * @param itemId Item id. * @param mediaSourceId The id of the MediaSource. * @param nextMediaType The next media type that will play. * @param positionTicks Optional. The position, in ticks, where playback stopped. 1 tick = 10000 ms. * @param liveStreamId The live stream id. * @param playSessionId The play session id. */ public async onPlaybackStopped (userId: string, itemId: string, mediaSourceId?: string, nextMediaType?: string, positionTicks?: number, liveStreamId?: string, playSessionId?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { const localVarPath = this.basePath + '/Users/{userId}/PlayingItems/{itemId}' .replace('{' + 'userId' + '}', encodeURIComponent(String(userId))) .replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); let localVarFormParams: any = {}; // 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 onPlaybackStopped.'); } // 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 onPlaybackStopped.'); } if (mediaSourceId !== undefined) { localVarQueryParameters['mediaSourceId'] = ObjectSerializer.serialize(mediaSourceId, "string"); } if (nextMediaType !== undefined) { localVarQueryParameters['nextMediaType'] = ObjectSerializer.serialize(nextMediaType, "string"); } if (positionTicks !== undefined) { localVarQueryParameters['positionTicks'] = ObjectSerializer.serialize(positionTicks, "number"); } if (liveStreamId !== undefined) { localVarQueryParameters['liveStreamId'] = ObjectSerializer.serialize(liveStreamId, "string"); } if (playSessionId !== undefined) { localVarQueryParameters['playSessionId'] = ObjectSerializer.serialize(playSessionId, "string"); } (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) { (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 Pings a playback session. * @param playSessionId Playback session id. */ public async pingPlaybackSession (playSessionId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { const localVarPath = this.basePath + '/Sessions/Playing/Ping'; let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); let localVarFormParams: any = {}; // verify required parameter 'playSessionId' is not null or undefined if (playSessionId === null || playSessionId === undefined) { throw new Error('Required parameter playSessionId was null or undefined when calling pingPlaybackSession.'); } if (playSessionId !== undefined) { localVarQueryParameters['playSessionId'] = ObjectSerializer.serialize(playSessionId, "string"); } (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) { (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 playback progress within a session. * @param reportPlaybackProgressRequest The playback progress info. */ public async reportPlaybackProgress (reportPlaybackProgressRequest?: ReportPlaybackProgressRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { const localVarPath = this.basePath + '/Sessions/Playing/Progress'; let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); let localVarFormParams: 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(reportPlaybackProgressRequest, "ReportPlaybackProgressRequest") }; 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) { (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 playback has started within a session. * @param reportPlaybackStartRequest The playback start info. */ public async reportPlaybackStart (reportPlaybackStartRequest?: ReportPlaybackStartRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { const localVarPath = this.basePath + '/Sessions/Playing'; let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); let localVarFormParams: 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(reportPlaybackStartRequest, "ReportPlaybackStartRequest") }; 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) { (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 playback has stopped within a session. * @param reportPlaybackStoppedRequest The playback stop info. */ public async reportPlaybackStopped (reportPlaybackStoppedRequest?: ReportPlaybackStoppedRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { const localVarPath = this.basePath + '/Sessions/Playing/Stopped'; let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); let localVarFormParams: 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(reportPlaybackStoppedRequest, "ReportPlaybackStoppedRequest") }; 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) { (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)); } } }); }); }); } }