Implement very basic search
This commit is contained in:
111
openapi/search.ts
Normal file
111
openapi/search.ts
Normal file
@ -0,0 +1,111 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* OpenAPI definition
|
||||
* OpenAPI spec version: v0
|
||||
*/
|
||||
import axios from 'axios';
|
||||
import type {
|
||||
AxiosRequestConfig,
|
||||
AxiosResponse
|
||||
} from 'axios';
|
||||
|
||||
export interface KodikResponse {
|
||||
total?: number;
|
||||
results?: Result[];
|
||||
}
|
||||
|
||||
export interface MaterialData {
|
||||
title?: string;
|
||||
year?: number;
|
||||
description?: string;
|
||||
screenshots?: string[];
|
||||
duration?: number;
|
||||
countries?: string[];
|
||||
genres?: string[];
|
||||
actors?: string[];
|
||||
directors?: string[];
|
||||
producers?: string[];
|
||||
writers?: string[];
|
||||
composers?: string[];
|
||||
editors?: string[];
|
||||
designers?: string[];
|
||||
operators?: string[];
|
||||
anime_title?: string;
|
||||
title_en?: string;
|
||||
other_titles?: string[];
|
||||
other_titles_en?: string[];
|
||||
other_titles_jp?: string[];
|
||||
anime_license_name?: string;
|
||||
anime_licensed_by?: string[];
|
||||
anime_kind?: string;
|
||||
all_status?: string;
|
||||
anime_status?: string;
|
||||
anime_description?: string;
|
||||
poster_url?: string;
|
||||
anime_poster_url?: string;
|
||||
all_genres?: string[];
|
||||
anime_genres?: string[];
|
||||
anime_studios?: string[];
|
||||
kinopoisk_rating?: number;
|
||||
kinopoisk_votes?: number;
|
||||
imdb_rating?: number;
|
||||
imdb_votes?: number;
|
||||
shikimori_rating?: number;
|
||||
shikimori_votes?: number;
|
||||
premiere_world?: string;
|
||||
aired_at?: string;
|
||||
released_at?: string;
|
||||
rating_mpaa?: string;
|
||||
minimal_age?: number;
|
||||
episodes_total?: number;
|
||||
episodes_aired?: number;
|
||||
}
|
||||
|
||||
export interface Result {
|
||||
id?: string;
|
||||
type?: string;
|
||||
link?: string;
|
||||
title?: string;
|
||||
translation?: Translation;
|
||||
year?: number;
|
||||
quality?: string;
|
||||
camrip?: boolean;
|
||||
lgbt?: boolean;
|
||||
screenshots?: string[];
|
||||
title_orig?: string;
|
||||
other_title?: string;
|
||||
last_season?: number;
|
||||
last_episode?: number;
|
||||
episodes_count?: number;
|
||||
kinopoisk_id?: string;
|
||||
imdb_id?: string;
|
||||
worldart_link?: string;
|
||||
shikimori_id?: string;
|
||||
blocked_countries?: string[];
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
material_data?: MaterialData;
|
||||
}
|
||||
|
||||
export interface Translation {
|
||||
id?: number;
|
||||
title?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export type SearchParams = {
|
||||
title: string;
|
||||
};
|
||||
|
||||
export const search = <TData = AxiosResponse<KodikResponse>>(
|
||||
params: SearchParams, options?: AxiosRequestConfig
|
||||
): Promise<TData> => {
|
||||
return axios.get(
|
||||
`http://localhost:8080/search`,{
|
||||
...options,
|
||||
params: {...params, ...options?.params},}
|
||||
);
|
||||
}
|
||||
|
||||
export type SearchResult = AxiosResponse<KodikResponse>
|
Reference in New Issue
Block a user