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

161 lines
5.1 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 {
BaseItemKind,
SearchHintResult,
} from '../models';
import {
BaseItemKindFromJSON,
BaseItemKindToJSON,
SearchHintResultFromJSON,
SearchHintResultToJSON,
} from '../models';
export interface GetRequest {
searchTerm: string;
startIndex?: number;
limit?: number;
userId?: string;
includeItemTypes?: Array<BaseItemKind>;
excludeItemTypes?: Array<BaseItemKind>;
mediaTypes?: Array<string>;
parentId?: string;
isMovie?: boolean;
isSeries?: boolean;
isNews?: boolean;
isKids?: boolean;
isSports?: boolean;
includePeople?: boolean;
includeMedia?: boolean;
includeGenres?: boolean;
includeStudios?: boolean;
includeArtists?: boolean;
}
/**
*
*/
export class SearchApi extends runtime.BaseAPI {
/**
* Gets the search hint result.
*/
async getRaw(requestParameters: GetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SearchHintResult>> {
if (requestParameters.searchTerm === null || requestParameters.searchTerm === undefined) {
throw new runtime.RequiredError('searchTerm','Required parameter requestParameters.searchTerm was null or undefined when calling get.');
}
const queryParameters: any = {};
if (requestParameters.startIndex !== undefined) {
queryParameters['startIndex'] = requestParameters.startIndex;
}
if (requestParameters.limit !== undefined) {
queryParameters['limit'] = requestParameters.limit;
}
if (requestParameters.userId !== undefined) {
queryParameters['userId'] = requestParameters.userId;
}
if (requestParameters.searchTerm !== undefined) {
queryParameters['searchTerm'] = requestParameters.searchTerm;
}
if (requestParameters.includeItemTypes) {
queryParameters['includeItemTypes'] = requestParameters.includeItemTypes;
}
if (requestParameters.excludeItemTypes) {
queryParameters['excludeItemTypes'] = requestParameters.excludeItemTypes;
}
if (requestParameters.mediaTypes) {
queryParameters['mediaTypes'] = requestParameters.mediaTypes;
}
if (requestParameters.parentId !== undefined) {
queryParameters['parentId'] = requestParameters.parentId;
}
if (requestParameters.isMovie !== undefined) {
queryParameters['isMovie'] = requestParameters.isMovie;
}
if (requestParameters.isSeries !== undefined) {
queryParameters['isSeries'] = requestParameters.isSeries;
}
if (requestParameters.isNews !== undefined) {
queryParameters['isNews'] = requestParameters.isNews;
}
if (requestParameters.isKids !== undefined) {
queryParameters['isKids'] = requestParameters.isKids;
}
if (requestParameters.isSports !== undefined) {
queryParameters['isSports'] = requestParameters.isSports;
}
if (requestParameters.includePeople !== undefined) {
queryParameters['includePeople'] = requestParameters.includePeople;
}
if (requestParameters.includeMedia !== undefined) {
queryParameters['includeMedia'] = requestParameters.includeMedia;
}
if (requestParameters.includeGenres !== undefined) {
queryParameters['includeGenres'] = requestParameters.includeGenres;
}
if (requestParameters.includeStudios !== undefined) {
queryParameters['includeStudios'] = requestParameters.includeStudios;
}
if (requestParameters.includeArtists !== undefined) {
queryParameters['includeArtists'] = requestParameters.includeArtists;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Search/Hints`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => SearchHintResultFromJSON(jsonValue));
}
/**
* Gets the search hint result.
*/
async get(requestParameters: GetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SearchHintResult> {
const response = await this.getRaw(requestParameters, initOverrides);
return await response.value();
}
}