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

200 lines
6.2 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 {
BaseItemDto,
BaseItemDtoQueryResult,
BaseItemKind,
ImageType,
ItemFields,
ProblemDetails,
SortOrder,
} from '../models';
import {
BaseItemDtoFromJSON,
BaseItemDtoToJSON,
BaseItemDtoQueryResultFromJSON,
BaseItemDtoQueryResultToJSON,
BaseItemKindFromJSON,
BaseItemKindToJSON,
ImageTypeFromJSON,
ImageTypeToJSON,
ItemFieldsFromJSON,
ItemFieldsToJSON,
ProblemDetailsFromJSON,
ProblemDetailsToJSON,
SortOrderFromJSON,
SortOrderToJSON,
} from '../models';
export interface GetYearRequest {
year: number;
userId?: string;
}
export interface GetYearsRequest {
startIndex?: number;
limit?: number;
sortOrder?: Array<SortOrder>;
parentId?: string;
fields?: Array<ItemFields>;
excludeItemTypes?: Array<BaseItemKind>;
includeItemTypes?: Array<BaseItemKind>;
mediaTypes?: Array<string>;
sortBy?: Array<string>;
enableUserData?: boolean;
imageTypeLimit?: number;
enableImageTypes?: Array<ImageType>;
userId?: string;
recursive?: boolean;
enableImages?: boolean;
}
/**
*
*/
export class YearsApi extends runtime.BaseAPI {
/**
* Gets a year.
*/
async getYearRaw(requestParameters: GetYearRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDto>> {
if (requestParameters.year === null || requestParameters.year === undefined) {
throw new runtime.RequiredError('year','Required parameter requestParameters.year was null or undefined when calling getYear.');
}
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: `/Years/{year}`.replace(`{${"year"}}`, encodeURIComponent(String(requestParameters.year))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => BaseItemDtoFromJSON(jsonValue));
}
/**
* Gets a year.
*/
async getYear(requestParameters: GetYearRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDto> {
const response = await this.getYearRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get years.
*/
async getYearsRaw(requestParameters: GetYearsRequest, 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.sortOrder) {
queryParameters['sortOrder'] = requestParameters.sortOrder;
}
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.mediaTypes) {
queryParameters['mediaTypes'] = requestParameters.mediaTypes;
}
if (requestParameters.sortBy) {
queryParameters['sortBy'] = requestParameters.sortBy;
}
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.recursive !== undefined) {
queryParameters['recursive'] = requestParameters.recursive;
}
if (requestParameters.enableImages !== undefined) {
queryParameters['enableImages'] = requestParameters.enableImages;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Years`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => BaseItemDtoQueryResultFromJSON(jsonValue));
}
/**
* Get years.
*/
async getYears(requestParameters: GetYearsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
const response = await this.getYearsRaw(requestParameters, initOverrides);
return await response.value();
}
}