jellyfin-discord-bot/jellyfin/api/instantMixApi.ts
2023-04-15 22:02:40 +02:00

957 lines
44 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 { 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 InstantMixApiApiKeys {
CustomAuthentication,
}
export class InstantMixApi {
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: InstantMixApiApiKeys, value: string) {
(this.authentications as any)[InstantMixApiApiKeys[key]].apiKey = value;
}
public addInterceptor(interceptor: Interceptor) {
this.interceptors.push(interceptor);
}
/**
*
* @summary Creates an instant playlist based on a given album.
* @param id The item id.
* @param userId Optional. Filter by user id, and attach user data.
* @param limit Optional. The maximum number of records to return.
* @param fields Optional. Specify additional fields of information to return in the output.
* @param enableImages Optional. Include image information in output.
* @param enableUserData Optional. Include user data.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
*/
public async getInstantMixFromAlbum (id: string, userId?: string, limit?: number, fields?: Array<ItemFields>, enableImages?: boolean, enableUserData?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/Albums/{id}/InstantMix'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
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 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getInstantMixFromAlbum.');
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
(<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 Creates an instant playlist based on a given artist.
* @param id The item id.
* @param userId Optional. Filter by user id, and attach user data.
* @param limit Optional. The maximum number of records to return.
* @param fields Optional. Specify additional fields of information to return in the output.
* @param enableImages Optional. Include image information in output.
* @param enableUserData Optional. Include user data.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
*/
public async getInstantMixFromArtists (id: string, userId?: string, limit?: number, fields?: Array<ItemFields>, enableImages?: boolean, enableUserData?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/Artists/{id}/InstantMix'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
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 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getInstantMixFromArtists.');
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
(<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 Creates an instant playlist based on a given artist.
* @param id The item id.
* @param userId Optional. Filter by user id, and attach user data.
* @param limit Optional. The maximum number of records to return.
* @param fields Optional. Specify additional fields of information to return in the output.
* @param enableImages Optional. Include image information in output.
* @param enableUserData Optional. Include user data.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
*/
public async getInstantMixFromArtists2 (id: string, userId?: string, limit?: number, fields?: Array<ItemFields>, enableImages?: boolean, enableUserData?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/Artists/InstantMix';
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 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getInstantMixFromArtists2.');
}
if (id !== undefined) {
localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string");
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
(<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 Creates an instant playlist based on a given item.
* @param id The item id.
* @param userId Optional. Filter by user id, and attach user data.
* @param limit Optional. The maximum number of records to return.
* @param fields Optional. Specify additional fields of information to return in the output.
* @param enableImages Optional. Include image information in output.
* @param enableUserData Optional. Include user data.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
*/
public async getInstantMixFromItem (id: string, userId?: string, limit?: number, fields?: Array<ItemFields>, enableImages?: boolean, enableUserData?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/Items/{id}/InstantMix'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
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 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getInstantMixFromItem.');
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
(<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 Creates an instant playlist based on a given genre.
* @param id The item id.
* @param userId Optional. Filter by user id, and attach user data.
* @param limit Optional. The maximum number of records to return.
* @param fields Optional. Specify additional fields of information to return in the output.
* @param enableImages Optional. Include image information in output.
* @param enableUserData Optional. Include user data.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
*/
public async getInstantMixFromMusicGenreById (id: string, userId?: string, limit?: number, fields?: Array<ItemFields>, enableImages?: boolean, enableUserData?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/MusicGenres/InstantMix';
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 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getInstantMixFromMusicGenreById.');
}
if (id !== undefined) {
localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string");
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
(<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 Creates an instant playlist based on a given genre.
* @param name The genre name.
* @param userId Optional. Filter by user id, and attach user data.
* @param limit Optional. The maximum number of records to return.
* @param fields Optional. Specify additional fields of information to return in the output.
* @param enableImages Optional. Include image information in output.
* @param enableUserData Optional. Include user data.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
*/
public async getInstantMixFromMusicGenreByName (name: string, userId?: string, limit?: number, fields?: Array<ItemFields>, enableImages?: boolean, enableUserData?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/MusicGenres/{name}/InstantMix'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)));
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 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling getInstantMixFromMusicGenreByName.');
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
(<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 Creates an instant playlist based on a given playlist.
* @param id The item id.
* @param userId Optional. Filter by user id, and attach user data.
* @param limit Optional. The maximum number of records to return.
* @param fields Optional. Specify additional fields of information to return in the output.
* @param enableImages Optional. Include image information in output.
* @param enableUserData Optional. Include user data.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
*/
public async getInstantMixFromPlaylist (id: string, userId?: string, limit?: number, fields?: Array<ItemFields>, enableImages?: boolean, enableUserData?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/Playlists/{id}/InstantMix'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
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 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getInstantMixFromPlaylist.');
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
(<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 Creates an instant playlist based on a given song.
* @param id The item id.
* @param userId Optional. Filter by user id, and attach user data.
* @param limit Optional. The maximum number of records to return.
* @param fields Optional. Specify additional fields of information to return in the output.
* @param enableImages Optional. Include image information in output.
* @param enableUserData Optional. Include user data.
* @param imageTypeLimit Optional. The max number of images to return, per image type.
* @param enableImageTypes Optional. The image types to include in the output.
*/
public async getInstantMixFromSong (id: string, userId?: string, limit?: number, fields?: Array<ItemFields>, enableImages?: boolean, enableUserData?: boolean, imageTypeLimit?: number, enableImageTypes?: Array<ImageType>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BaseItemDtoQueryResult; }> {
const localVarPath = this.basePath + '/Songs/{id}/InstantMix'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
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 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getInstantMixFromSong.');
}
if (userId !== undefined) {
localVarQueryParameters['userId'] = ObjectSerializer.serialize(userId, "string");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (fields !== undefined) {
localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array<ItemFields>");
}
if (enableImages !== undefined) {
localVarQueryParameters['enableImages'] = ObjectSerializer.serialize(enableImages, "boolean");
}
if (enableUserData !== undefined) {
localVarQueryParameters['enableUserData'] = ObjectSerializer.serialize(enableUserData, "boolean");
}
if (imageTypeLimit !== undefined) {
localVarQueryParameters['imageTypeLimit'] = ObjectSerializer.serialize(imageTypeLimit, "number");
}
if (enableImageTypes !== undefined) {
localVarQueryParameters['enableImageTypes'] = ObjectSerializer.serialize(enableImageTypes, "Array<ImageType>");
}
(<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));
}
}
});
});
});
}
}