269 lines
9.7 KiB
TypeScript
269 lines
9.7 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 {
|
|
PackageInfo,
|
|
ProblemDetails,
|
|
RepositoryInfo,
|
|
} from '../models';
|
|
import {
|
|
PackageInfoFromJSON,
|
|
PackageInfoToJSON,
|
|
ProblemDetailsFromJSON,
|
|
ProblemDetailsToJSON,
|
|
RepositoryInfoFromJSON,
|
|
RepositoryInfoToJSON,
|
|
} from '../models';
|
|
|
|
export interface CancelPackageInstallationRequest {
|
|
packageId: string;
|
|
}
|
|
|
|
export interface GetPackageInfoRequest {
|
|
name: string;
|
|
assemblyGuid?: string;
|
|
}
|
|
|
|
export interface InstallPackageRequest {
|
|
name: string;
|
|
assemblyGuid?: string;
|
|
version?: string;
|
|
repositoryUrl?: string;
|
|
}
|
|
|
|
export interface SetRepositoriesRequest {
|
|
repositoryInfo: Array<RepositoryInfo>;
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
export class PackageApi extends runtime.BaseAPI {
|
|
|
|
/**
|
|
* Cancels a package installation.
|
|
*/
|
|
async cancelPackageInstallationRaw(requestParameters: CancelPackageInstallationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
if (requestParameters.packageId === null || requestParameters.packageId === undefined) {
|
|
throw new runtime.RequiredError('packageId','Required parameter requestParameters.packageId was null or undefined when calling cancelPackageInstallation.');
|
|
}
|
|
|
|
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: `/Packages/Installing/{packageId}`.replace(`{${"packageId"}}`, encodeURIComponent(String(requestParameters.packageId))),
|
|
method: 'DELETE',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Cancels a package installation.
|
|
*/
|
|
async cancelPackageInstallation(requestParameters: CancelPackageInstallationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.cancelPackageInstallationRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
/**
|
|
* Gets a package by name or assembly GUID.
|
|
*/
|
|
async getPackageInfoRaw(requestParameters: GetPackageInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PackageInfo>> {
|
|
if (requestParameters.name === null || requestParameters.name === undefined) {
|
|
throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getPackageInfo.');
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters.assemblyGuid !== undefined) {
|
|
queryParameters['assemblyGuid'] = requestParameters.assemblyGuid;
|
|
}
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Packages/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
|
|
method: 'GET',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => PackageInfoFromJSON(jsonValue));
|
|
}
|
|
|
|
/**
|
|
* Gets a package by name or assembly GUID.
|
|
*/
|
|
async getPackageInfo(requestParameters: GetPackageInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PackageInfo> {
|
|
const response = await this.getPackageInfoRaw(requestParameters, initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Gets available packages.
|
|
*/
|
|
async getPackagesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<PackageInfo>>> {
|
|
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: `/Packages`,
|
|
method: 'GET',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PackageInfoFromJSON));
|
|
}
|
|
|
|
/**
|
|
* Gets available packages.
|
|
*/
|
|
async getPackages(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<PackageInfo>> {
|
|
const response = await this.getPackagesRaw(initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Gets all package repositories.
|
|
*/
|
|
async getRepositoriesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RepositoryInfo>>> {
|
|
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: `/Repositories`,
|
|
method: 'GET',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(RepositoryInfoFromJSON));
|
|
}
|
|
|
|
/**
|
|
* Gets all package repositories.
|
|
*/
|
|
async getRepositories(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RepositoryInfo>> {
|
|
const response = await this.getRepositoriesRaw(initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Installs a package.
|
|
*/
|
|
async installPackageRaw(requestParameters: InstallPackageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
if (requestParameters.name === null || requestParameters.name === undefined) {
|
|
throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling installPackage.');
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters.assemblyGuid !== undefined) {
|
|
queryParameters['assemblyGuid'] = requestParameters.assemblyGuid;
|
|
}
|
|
|
|
if (requestParameters.version !== undefined) {
|
|
queryParameters['version'] = requestParameters.version;
|
|
}
|
|
|
|
if (requestParameters.repositoryUrl !== undefined) {
|
|
queryParameters['repositoryUrl'] = requestParameters.repositoryUrl;
|
|
}
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
|
|
}
|
|
|
|
const response = await this.request({
|
|
path: `/Packages/Installed/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Installs a package.
|
|
*/
|
|
async installPackage(requestParameters: InstallPackageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.installPackageRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
/**
|
|
* Sets the enabled and existing package repositories.
|
|
*/
|
|
async setRepositoriesRaw(requestParameters: SetRepositoriesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
if (requestParameters.repositoryInfo === null || requestParameters.repositoryInfo === undefined) {
|
|
throw new runtime.RequiredError('repositoryInfo','Required parameter requestParameters.repositoryInfo was null or undefined when calling setRepositories.');
|
|
}
|
|
|
|
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: `/Repositories`,
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
body: requestParameters.repositoryInfo.map(RepositoryInfoToJSON),
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Sets the enabled and existing package repositories.
|
|
*/
|
|
async setRepositories(requestParameters: SetRepositoriesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.setRepositoriesRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
}
|