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

600 lines
28 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 { BaseItemDtoQueryResult } from '../model/baseItemDtoQueryResult';
import { ImageType } from '../model/imageType';
import { ItemFields } from '../model/itemFields';
import { ProblemDetails } from '../model/problemDetails';
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 TvShowsApiApiKeys {
CustomAuthentication,
}
export class TvShowsApi {
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: TvShowsApiApiKeys, value: string) {
(this.authentications as any)[TvShowsApiApiKeys[key]].apiKey = value;
}
public addInterceptor(interceptor: Interceptor) {
this.interceptors.push(interceptor);
}
/**
*
* @summary Gets episodes for a tv season.
* @param seriesId The series id.
* @param userId The user id.
* @param fields Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls.
* @param season Optional filter by season number.
* @param seasonId Optional. Filter by season id.
* @param isMissing Optional. Filter by items that are missing episodes or not.
* @param adjacentTo Optional. Return items that are siblings of a supplied item.
* @param startItemId Optional. Skip through the list until a given item is found.
* @param startIndex Optional. The record index to start at. All items with a lower index will be dropped from the results.
* @param limit Optional. The maximum number of records to return.
* @param enableImages Optional, include image information in output.
* @param imageTypeLimit Optional, the max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
* @param enableUserData Optional. Include user data.
* @param sortBy Optional. Specify one or more sort orders, comma delimited. Options: Album, AlbumArtist, Artist, Budget, CommunityRating, CriticRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Revenue, Runtime.
*/
public async getEpisodes (seriesId: string, userId?: string, fields?: Array<ItemFields>, season?: number, seasonId?: string, isMissing?: boolean, adjacentTo?: string, startItemId?: string, startIndex?: number, limit?: number, enableImages?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, enableUserData?: boolean, sortBy?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/Shows/{seriesId}/Episodes'
.replace('{' + 'seriesId' + '}', encodeURIComponent(String(seriesId)));
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 = {};
// verify required parameter 'seriesId' is not null or undefined
if (seriesId === null || seriesId === undefined) {
throw new Error('Required parameter seriesId was null or undefined when calling getEpisodes.');
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (season !== undefined) {
localVarQueryParameters['season'] = ObjectSerializer.serialize(season, "number");
}
if (seasonId !== undefined) {
localVarQueryParameters['seasonId'] = ObjectSerializer.serialize(seasonId, "string");
}
if (isMissing !== undefined) {
localVarQueryParameters['isMissing'] = ObjectSerializer.serialize(isMissing, "boolean");
}
if (adjacentTo !== undefined) {
localVarQueryParameters['adjacentTo'] = ObjectSerializer.serialize(adjacentTo, "string");
}
if (startItemId !== undefined) {
localVarQueryParameters['startItemId'] = ObjectSerializer.serialize(startItemId, "string");
}
if (startIndex !== undefined) {
localVarQueryParameters['startIndex'] = ObjectSerializer.serialize(startIndex, "number");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
if (sortBy !== undefined) {
localVarQueryParameters['sortBy'] = ObjectSerializer.serialize(sortBy, "string");
}
(<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: BaseItemDtoQueryResult; }>((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, "BaseItemDtoQueryResult");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @summary Gets a list of next up episodes.
* @param userId The user id of the user to get the next up episodes for.
* @param startIndex Optional. The record index to start at. All items with a lower index will be dropped from the results.
* @param limit Optional. The maximum number of records to return.
* @param fields Optional. Specify additional fields of information to return in the output.
* @param seriesId Optional. Filter by series id.
* @param parentId Optional. Specify this to localize the search to a specific item or folder. Omit to use the root.
* @param enableImages Optional. Include image information in output.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
* @param enableUserData Optional. Include user data.
* @param nextUpDateCutoff Optional. Starting date of shows to show in Next Up section.
* @param enableTotalRecordCount Whether to enable the total records count. Defaults to true.
* @param disableFirstEpisode Whether to disable sending the first episode in a series as next up.
* @param enableRewatching Whether to include watched episode in next up results.
*/
public async getNextUp (userId?: string, startIndex?: number, limit?: number, fields?: Array<ItemFields>, seriesId?: string, parentId?: string, enableImages?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, enableUserData?: boolean, nextUpDateCutoff?: Date, enableTotalRecordCount?: boolean, disableFirstEpisode?: boolean, enableRewatching?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/Shows/NextUp';
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 (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (startIndex !== undefined) {
localVarQueryParameters['startIndex'] = ObjectSerializer.serialize(startIndex, "number");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (seriesId !== undefined) {
localVarQueryParameters['seriesId'] = ObjectSerializer.serialize(seriesId, "string");
}
if (parentId !== undefined) {
localVarQueryParameters['parentId'] = ObjectSerializer.serialize(parentId, "string");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
if (nextUpDateCutoff !== undefined) {
localVarQueryParameters['nextUpDateCutoff'] = ObjectSerializer.serialize(nextUpDateCutoff, "Date");
}
if (enableTotalRecordCount !== undefined) {
localVarQueryParameters['enableTotalRecordCount'] = ObjectSerializer.serialize(enableTotalRecordCount, "boolean");
}
if (disableFirstEpisode !== undefined) {
localVarQueryParameters['disableFirstEpisode'] = ObjectSerializer.serialize(disableFirstEpisode, "boolean");
}
if (enableRewatching !== undefined) {
localVarQueryParameters['enableRewatching'] = ObjectSerializer.serialize(enableRewatching, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
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: BaseItemDtoQueryResult; }>((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, "BaseItemDtoQueryResult");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @summary Gets seasons for a tv series.
* @param seriesId The series id.
* @param userId The user id.
* @param fields Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls.
* @param isSpecialSeason Optional. Filter by special season.
* @param isMissing Optional. Filter by items that are missing episodes or not.
* @param adjacentTo Optional. Return items that are siblings of a supplied item.
* @param enableImages Optional. Include image information in output.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
* @param enableUserData Optional. Include user data.
*/
public async getSeasons (seriesId: string, userId?: string, fields?: Array<ItemFields>, isSpecialSeason?: boolean, isMissing?: boolean, adjacentTo?: string, enableImages?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, enableUserData?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/Shows/{seriesId}/Seasons'
.replace('{' + 'seriesId' + '}', encodeURIComponent(String(seriesId)));
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 = {};
// verify required parameter 'seriesId' is not null or undefined
if (seriesId === null || seriesId === undefined) {
throw new Error('Required parameter seriesId was null or undefined when calling getSeasons.');
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (isSpecialSeason !== undefined) {
localVarQueryParameters['isSpecialSeason'] = ObjectSerializer.serialize(isSpecialSeason, "boolean");
}
if (isMissing !== undefined) {
localVarQueryParameters['isMissing'] = ObjectSerializer.serialize(isMissing, "boolean");
}
if (adjacentTo !== undefined) {
localVarQueryParameters['adjacentTo'] = ObjectSerializer.serialize(adjacentTo, "string");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
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: BaseItemDtoQueryResult; }>((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, "BaseItemDtoQueryResult");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @summary Gets a list of upcoming episodes.
* @param userId The user id of the user to get the upcoming episodes for.
* @param startIndex Optional. The record index to start at. All items with a lower index will be dropped from the results.
* @param limit Optional. The maximum number of records to return.
* @param fields Optional. Specify additional fields of information to return in the output.
* @param parentId Optional. Specify this to localize the search to a specific item or folder. Omit to use the root.
* @param enableImages Optional. Include image information in output.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
* @param enableUserData Optional. Include user data.
*/
public async getUpcomingEpisodes (userId?: string, startIndex?: number, limit?: number, fields?: Array<ItemFields>, parentId?: string, enableImages?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, enableUserData?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/Shows/Upcoming';
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 (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (startIndex !== undefined) {
localVarQueryParameters['startIndex'] = ObjectSerializer.serialize(startIndex, "number");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (parentId !== undefined) {
localVarQueryParameters['parentId'] = ObjectSerializer.serialize(parentId, "string");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
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: BaseItemDtoQueryResult; }>((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, "BaseItemDtoQueryResult");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
}