jellyfin-discord-bot/server/jellyfin/apis/RemoteImageApi.ts

192 lines
7.0 KiB
TypeScript
Raw Normal View History

2023-05-04 23:34:53 +02:00
/* 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 {
ImageProviderInfo,
ImageType,
ProblemDetails,
RemoteImageResult,
} from '../models';
import {
ImageProviderInfoFromJSON,
ImageProviderInfoToJSON,
ImageTypeFromJSON,
ImageTypeToJSON,
ProblemDetailsFromJSON,
ProblemDetailsToJSON,
RemoteImageResultFromJSON,
RemoteImageResultToJSON,
} from '../models';
export interface DownloadRemoteImageRequest {
itemId: string;
type: ImageType;
imageUrl?: string;
}
export interface GetRemoteImageProvidersRequest {
itemId: string;
}
export interface GetRemoteImagesRequest {
itemId: string;
type?: ImageType;
startIndex?: number;
limit?: number;
providerName?: string;
includeAllLanguages?: boolean;
}
/**
*
*/
export class RemoteImageApi extends runtime.BaseAPI {
/**
* Downloads a remote image for an item.
*/
async downloadRemoteImageRaw(requestParameters: DownloadRemoteImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling downloadRemoteImage.');
}
if (requestParameters.type === null || requestParameters.type === undefined) {
throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling downloadRemoteImage.');
}
const queryParameters: any = {};
if (requestParameters.type !== undefined) {
queryParameters['type'] = requestParameters.type;
}
if (requestParameters.imageUrl !== undefined) {
queryParameters['imageUrl'] = requestParameters.imageUrl;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Items/{itemId}/RemoteImages/Download`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Downloads a remote image for an item.
*/
async downloadRemoteImage(requestParameters: DownloadRemoteImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.downloadRemoteImageRaw(requestParameters, initOverrides);
}
/**
* Gets available remote image providers for an item.
*/
async getRemoteImageProvidersRaw(requestParameters: GetRemoteImageProvidersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ImageProviderInfo>>> {
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getRemoteImageProviders.');
}
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: `/Items/{itemId}/RemoteImages/Providers`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ImageProviderInfoFromJSON));
}
/**
* Gets available remote image providers for an item.
*/
async getRemoteImageProviders(requestParameters: GetRemoteImageProvidersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ImageProviderInfo>> {
const response = await this.getRemoteImageProvidersRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Gets available remote images for an item.
*/
async getRemoteImagesRaw(requestParameters: GetRemoteImagesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RemoteImageResult>> {
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getRemoteImages.');
}
const queryParameters: any = {};
if (requestParameters.type !== undefined) {
queryParameters['type'] = requestParameters.type;
}
if (requestParameters.startIndex !== undefined) {
queryParameters['startIndex'] = requestParameters.startIndex;
}
if (requestParameters.limit !== undefined) {
queryParameters['limit'] = requestParameters.limit;
}
if (requestParameters.providerName !== undefined) {
queryParameters['providerName'] = requestParameters.providerName;
}
if (requestParameters.includeAllLanguages !== undefined) {
queryParameters['includeAllLanguages'] = requestParameters.includeAllLanguages;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Items/{itemId}/RemoteImages`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => RemoteImageResultFromJSON(jsonValue));
}
/**
* Gets available remote images for an item.
*/
async getRemoteImages(requestParameters: GetRemoteImagesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RemoteImageResult> {
const response = await this.getRemoteImagesRaw(requestParameters, initOverrides);
return await response.value();
}
}