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

97 lines
3.1 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 {
BaseItemDtoQueryResult,
BaseItemKind,
} from '../models';
import {
BaseItemDtoQueryResultFromJSON,
BaseItemDtoQueryResultToJSON,
BaseItemKindFromJSON,
BaseItemKindToJSON,
} from '../models';
export interface GetSuggestionsRequest {
userId: string;
mediaType?: Array<string>;
type?: Array<BaseItemKind>;
startIndex?: number;
limit?: number;
enableTotalRecordCount?: boolean;
}
/**
*
*/
export class SuggestionsApi extends runtime.BaseAPI {
/**
* Gets suggestions.
*/
async getSuggestionsRaw(requestParameters: GetSuggestionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDtoQueryResult>> {
if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getSuggestions.');
}
const queryParameters: any = {};
if (requestParameters.mediaType) {
queryParameters['mediaType'] = requestParameters.mediaType;
}
if (requestParameters.type) {
queryParameters['type'] = requestParameters.type;
}
if (requestParameters.startIndex !== undefined) {
queryParameters['startIndex'] = requestParameters.startIndex;
}
if (requestParameters.limit !== undefined) {
queryParameters['limit'] = requestParameters.limit;
}
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: `/Users/{userId}/Suggestions`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => BaseItemDtoQueryResultFromJSON(jsonValue));
}
/**
* Gets suggestions.
*/
async getSuggestions(requestParameters: GetSuggestionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
const response = await this.getSuggestionsRaw(requestParameters, initOverrides);
return await response.value();
}
}