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

204 lines
6.8 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 {
BaseItemDto,
BaseItemDtoQueryResult,
BaseItemKind,
ImageType,
ItemFields,
} from '../models';
import {
BaseItemDtoFromJSON,
BaseItemDtoToJSON,
BaseItemDtoQueryResultFromJSON,
BaseItemDtoQueryResultToJSON,
BaseItemKindFromJSON,
BaseItemKindToJSON,
ImageTypeFromJSON,
ImageTypeToJSON,
ItemFieldsFromJSON,
ItemFieldsToJSON,
} from '../models';
export interface GetStudioRequest {
name: string;
userId?: string;
}
export interface GetStudiosRequest {
startIndex?: number;
limit?: number;
searchTerm?: string;
parentId?: string;
fields?: Array<ItemFields>;
excludeItemTypes?: Array<BaseItemKind>;
includeItemTypes?: Array<BaseItemKind>;
isFavorite?: boolean;
enableUserData?: boolean;
imageTypeLimit?: number;
enableImageTypes?: Array<ImageType>;
userId?: string;
nameStartsWithOrGreater?: string;
nameStartsWith?: string;
nameLessThan?: string;
enableImages?: boolean;
enableTotalRecordCount?: boolean;
}
/**
*
*/
export class StudiosApi extends runtime.BaseAPI {
/**
* Gets a studio by name.
*/
async getStudioRaw(requestParameters: GetStudioRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDto>> {
if (requestParameters.name === null || requestParameters.name === undefined) {
throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getStudio.');
}
const queryParameters: any = {};
if (requestParameters.userId !== undefined) {
queryParameters['userId'] = requestParameters.userId;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Studios/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => BaseItemDtoFromJSON(jsonValue));
}
/**
* Gets a studio by name.
*/
async getStudio(requestParameters: GetStudioRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDto> {
const response = await this.getStudioRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Gets all studios from a given item, folder, or the entire library.
*/
async getStudiosRaw(requestParameters: GetStudiosRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDtoQueryResult>> {
const queryParameters: any = {};
if (requestParameters.startIndex !== undefined) {
queryParameters['startIndex'] = requestParameters.startIndex;
}
if (requestParameters.limit !== undefined) {
queryParameters['limit'] = requestParameters.limit;
}
if (requestParameters.searchTerm !== undefined) {
queryParameters['searchTerm'] = requestParameters.searchTerm;
}
if (requestParameters.parentId !== undefined) {
queryParameters['parentId'] = requestParameters.parentId;
}
if (requestParameters.fields) {
queryParameters['fields'] = requestParameters.fields;
}
if (requestParameters.excludeItemTypes) {
queryParameters['excludeItemTypes'] = requestParameters.excludeItemTypes;
}
if (requestParameters.includeItemTypes) {
queryParameters['includeItemTypes'] = requestParameters.includeItemTypes;
}
if (requestParameters.isFavorite !== undefined) {
queryParameters['isFavorite'] = requestParameters.isFavorite;
}
if (requestParameters.enableUserData !== undefined) {
queryParameters['enableUserData'] = requestParameters.enableUserData;
}
if (requestParameters.imageTypeLimit !== undefined) {
queryParameters['imageTypeLimit'] = requestParameters.imageTypeLimit;
}
if (requestParameters.enableImageTypes) {
queryParameters['enableImageTypes'] = requestParameters.enableImageTypes;
}
if (requestParameters.userId !== undefined) {
queryParameters['userId'] = requestParameters.userId;
}
if (requestParameters.nameStartsWithOrGreater !== undefined) {
queryParameters['nameStartsWithOrGreater'] = requestParameters.nameStartsWithOrGreater;
}
if (requestParameters.nameStartsWith !== undefined) {
queryParameters['nameStartsWith'] = requestParameters.nameStartsWith;
}
if (requestParameters.nameLessThan !== undefined) {
queryParameters['nameLessThan'] = requestParameters.nameLessThan;
}
if (requestParameters.enableImages !== undefined) {
queryParameters['enableImages'] = requestParameters.enableImages;
}
if (requestParameters.enableTotalRecordCount !== undefined) {
queryParameters['enableTotalRecordCount'] = requestParameters.enableTotalRecordCount;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Studios`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => BaseItemDtoQueryResultFromJSON(jsonValue));
}
/**
* Gets all studios from a given item, folder, or the entire library.
*/
async getStudios(requestParameters: GetStudiosRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
const response = await this.getStudiosRaw(requestParameters, initOverrides);
return await response.value();
}
}