WIP Implement search and watch prototype
This commit is contained in:
1
openapi/extractor.json
Normal file
1
openapi/extractor.json
Normal file
@ -0,0 +1 @@
|
||||
{"openapi":"3.1.0","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"http://localhost:8081","description":"Generated server url"}],"paths":{"/metadata/shikimori":{"get":{"tags":["metadata-controller"],"operationId":"shikimori","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/KodikMetadata"}}}}}}},"/metadata/kodik":{"get":{"tags":["metadata-controller"],"operationId":"kodik","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/KodikMetadata"}}}}}}},"/extract/video":{"get":{"tags":["extract-controller"],"operationId":"video","parameters":[{"name":"translationDTO","in":"query","required":true,"schema":{"$ref":"#/components/schemas/KodikTranslationDTO"}},{"name":"quality","in":"query","required":true,"schema":{"type":"string"}},{"name":"episode","in":"query","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/KodikVideoLinks"}}}}}}}},"components":{"schemas":{"KodikMetadata":{"type":"object","properties":{"title":{"type":"string"},"translations":{"type":"array","items":{"$ref":"#/components/schemas/KodikTranslation"}}}},"KodikTranslation":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"mediaId":{"type":"string"},"mediaHash":{"type":"string"},"mediaType":{"type":"string"},"translationType":{"type":"string"},"episodeCount":{"type":"integer","format":"int32"}}},"KodikTranslationDTO":{"type":"object","properties":{"mediaType":{"type":"string"},"mediaId":{"type":"string"},"mediaHash":{"type":"string"}}},"KodikVideoLinks":{"type":"object","properties":{"links":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/Link"}}}}},"Link":{"type":"object","properties":{"type":{"type":"string"},"src":{"type":"string"}}}}}}
|
96
openapi/extractor.ts
Normal file
96
openapi/extractor.ts
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* 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 KodikMetadata {
|
||||
title?: string;
|
||||
translations?: KodikTranslation[];
|
||||
}
|
||||
|
||||
export interface KodikTranslation {
|
||||
id?: string;
|
||||
title?: string;
|
||||
mediaId?: string;
|
||||
mediaHash?: string;
|
||||
mediaType?: string;
|
||||
translationType?: string;
|
||||
episodeCount?: number;
|
||||
}
|
||||
|
||||
export interface KodikTranslationDTO {
|
||||
mediaType?: string;
|
||||
mediaId?: string;
|
||||
mediaHash?: string;
|
||||
}
|
||||
|
||||
export type KodikVideoLinksLinks = { [key: string]: Link[] };
|
||||
|
||||
export interface KodikVideoLinks {
|
||||
links?: KodikVideoLinksLinks;
|
||||
}
|
||||
|
||||
export interface Link {
|
||||
type?: string;
|
||||
src?: string;
|
||||
}
|
||||
|
||||
export type ShikimoriParams = {
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type KodikParams = {
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type VideoParams = {
|
||||
mediaType: string;
|
||||
mediaId: string;
|
||||
mediaHash: string;
|
||||
quality: string;
|
||||
episode: number;
|
||||
};
|
||||
|
||||
export const shikimori = <TData = AxiosResponse<KodikMetadata>>(
|
||||
params: ShikimoriParams, options?: AxiosRequestConfig
|
||||
): Promise<TData> => {
|
||||
return axios.get(
|
||||
`http://localhost:8081/metadata/shikimori`, {
|
||||
...options,
|
||||
params: { ...params, ...options?.params },
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export const kodik = <TData = AxiosResponse<KodikMetadata>>(
|
||||
params: KodikParams, options?: AxiosRequestConfig
|
||||
): Promise<TData> => {
|
||||
return axios.get(
|
||||
`http://localhost:8081/metadata/kodik`, {
|
||||
...options,
|
||||
params: { ...params, ...options?.params },
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export const video = <TData = AxiosResponse<KodikVideoLinks>>(
|
||||
params: VideoParams, options?: AxiosRequestConfig
|
||||
): Promise<TData> => {
|
||||
return axios.get(
|
||||
`http://localhost:8081/extract/video`, {
|
||||
...options,
|
||||
params: { ...params, ...options?.params },
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export type ShikimoriResult = AxiosResponse<KodikMetadata>
|
||||
export type KodikResult = AxiosResponse<KodikMetadata>
|
||||
export type VideoResult = AxiosResponse<KodikVideoLinks>
|
Reference in New Issue
Block a user