527 lines
21 KiB
TypeScript
527 lines
21 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
/**
|
|
* Jellyfin API
|
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
*
|
|
* The version of the OpenAPI document: 10.8.9
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
|
|
import * as runtime from '../runtime';
|
|
import type {
|
|
PlayMethod,
|
|
RepeatMode,
|
|
ReportPlaybackProgressRequest,
|
|
ReportPlaybackStartRequest,
|
|
ReportPlaybackStoppedRequest,
|
|
UserItemDataDto,
|
|
} from '../models';
|
|
import {
|
|
PlayMethodFromJSON,
|
|
PlayMethodToJSON,
|
|
RepeatModeFromJSON,
|
|
RepeatModeToJSON,
|
|
ReportPlaybackProgressRequestFromJSON,
|
|
ReportPlaybackProgressRequestToJSON,
|
|
ReportPlaybackStartRequestFromJSON,
|
|
ReportPlaybackStartRequestToJSON,
|
|
ReportPlaybackStoppedRequestFromJSON,
|
|
ReportPlaybackStoppedRequestToJSON,
|
|
UserItemDataDtoFromJSON,
|
|
UserItemDataDtoToJSON,
|
|
} from '../models';
|
|
|
|
export interface MarkPlayedItemRequest {
|
|
userId: string;
|
|
itemId: string;
|
|
datePlayed?: Date;
|
|
}
|
|
|
|
export interface MarkUnplayedItemRequest {
|
|
userId: string;
|
|
itemId: string;
|
|
}
|
|
|
|
export interface OnPlaybackProgressRequest {
|
|
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;
|
|
}
|
|
|
|
export interface OnPlaybackStartRequest {
|
|
userId: string;
|
|
itemId: string;
|
|
mediaSourceId?: string;
|
|
audioStreamIndex?: number;
|
|
subtitleStreamIndex?: number;
|
|
playMethod?: PlayMethod;
|
|
liveStreamId?: string;
|
|
playSessionId?: string;
|
|
canSeek?: boolean;
|
|
}
|
|
|
|
export interface OnPlaybackStoppedRequest {
|
|
userId: string;
|
|
itemId: string;
|
|
mediaSourceId?: string;
|
|
nextMediaType?: string;
|
|
positionTicks?: number;
|
|
liveStreamId?: string;
|
|
playSessionId?: string;
|
|
}
|
|
|
|
export interface PingPlaybackSessionRequest {
|
|
playSessionId: string;
|
|
}
|
|
|
|
export interface ReportPlaybackProgressOperationRequest {
|
|
reportPlaybackProgressRequest?: ReportPlaybackProgressRequest;
|
|
}
|
|
|
|
export interface ReportPlaybackStartOperationRequest {
|
|
reportPlaybackStartRequest?: ReportPlaybackStartRequest;
|
|
}
|
|
|
|
export interface ReportPlaybackStoppedOperationRequest {
|
|
reportPlaybackStoppedRequest?: ReportPlaybackStoppedRequest;
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
export class PlaystateApi extends runtime.BaseAPI {
|
|
|
|
/**
|
|
* Marks an item as played for user.
|
|
*/
|
|
async markPlayedItemRaw(requestParameters: MarkPlayedItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserItemDataDto>> {
|
|
if (requestParameters.userId === null || requestParameters.userId === undefined) {
|
|
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling markPlayedItem.');
|
|
}
|
|
|
|
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
|
|
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling markPlayedItem.');
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters.datePlayed !== undefined) {
|
|
queryParameters['datePlayed'] = (requestParameters.datePlayed as any).toISOString();
|
|
}
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Users/{userId}/PlayedItems/{itemId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))).replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => UserItemDataDtoFromJSON(jsonValue));
|
|
}
|
|
|
|
/**
|
|
* Marks an item as played for user.
|
|
*/
|
|
async markPlayedItem(requestParameters: MarkPlayedItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserItemDataDto> {
|
|
const response = await this.markPlayedItemRaw(requestParameters, initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Marks an item as unplayed for user.
|
|
*/
|
|
async markUnplayedItemRaw(requestParameters: MarkUnplayedItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserItemDataDto>> {
|
|
if (requestParameters.userId === null || requestParameters.userId === undefined) {
|
|
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling markUnplayedItem.');
|
|
}
|
|
|
|
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
|
|
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling markUnplayedItem.');
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Users/{userId}/PlayedItems/{itemId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))).replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
|
|
method: 'DELETE',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => UserItemDataDtoFromJSON(jsonValue));
|
|
}
|
|
|
|
/**
|
|
* Marks an item as unplayed for user.
|
|
*/
|
|
async markUnplayedItem(requestParameters: MarkUnplayedItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserItemDataDto> {
|
|
const response = await this.markUnplayedItemRaw(requestParameters, initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Reports a user\'s playback progress.
|
|
*/
|
|
async onPlaybackProgressRaw(requestParameters: OnPlaybackProgressRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
if (requestParameters.userId === null || requestParameters.userId === undefined) {
|
|
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling onPlaybackProgress.');
|
|
}
|
|
|
|
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
|
|
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling onPlaybackProgress.');
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters.mediaSourceId !== undefined) {
|
|
queryParameters['mediaSourceId'] = requestParameters.mediaSourceId;
|
|
}
|
|
|
|
if (requestParameters.positionTicks !== undefined) {
|
|
queryParameters['positionTicks'] = requestParameters.positionTicks;
|
|
}
|
|
|
|
if (requestParameters.audioStreamIndex !== undefined) {
|
|
queryParameters['audioStreamIndex'] = requestParameters.audioStreamIndex;
|
|
}
|
|
|
|
if (requestParameters.subtitleStreamIndex !== undefined) {
|
|
queryParameters['subtitleStreamIndex'] = requestParameters.subtitleStreamIndex;
|
|
}
|
|
|
|
if (requestParameters.volumeLevel !== undefined) {
|
|
queryParameters['volumeLevel'] = requestParameters.volumeLevel;
|
|
}
|
|
|
|
if (requestParameters.playMethod !== undefined) {
|
|
queryParameters['playMethod'] = requestParameters.playMethod;
|
|
}
|
|
|
|
if (requestParameters.liveStreamId !== undefined) {
|
|
queryParameters['liveStreamId'] = requestParameters.liveStreamId;
|
|
}
|
|
|
|
if (requestParameters.playSessionId !== undefined) {
|
|
queryParameters['playSessionId'] = requestParameters.playSessionId;
|
|
}
|
|
|
|
if (requestParameters.repeatMode !== undefined) {
|
|
queryParameters['repeatMode'] = requestParameters.repeatMode;
|
|
}
|
|
|
|
if (requestParameters.isPaused !== undefined) {
|
|
queryParameters['isPaused'] = requestParameters.isPaused;
|
|
}
|
|
|
|
if (requestParameters.isMuted !== undefined) {
|
|
queryParameters['isMuted'] = requestParameters.isMuted;
|
|
}
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Users/{userId}/PlayingItems/{itemId}/Progress`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))).replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Reports a user\'s playback progress.
|
|
*/
|
|
async onPlaybackProgress(requestParameters: OnPlaybackProgressRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.onPlaybackProgressRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
/**
|
|
* Reports that a user has begun playing an item.
|
|
*/
|
|
async onPlaybackStartRaw(requestParameters: OnPlaybackStartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
if (requestParameters.userId === null || requestParameters.userId === undefined) {
|
|
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling onPlaybackStart.');
|
|
}
|
|
|
|
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
|
|
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling onPlaybackStart.');
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters.mediaSourceId !== undefined) {
|
|
queryParameters['mediaSourceId'] = requestParameters.mediaSourceId;
|
|
}
|
|
|
|
if (requestParameters.audioStreamIndex !== undefined) {
|
|
queryParameters['audioStreamIndex'] = requestParameters.audioStreamIndex;
|
|
}
|
|
|
|
if (requestParameters.subtitleStreamIndex !== undefined) {
|
|
queryParameters['subtitleStreamIndex'] = requestParameters.subtitleStreamIndex;
|
|
}
|
|
|
|
if (requestParameters.playMethod !== undefined) {
|
|
queryParameters['playMethod'] = requestParameters.playMethod;
|
|
}
|
|
|
|
if (requestParameters.liveStreamId !== undefined) {
|
|
queryParameters['liveStreamId'] = requestParameters.liveStreamId;
|
|
}
|
|
|
|
if (requestParameters.playSessionId !== undefined) {
|
|
queryParameters['playSessionId'] = requestParameters.playSessionId;
|
|
}
|
|
|
|
if (requestParameters.canSeek !== undefined) {
|
|
queryParameters['canSeek'] = requestParameters.canSeek;
|
|
}
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Users/{userId}/PlayingItems/{itemId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))).replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Reports that a user has begun playing an item.
|
|
*/
|
|
async onPlaybackStart(requestParameters: OnPlaybackStartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.onPlaybackStartRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
/**
|
|
* Reports that a user has stopped playing an item.
|
|
*/
|
|
async onPlaybackStoppedRaw(requestParameters: OnPlaybackStoppedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
if (requestParameters.userId === null || requestParameters.userId === undefined) {
|
|
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling onPlaybackStopped.');
|
|
}
|
|
|
|
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
|
|
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling onPlaybackStopped.');
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters.mediaSourceId !== undefined) {
|
|
queryParameters['mediaSourceId'] = requestParameters.mediaSourceId;
|
|
}
|
|
|
|
if (requestParameters.nextMediaType !== undefined) {
|
|
queryParameters['nextMediaType'] = requestParameters.nextMediaType;
|
|
}
|
|
|
|
if (requestParameters.positionTicks !== undefined) {
|
|
queryParameters['positionTicks'] = requestParameters.positionTicks;
|
|
}
|
|
|
|
if (requestParameters.liveStreamId !== undefined) {
|
|
queryParameters['liveStreamId'] = requestParameters.liveStreamId;
|
|
}
|
|
|
|
if (requestParameters.playSessionId !== undefined) {
|
|
queryParameters['playSessionId'] = requestParameters.playSessionId;
|
|
}
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Users/{userId}/PlayingItems/{itemId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))).replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
|
|
method: 'DELETE',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Reports that a user has stopped playing an item.
|
|
*/
|
|
async onPlaybackStopped(requestParameters: OnPlaybackStoppedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.onPlaybackStoppedRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
/**
|
|
* Pings a playback session.
|
|
*/
|
|
async pingPlaybackSessionRaw(requestParameters: PingPlaybackSessionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
if (requestParameters.playSessionId === null || requestParameters.playSessionId === undefined) {
|
|
throw new runtime.RequiredError('playSessionId','Required parameter requestParameters.playSessionId was null or undefined when calling pingPlaybackSession.');
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters.playSessionId !== undefined) {
|
|
queryParameters['playSessionId'] = requestParameters.playSessionId;
|
|
}
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Sessions/Playing/Ping`,
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Pings a playback session.
|
|
*/
|
|
async pingPlaybackSession(requestParameters: PingPlaybackSessionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.pingPlaybackSessionRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
/**
|
|
* Reports playback progress within a session.
|
|
*/
|
|
async reportPlaybackProgressRaw(requestParameters: ReportPlaybackProgressOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
headerParameters['Content-Type'] = 'application/json';
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Sessions/Playing/Progress`,
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
body: ReportPlaybackProgressRequestToJSON(requestParameters.reportPlaybackProgressRequest),
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Reports playback progress within a session.
|
|
*/
|
|
async reportPlaybackProgress(requestParameters: ReportPlaybackProgressOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.reportPlaybackProgressRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
/**
|
|
* Reports playback has started within a session.
|
|
*/
|
|
async reportPlaybackStartRaw(requestParameters: ReportPlaybackStartOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
headerParameters['Content-Type'] = 'application/json';
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Sessions/Playing`,
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
body: ReportPlaybackStartRequestToJSON(requestParameters.reportPlaybackStartRequest),
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Reports playback has started within a session.
|
|
*/
|
|
async reportPlaybackStart(requestParameters: ReportPlaybackStartOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.reportPlaybackStartRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
/**
|
|
* Reports playback has stopped within a session.
|
|
*/
|
|
async reportPlaybackStoppedRaw(requestParameters: ReportPlaybackStoppedOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
headerParameters['Content-Type'] = 'application/json';
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Sessions/Playing/Stopped`,
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
body: ReportPlaybackStoppedRequestToJSON(requestParameters.reportPlaybackStoppedRequest),
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Reports playback has stopped within a session.
|
|
*/
|
|
async reportPlaybackStopped(requestParameters: ReportPlaybackStoppedOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.reportPlaybackStoppedRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
}
|