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

563 lines
24 KiB
TypeScript
Raw Permalink 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 {
FontFile,
ProblemDetails,
RemoteSubtitleInfo,
UploadSubtitleRequest,
} from '../models';
import {
FontFileFromJSON,
FontFileToJSON,
ProblemDetailsFromJSON,
ProblemDetailsToJSON,
RemoteSubtitleInfoFromJSON,
RemoteSubtitleInfoToJSON,
UploadSubtitleRequestFromJSON,
UploadSubtitleRequestToJSON,
} from '../models';
export interface DeleteSubtitleRequest {
itemId: string;
index: number;
}
export interface DownloadRemoteSubtitlesRequest {
itemId: string;
subtitleId: string;
}
export interface GetFallbackFontRequest {
name: string;
}
export interface GetRemoteSubtitlesRequest {
id: string;
}
export interface GetSubtitleRequest {
routeItemId: string;
routeMediaSourceId: string;
routeIndex: number;
routeFormat: string;
itemId?: string;
mediaSourceId?: string;
index?: number;
format?: string;
endPositionTicks?: number;
copyTimestamps?: boolean;
addVttTimeMap?: boolean;
startPositionTicks?: number;
}
export interface GetSubtitlePlaylistRequest {
itemId: string;
index: number;
mediaSourceId: string;
segmentLength: number;
}
export interface GetSubtitleWithTicksRequest {
routeItemId: string;
routeMediaSourceId: string;
routeIndex: number;
routeStartPositionTicks: number;
routeFormat: string;
itemId?: string;
mediaSourceId?: string;
index?: number;
startPositionTicks?: number;
format?: string;
endPositionTicks?: number;
copyTimestamps?: boolean;
addVttTimeMap?: boolean;
}
export interface SearchRemoteSubtitlesRequest {
itemId: string;
language: string;
isPerfectMatch?: boolean;
}
export interface UploadSubtitleOperationRequest {
itemId: string;
uploadSubtitleRequest: UploadSubtitleRequest;
}
/**
*
*/
export class SubtitleApi extends runtime.BaseAPI {
/**
* Deletes an external subtitle file.
*/
async deleteSubtitleRaw(requestParameters: DeleteSubtitleRequest, 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 deleteSubtitle.');
}
if (requestParameters.index === null || requestParameters.index === undefined) {
throw new runtime.RequiredError('index','Required parameter requestParameters.index was null or undefined when calling deleteSubtitle.');
}
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: `/Videos/{itemId}/Subtitles/{index}`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))).replace(`{${"index"}}`, encodeURIComponent(String(requestParameters.index))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Deletes an external subtitle file.
*/
async deleteSubtitle(requestParameters: DeleteSubtitleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.deleteSubtitleRaw(requestParameters, initOverrides);
}
/**
* Downloads a remote subtitle.
*/
async downloadRemoteSubtitlesRaw(requestParameters: DownloadRemoteSubtitlesRequest, 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 downloadRemoteSubtitles.');
}
if (requestParameters.subtitleId === null || requestParameters.subtitleId === undefined) {
throw new runtime.RequiredError('subtitleId','Required parameter requestParameters.subtitleId was null or undefined when calling downloadRemoteSubtitles.');
}
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}/RemoteSearch/Subtitles/{subtitleId}`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))).replace(`{${"subtitleId"}}`, encodeURIComponent(String(requestParameters.subtitleId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Downloads a remote subtitle.
*/
async downloadRemoteSubtitles(requestParameters: DownloadRemoteSubtitlesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.downloadRemoteSubtitlesRaw(requestParameters, initOverrides);
}
/**
* Gets a fallback font file.
*/
async getFallbackFontRaw(requestParameters: GetFallbackFontRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>> {
if (requestParameters.name === null || requestParameters.name === undefined) {
throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getFallbackFont.');
}
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: `/FallbackFont/Fonts/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.BlobApiResponse(response);
}
/**
* Gets a fallback font file.
*/
async getFallbackFont(requestParameters: GetFallbackFontRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
const response = await this.getFallbackFontRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Gets a list of available fallback font files.
*/
async getFallbackFontListRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<FontFile>>> {
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: `/FallbackFont/Fonts`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(FontFileFromJSON));
}
/**
* Gets a list of available fallback font files.
*/
async getFallbackFontList(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<FontFile>> {
const response = await this.getFallbackFontListRaw(initOverrides);
return await response.value();
}
/**
* Gets the remote subtitles.
*/
async getRemoteSubtitlesRaw(requestParameters: GetRemoteSubtitlesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>> {
if (requestParameters.id === null || requestParameters.id === undefined) {
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getRemoteSubtitles.');
}
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: `/Providers/Subtitles/Subtitles/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.BlobApiResponse(response);
}
/**
* Gets the remote subtitles.
*/
async getRemoteSubtitles(requestParameters: GetRemoteSubtitlesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
const response = await this.getRemoteSubtitlesRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Gets subtitles in a specified format.
*/
async getSubtitleRaw(requestParameters: GetSubtitleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>> {
if (requestParameters.routeItemId === null || requestParameters.routeItemId === undefined) {
throw new runtime.RequiredError('routeItemId','Required parameter requestParameters.routeItemId was null or undefined when calling getSubtitle.');
}
if (requestParameters.routeMediaSourceId === null || requestParameters.routeMediaSourceId === undefined) {
throw new runtime.RequiredError('routeMediaSourceId','Required parameter requestParameters.routeMediaSourceId was null or undefined when calling getSubtitle.');
}
if (requestParameters.routeIndex === null || requestParameters.routeIndex === undefined) {
throw new runtime.RequiredError('routeIndex','Required parameter requestParameters.routeIndex was null or undefined when calling getSubtitle.');
}
if (requestParameters.routeFormat === null || requestParameters.routeFormat === undefined) {
throw new runtime.RequiredError('routeFormat','Required parameter requestParameters.routeFormat was null or undefined when calling getSubtitle.');
}
const queryParameters: any = {};
if (requestParameters.itemId !== undefined) {
queryParameters['itemId'] = requestParameters.itemId;
}
if (requestParameters.mediaSourceId !== undefined) {
queryParameters['mediaSourceId'] = requestParameters.mediaSourceId;
}
if (requestParameters.index !== undefined) {
queryParameters['index'] = requestParameters.index;
}
if (requestParameters.format !== undefined) {
queryParameters['format'] = requestParameters.format;
}
if (requestParameters.endPositionTicks !== undefined) {
queryParameters['endPositionTicks'] = requestParameters.endPositionTicks;
}
if (requestParameters.copyTimestamps !== undefined) {
queryParameters['copyTimestamps'] = requestParameters.copyTimestamps;
}
if (requestParameters.addVttTimeMap !== undefined) {
queryParameters['addVttTimeMap'] = requestParameters.addVttTimeMap;
}
if (requestParameters.startPositionTicks !== undefined) {
queryParameters['startPositionTicks'] = requestParameters.startPositionTicks;
}
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request({
path: `/Videos/{routeItemId}/{routeMediaSourceId}/Subtitles/{routeIndex}/Stream.{routeFormat}`.replace(`{${"routeItemId"}}`, encodeURIComponent(String(requestParameters.routeItemId))).replace(`{${"routeMediaSourceId"}}`, encodeURIComponent(String(requestParameters.routeMediaSourceId))).replace(`{${"routeIndex"}}`, encodeURIComponent(String(requestParameters.routeIndex))).replace(`{${"routeFormat"}}`, encodeURIComponent(String(requestParameters.routeFormat))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.BlobApiResponse(response);
}
/**
* Gets subtitles in a specified format.
*/
async getSubtitle(requestParameters: GetSubtitleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
const response = await this.getSubtitleRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Gets an HLS subtitle playlist.
*/
async getSubtitlePlaylistRaw(requestParameters: GetSubtitlePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>> {
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getSubtitlePlaylist.');
}
if (requestParameters.index === null || requestParameters.index === undefined) {
throw new runtime.RequiredError('index','Required parameter requestParameters.index was null or undefined when calling getSubtitlePlaylist.');
}
if (requestParameters.mediaSourceId === null || requestParameters.mediaSourceId === undefined) {
throw new runtime.RequiredError('mediaSourceId','Required parameter requestParameters.mediaSourceId was null or undefined when calling getSubtitlePlaylist.');
}
if (requestParameters.segmentLength === null || requestParameters.segmentLength === undefined) {
throw new runtime.RequiredError('segmentLength','Required parameter requestParameters.segmentLength was null or undefined when calling getSubtitlePlaylist.');
}
const queryParameters: any = {};
if (requestParameters.segmentLength !== undefined) {
queryParameters['segmentLength'] = requestParameters.segmentLength;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Videos/{itemId}/{mediaSourceId}/Subtitles/{index}/subtitles.m3u8`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))).replace(`{${"index"}}`, encodeURIComponent(String(requestParameters.index))).replace(`{${"mediaSourceId"}}`, encodeURIComponent(String(requestParameters.mediaSourceId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.BlobApiResponse(response);
}
/**
* Gets an HLS subtitle playlist.
*/
async getSubtitlePlaylist(requestParameters: GetSubtitlePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
const response = await this.getSubtitlePlaylistRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Gets subtitles in a specified format.
*/
async getSubtitleWithTicksRaw(requestParameters: GetSubtitleWithTicksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>> {
if (requestParameters.routeItemId === null || requestParameters.routeItemId === undefined) {
throw new runtime.RequiredError('routeItemId','Required parameter requestParameters.routeItemId was null or undefined when calling getSubtitleWithTicks.');
}
if (requestParameters.routeMediaSourceId === null || requestParameters.routeMediaSourceId === undefined) {
throw new runtime.RequiredError('routeMediaSourceId','Required parameter requestParameters.routeMediaSourceId was null or undefined when calling getSubtitleWithTicks.');
}
if (requestParameters.routeIndex === null || requestParameters.routeIndex === undefined) {
throw new runtime.RequiredError('routeIndex','Required parameter requestParameters.routeIndex was null or undefined when calling getSubtitleWithTicks.');
}
if (requestParameters.routeStartPositionTicks === null || requestParameters.routeStartPositionTicks === undefined) {
throw new runtime.RequiredError('routeStartPositionTicks','Required parameter requestParameters.routeStartPositionTicks was null or undefined when calling getSubtitleWithTicks.');
}
if (requestParameters.routeFormat === null || requestParameters.routeFormat === undefined) {
throw new runtime.RequiredError('routeFormat','Required parameter requestParameters.routeFormat was null or undefined when calling getSubtitleWithTicks.');
}
const queryParameters: any = {};
if (requestParameters.itemId !== undefined) {
queryParameters['itemId'] = requestParameters.itemId;
}
if (requestParameters.mediaSourceId !== undefined) {
queryParameters['mediaSourceId'] = requestParameters.mediaSourceId;
}
if (requestParameters.index !== undefined) {
queryParameters['index'] = requestParameters.index;
}
if (requestParameters.startPositionTicks !== undefined) {
queryParameters['startPositionTicks'] = requestParameters.startPositionTicks;
}
if (requestParameters.format !== undefined) {
queryParameters['format'] = requestParameters.format;
}
if (requestParameters.endPositionTicks !== undefined) {
queryParameters['endPositionTicks'] = requestParameters.endPositionTicks;
}
if (requestParameters.copyTimestamps !== undefined) {
queryParameters['copyTimestamps'] = requestParameters.copyTimestamps;
}
if (requestParameters.addVttTimeMap !== undefined) {
queryParameters['addVttTimeMap'] = requestParameters.addVttTimeMap;
}
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request({
path: `/Videos/{routeItemId}/{routeMediaSourceId}/Subtitles/{routeIndex}/{routeStartPositionTicks}/Stream.{routeFormat}`.replace(`{${"routeItemId"}}`, encodeURIComponent(String(requestParameters.routeItemId))).replace(`{${"routeMediaSourceId"}}`, encodeURIComponent(String(requestParameters.routeMediaSourceId))).replace(`{${"routeIndex"}}`, encodeURIComponent(String(requestParameters.routeIndex))).replace(`{${"routeStartPositionTicks"}}`, encodeURIComponent(String(requestParameters.routeStartPositionTicks))).replace(`{${"routeFormat"}}`, encodeURIComponent(String(requestParameters.routeFormat))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.BlobApiResponse(response);
}
/**
* Gets subtitles in a specified format.
*/
async getSubtitleWithTicks(requestParameters: GetSubtitleWithTicksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
const response = await this.getSubtitleWithTicksRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Search remote subtitles.
*/
async searchRemoteSubtitlesRaw(requestParameters: SearchRemoteSubtitlesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RemoteSubtitleInfo>>> {
if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling searchRemoteSubtitles.');
}
if (requestParameters.language === null || requestParameters.language === undefined) {
throw new runtime.RequiredError('language','Required parameter requestParameters.language was null or undefined when calling searchRemoteSubtitles.');
}
const queryParameters: any = {};
if (requestParameters.isPerfectMatch !== undefined) {
queryParameters['isPerfectMatch'] = requestParameters.isPerfectMatch;
}
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}/RemoteSearch/Subtitles/{language}`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))).replace(`{${"language"}}`, encodeURIComponent(String(requestParameters.language))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(RemoteSubtitleInfoFromJSON));
}
/**
* Search remote subtitles.
*/
async searchRemoteSubtitles(requestParameters: SearchRemoteSubtitlesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RemoteSubtitleInfo>> {
const response = await this.searchRemoteSubtitlesRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Upload an external subtitle file.
*/
async uploadSubtitleRaw(requestParameters: UploadSubtitleOperationRequest, 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 uploadSubtitle.');
}
if (requestParameters.uploadSubtitleRequest === null || requestParameters.uploadSubtitleRequest === undefined) {
throw new runtime.RequiredError('uploadSubtitleRequest','Required parameter requestParameters.uploadSubtitleRequest was null or undefined when calling uploadSubtitle.');
}
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: `/Videos/{itemId}/Subtitles`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: UploadSubtitleRequestToJSON(requestParameters.uploadSubtitleRequest),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Upload an external subtitle file.
*/
async uploadSubtitle(requestParameters: UploadSubtitleOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.uploadSubtitleRaw(requestParameters, initOverrides);
}
}