653 lines
28 KiB
TypeScript
653 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 { AddMediaPathRequest } from '../model/addMediaPathRequest';
|
||
|
import { AddVirtualFolderRequest } from '../model/addVirtualFolderRequest';
|
||
|
import { CollectionTypeOptions } from '../model/collectionTypeOptions';
|
||
|
import { ProblemDetails } from '../model/problemDetails';
|
||
|
import { UpdateLibraryOptionsRequest } from '../model/updateLibraryOptionsRequest';
|
||
|
import { UpdateMediaPathRequest } from '../model/updateMediaPathRequest';
|
||
|
import { VirtualFolderInfo } from '../model/virtualFolderInfo';
|
||
|
|
||
|
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 LibraryStructureApiApiKeys {
|
||
|
CustomAuthentication,
|
||
|
}
|
||
|
|
||
|
export class LibraryStructureApi {
|
||
|
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: LibraryStructureApiApiKeys, value: string) {
|
||
|
(this.authentications as any)[LibraryStructureApiApiKeys[key]].apiKey = value;
|
||
|
}
|
||
|
|
||
|
public addInterceptor(interceptor: Interceptor) {
|
||
|
this.interceptors.push(interceptor);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* @summary Add a media path to a library.
|
||
|
* @param addMediaPathRequest The media path dto.
|
||
|
* @param refreshLibrary Whether to refresh the library.
|
||
|
*/
|
||
|
public async addMediaPath (addMediaPathRequest: AddMediaPathRequest, refreshLibrary?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
||
|
const localVarPath = this.basePath + '/Library/VirtualFolders/Paths';
|
||
|
let localVarQueryParameters: any = {};
|
||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||
|
let localVarFormParams: any = {};
|
||
|
|
||
|
// verify required parameter 'addMediaPathRequest' is not null or undefined
|
||
|
if (addMediaPathRequest === null || addMediaPathRequest === undefined) {
|
||
|
throw new Error('Required parameter addMediaPathRequest was null or undefined when calling addMediaPath.');
|
||
|
}
|
||
|
|
||
|
if (refreshLibrary !== undefined) {
|
||
|
localVarQueryParameters['refreshLibrary'] = ObjectSerializer.serialize(refreshLibrary, "boolean");
|
||
|
}
|
||
|
|
||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
||
|
|
||
|
let localVarUseFormData = false;
|
||
|
|
||
|
let localVarRequestOptions: localVarRequest.Options = {
|
||
|
method: 'POST',
|
||
|
qs: localVarQueryParameters,
|
||
|
headers: localVarHeaderParams,
|
||
|
uri: localVarPath,
|
||
|
useQuerystring: this._useQuerystring,
|
||
|
json: true,
|
||
|
body: ObjectSerializer.serialize(addMediaPathRequest, "AddMediaPathRequest")
|
||
|
};
|
||
|
|
||
|
let authenticationPromise = Promise.resolve();
|
||
|
if (this.authentications.CustomAuthentication.apiKey) {
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.CustomAuthentication.applyToRequest(localVarRequestOptions));
|
||
|
}
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
||
|
|
||
|
let interceptorPromise = authenticationPromise;
|
||
|
for (const interceptor of this.interceptors) {
|
||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
||
|
}
|
||
|
|
||
|
return interceptorPromise.then(() => {
|
||
|
if (Object.keys(localVarFormParams).length) {
|
||
|
if (localVarUseFormData) {
|
||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||
|
} else {
|
||
|
localVarRequestOptions.form = localVarFormParams;
|
||
|
}
|
||
|
}
|
||
|
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
|
||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||
|
if (error) {
|
||
|
reject(error);
|
||
|
} else {
|
||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||
|
resolve({ response: response, body: body });
|
||
|
} else {
|
||
|
reject(new HttpError(response, body, response.statusCode));
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
* @summary Adds a virtual folder.
|
||
|
* @param name The name of the virtual folder.
|
||
|
* @param collectionType The type of the collection.
|
||
|
* @param paths The paths of the virtual folder.
|
||
|
* @param refreshLibrary Whether to refresh the library.
|
||
|
* @param addVirtualFolderRequest The library options.
|
||
|
*/
|
||
|
public async addVirtualFolder (name?: string, collectionType?: CollectionTypeOptions, paths?: Array<string>, refreshLibrary?: boolean, addVirtualFolderRequest?: AddVirtualFolderRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
||
|
const localVarPath = this.basePath + '/Library/VirtualFolders';
|
||
|
let localVarQueryParameters: any = {};
|
||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||
|
let localVarFormParams: any = {};
|
||
|
|
||
|
if (name !== undefined) {
|
||
|
localVarQueryParameters['name'] = ObjectSerializer.serialize(name, "string");
|
||
|
}
|
||
|
|
||
|
if (collectionType !== undefined) {
|
||
|
localVarQueryParameters['collectionType'] = ObjectSerializer.serialize(collectionType, "CollectionTypeOptions");
|
||
|
}
|
||
|
|
||
|
if (paths !== undefined) {
|
||
|
localVarQueryParameters['paths'] = ObjectSerializer.serialize(paths, "Array<string>");
|
||
|
}
|
||
|
|
||
|
if (refreshLibrary !== undefined) {
|
||
|
localVarQueryParameters['refreshLibrary'] = ObjectSerializer.serialize(refreshLibrary, "boolean");
|
||
|
}
|
||
|
|
||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
||
|
|
||
|
let localVarUseFormData = false;
|
||
|
|
||
|
let localVarRequestOptions: localVarRequest.Options = {
|
||
|
method: 'POST',
|
||
|
qs: localVarQueryParameters,
|
||
|
headers: localVarHeaderParams,
|
||
|
uri: localVarPath,
|
||
|
useQuerystring: this._useQuerystring,
|
||
|
json: true,
|
||
|
body: ObjectSerializer.serialize(addVirtualFolderRequest, "AddVirtualFolderRequest")
|
||
|
};
|
||
|
|
||
|
let authenticationPromise = Promise.resolve();
|
||
|
if (this.authentications.CustomAuthentication.apiKey) {
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.CustomAuthentication.applyToRequest(localVarRequestOptions));
|
||
|
}
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
||
|
|
||
|
let interceptorPromise = authenticationPromise;
|
||
|
for (const interceptor of this.interceptors) {
|
||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
||
|
}
|
||
|
|
||
|
return interceptorPromise.then(() => {
|
||
|
if (Object.keys(localVarFormParams).length) {
|
||
|
if (localVarUseFormData) {
|
||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||
|
} else {
|
||
|
localVarRequestOptions.form = localVarFormParams;
|
||
|
}
|
||
|
}
|
||
|
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
|
||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||
|
if (error) {
|
||
|
reject(error);
|
||
|
} else {
|
||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||
|
resolve({ response: response, body: body });
|
||
|
} else {
|
||
|
reject(new HttpError(response, body, response.statusCode));
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
* @summary Gets all virtual folders.
|
||
|
*/
|
||
|
public async getVirtualFolders (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<VirtualFolderInfo>; }> {
|
||
|
const localVarPath = this.basePath + '/Library/VirtualFolders';
|
||
|
let localVarQueryParameters: any = {};
|
||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||
|
const produces = ['application/json', 'application/json; profile=CamelCase', 'application/json; profile=PascalCase'];
|
||
|
// give precedence to 'application/json'
|
||
|
if (produces.indexOf('application/json') >= 0) {
|
||
|
localVarHeaderParams.Accept = 'application/json';
|
||
|
} else {
|
||
|
localVarHeaderParams.Accept = produces.join(',');
|
||
|
}
|
||
|
let localVarFormParams: any = {};
|
||
|
|
||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
||
|
|
||
|
let localVarUseFormData = false;
|
||
|
|
||
|
let localVarRequestOptions: localVarRequest.Options = {
|
||
|
method: 'GET',
|
||
|
qs: localVarQueryParameters,
|
||
|
headers: localVarHeaderParams,
|
||
|
uri: localVarPath,
|
||
|
useQuerystring: this._useQuerystring,
|
||
|
json: true,
|
||
|
};
|
||
|
|
||
|
let authenticationPromise = Promise.resolve();
|
||
|
if (this.authentications.CustomAuthentication.apiKey) {
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.CustomAuthentication.applyToRequest(localVarRequestOptions));
|
||
|
}
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
||
|
|
||
|
let interceptorPromise = authenticationPromise;
|
||
|
for (const interceptor of this.interceptors) {
|
||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
||
|
}
|
||
|
|
||
|
return interceptorPromise.then(() => {
|
||
|
if (Object.keys(localVarFormParams).length) {
|
||
|
if (localVarUseFormData) {
|
||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||
|
} else {
|
||
|
localVarRequestOptions.form = localVarFormParams;
|
||
|
}
|
||
|
}
|
||
|
return new Promise<{ response: http.IncomingMessage; body: Array<VirtualFolderInfo>; }>((resolve, reject) => {
|
||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||
|
if (error) {
|
||
|
reject(error);
|
||
|
} else {
|
||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||
|
body = ObjectSerializer.deserialize(body, "Array<VirtualFolderInfo>");
|
||
|
resolve({ response: response, body: body });
|
||
|
} else {
|
||
|
reject(new HttpError(response, body, response.statusCode));
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
* @summary Remove a media path.
|
||
|
* @param name The name of the library.
|
||
|
* @param path The path to remove.
|
||
|
* @param refreshLibrary Whether to refresh the library.
|
||
|
*/
|
||
|
public async removeMediaPath (name?: string, path?: string, refreshLibrary?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
||
|
const localVarPath = this.basePath + '/Library/VirtualFolders/Paths';
|
||
|
let localVarQueryParameters: any = {};
|
||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||
|
let localVarFormParams: any = {};
|
||
|
|
||
|
if (name !== undefined) {
|
||
|
localVarQueryParameters['name'] = ObjectSerializer.serialize(name, "string");
|
||
|
}
|
||
|
|
||
|
if (path !== undefined) {
|
||
|
localVarQueryParameters['path'] = ObjectSerializer.serialize(path, "string");
|
||
|
}
|
||
|
|
||
|
if (refreshLibrary !== undefined) {
|
||
|
localVarQueryParameters['refreshLibrary'] = ObjectSerializer.serialize(refreshLibrary, "boolean");
|
||
|
}
|
||
|
|
||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
||
|
|
||
|
let localVarUseFormData = false;
|
||
|
|
||
|
let localVarRequestOptions: localVarRequest.Options = {
|
||
|
method: 'DELETE',
|
||
|
qs: localVarQueryParameters,
|
||
|
headers: localVarHeaderParams,
|
||
|
uri: localVarPath,
|
||
|
useQuerystring: this._useQuerystring,
|
||
|
json: true,
|
||
|
};
|
||
|
|
||
|
let authenticationPromise = Promise.resolve();
|
||
|
if (this.authentications.CustomAuthentication.apiKey) {
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.CustomAuthentication.applyToRequest(localVarRequestOptions));
|
||
|
}
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
||
|
|
||
|
let interceptorPromise = authenticationPromise;
|
||
|
for (const interceptor of this.interceptors) {
|
||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
||
|
}
|
||
|
|
||
|
return interceptorPromise.then(() => {
|
||
|
if (Object.keys(localVarFormParams).length) {
|
||
|
if (localVarUseFormData) {
|
||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||
|
} else {
|
||
|
localVarRequestOptions.form = localVarFormParams;
|
||
|
}
|
||
|
}
|
||
|
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
|
||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||
|
if (error) {
|
||
|
reject(error);
|
||
|
} else {
|
||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||
|
resolve({ response: response, body: body });
|
||
|
} else {
|
||
|
reject(new HttpError(response, body, response.statusCode));
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
* @summary Removes a virtual folder.
|
||
|
* @param name The name of the folder.
|
||
|
* @param refreshLibrary Whether to refresh the library.
|
||
|
*/
|
||
|
public async removeVirtualFolder (name?: string, refreshLibrary?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
||
|
const localVarPath = this.basePath + '/Library/VirtualFolders';
|
||
|
let localVarQueryParameters: any = {};
|
||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||
|
let localVarFormParams: any = {};
|
||
|
|
||
|
if (name !== undefined) {
|
||
|
localVarQueryParameters['name'] = ObjectSerializer.serialize(name, "string");
|
||
|
}
|
||
|
|
||
|
if (refreshLibrary !== undefined) {
|
||
|
localVarQueryParameters['refreshLibrary'] = ObjectSerializer.serialize(refreshLibrary, "boolean");
|
||
|
}
|
||
|
|
||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
||
|
|
||
|
let localVarUseFormData = false;
|
||
|
|
||
|
let localVarRequestOptions: localVarRequest.Options = {
|
||
|
method: 'DELETE',
|
||
|
qs: localVarQueryParameters,
|
||
|
headers: localVarHeaderParams,
|
||
|
uri: localVarPath,
|
||
|
useQuerystring: this._useQuerystring,
|
||
|
json: true,
|
||
|
};
|
||
|
|
||
|
let authenticationPromise = Promise.resolve();
|
||
|
if (this.authentications.CustomAuthentication.apiKey) {
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.CustomAuthentication.applyToRequest(localVarRequestOptions));
|
||
|
}
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
||
|
|
||
|
let interceptorPromise = authenticationPromise;
|
||
|
for (const interceptor of this.interceptors) {
|
||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
||
|
}
|
||
|
|
||
|
return interceptorPromise.then(() => {
|
||
|
if (Object.keys(localVarFormParams).length) {
|
||
|
if (localVarUseFormData) {
|
||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||
|
} else {
|
||
|
localVarRequestOptions.form = localVarFormParams;
|
||
|
}
|
||
|
}
|
||
|
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
|
||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||
|
if (error) {
|
||
|
reject(error);
|
||
|
} else {
|
||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||
|
resolve({ response: response, body: body });
|
||
|
} else {
|
||
|
reject(new HttpError(response, body, response.statusCode));
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
* @summary Renames a virtual folder.
|
||
|
* @param name The name of the virtual folder.
|
||
|
* @param newName The new name.
|
||
|
* @param refreshLibrary Whether to refresh the library.
|
||
|
*/
|
||
|
public async renameVirtualFolder (name?: string, newName?: string, refreshLibrary?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
||
|
const localVarPath = this.basePath + '/Library/VirtualFolders/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 = {};
|
||
|
|
||
|
if (name !== undefined) {
|
||
|
localVarQueryParameters['name'] = ObjectSerializer.serialize(name, "string");
|
||
|
}
|
||
|
|
||
|
if (newName !== undefined) {
|
||
|
localVarQueryParameters['newName'] = ObjectSerializer.serialize(newName, "string");
|
||
|
}
|
||
|
|
||
|
if (refreshLibrary !== undefined) {
|
||
|
localVarQueryParameters['refreshLibrary'] = ObjectSerializer.serialize(refreshLibrary, "boolean");
|
||
|
}
|
||
|
|
||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
||
|
|
||
|
let localVarUseFormData = false;
|
||
|
|
||
|
let localVarRequestOptions: localVarRequest.Options = {
|
||
|
method: 'POST',
|
||
|
qs: localVarQueryParameters,
|
||
|
headers: localVarHeaderParams,
|
||
|
uri: localVarPath,
|
||
|
useQuerystring: this._useQuerystring,
|
||
|
json: true,
|
||
|
};
|
||
|
|
||
|
let authenticationPromise = Promise.resolve();
|
||
|
if (this.authentications.CustomAuthentication.apiKey) {
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.CustomAuthentication.applyToRequest(localVarRequestOptions));
|
||
|
}
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
||
|
|
||
|
let interceptorPromise = authenticationPromise;
|
||
|
for (const interceptor of this.interceptors) {
|
||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
||
|
}
|
||
|
|
||
|
return interceptorPromise.then(() => {
|
||
|
if (Object.keys(localVarFormParams).length) {
|
||
|
if (localVarUseFormData) {
|
||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||
|
} else {
|
||
|
localVarRequestOptions.form = localVarFormParams;
|
||
|
}
|
||
|
}
|
||
|
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
|
||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||
|
if (error) {
|
||
|
reject(error);
|
||
|
} else {
|
||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||
|
resolve({ response: response, body: body });
|
||
|
} else {
|
||
|
reject(new HttpError(response, body, response.statusCode));
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
* @summary Update library options.
|
||
|
* @param updateLibraryOptionsRequest The library name and options.
|
||
|
*/
|
||
|
public async updateLibraryOptions (updateLibraryOptionsRequest?: UpdateLibraryOptionsRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
||
|
const localVarPath = this.basePath + '/Library/VirtualFolders/LibraryOptions';
|
||
|
let localVarQueryParameters: any = {};
|
||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||
|
let localVarFormParams: any = {};
|
||
|
|
||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
||
|
|
||
|
let localVarUseFormData = false;
|
||
|
|
||
|
let localVarRequestOptions: localVarRequest.Options = {
|
||
|
method: 'POST',
|
||
|
qs: localVarQueryParameters,
|
||
|
headers: localVarHeaderParams,
|
||
|
uri: localVarPath,
|
||
|
useQuerystring: this._useQuerystring,
|
||
|
json: true,
|
||
|
body: ObjectSerializer.serialize(updateLibraryOptionsRequest, "UpdateLibraryOptionsRequest")
|
||
|
};
|
||
|
|
||
|
let authenticationPromise = Promise.resolve();
|
||
|
if (this.authentications.CustomAuthentication.apiKey) {
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.CustomAuthentication.applyToRequest(localVarRequestOptions));
|
||
|
}
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
||
|
|
||
|
let interceptorPromise = authenticationPromise;
|
||
|
for (const interceptor of this.interceptors) {
|
||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
||
|
}
|
||
|
|
||
|
return interceptorPromise.then(() => {
|
||
|
if (Object.keys(localVarFormParams).length) {
|
||
|
if (localVarUseFormData) {
|
||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||
|
} else {
|
||
|
localVarRequestOptions.form = localVarFormParams;
|
||
|
}
|
||
|
}
|
||
|
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
|
||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||
|
if (error) {
|
||
|
reject(error);
|
||
|
} else {
|
||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||
|
resolve({ response: response, body: body });
|
||
|
} else {
|
||
|
reject(new HttpError(response, body, response.statusCode));
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
* @summary Updates a media path.
|
||
|
* @param updateMediaPathRequest The name of the library and path infos.
|
||
|
*/
|
||
|
public async updateMediaPath (updateMediaPathRequest: UpdateMediaPathRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
||
|
const localVarPath = this.basePath + '/Library/VirtualFolders/Paths/Update';
|
||
|
let localVarQueryParameters: any = {};
|
||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||
|
let localVarFormParams: any = {};
|
||
|
|
||
|
// verify required parameter 'updateMediaPathRequest' is not null or undefined
|
||
|
if (updateMediaPathRequest === null || updateMediaPathRequest === undefined) {
|
||
|
throw new Error('Required parameter updateMediaPathRequest was null or undefined when calling updateMediaPath.');
|
||
|
}
|
||
|
|
||
|
(<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(updateMediaPathRequest, "UpdateMediaPathRequest")
|
||
|
};
|
||
|
|
||
|
let authenticationPromise = Promise.resolve();
|
||
|
if (this.authentications.CustomAuthentication.apiKey) {
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.CustomAuthentication.applyToRequest(localVarRequestOptions));
|
||
|
}
|
||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
||
|
|
||
|
let interceptorPromise = authenticationPromise;
|
||
|
for (const interceptor of this.interceptors) {
|
||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
||
|
}
|
||
|
|
||
|
return interceptorPromise.then(() => {
|
||
|
if (Object.keys(localVarFormParams).length) {
|
||
|
if (localVarUseFormData) {
|
||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||
|
} else {
|
||
|
localVarRequestOptions.form = localVarFormParams;
|
||
|
}
|
||
|
}
|
||
|
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
|
||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||
|
if (error) {
|
||
|
reject(error);
|
||
|
} else {
|
||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||
|
resolve({ response: response, body: body });
|
||
|
} else {
|
||
|
reject(new HttpError(response, body, response.statusCode));
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
}
|