@tutkli/jikan-ts 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +16 -0
- package/.eslintignore +17 -0
- package/.eslintrc.json +27 -0
- package/.prettierrc.json +8 -0
- package/CHANGELOG.md +30 -0
- package/LICENSE +21 -0
- package/README.md +64 -0
- package/dist/index.d.ts +671 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +584 -0
- package/dist/index.js.map +1 -0
- package/jest.config.js +25 -0
- package/package.json +60 -0
- package/src/__tests__/anime-client.spec.ts +33 -0
- package/src/__tests__/manga-client.spec.ts +33 -0
- package/src/__tests__/top-client.spec.ts +33 -0
- package/src/clients/anime.client.ts +233 -0
- package/src/clients/base.client.ts +82 -0
- package/src/clients/index.ts +4 -0
- package/src/clients/jikan.client.ts +28 -0
- package/src/clients/manga.client.ts +142 -0
- package/src/clients/top.client.ts +52 -0
- package/src/config/cache.config.ts +8 -0
- package/src/config/index.ts +2 -0
- package/src/config/logger.config.ts +25 -0
- package/src/constants/base.constant.ts +3 -0
- package/src/constants/endpoints.constant.ts +29 -0
- package/src/constants/index.ts +2 -0
- package/src/index.ts +4 -0
- package/src/models/Anime/anime-character.model.ts +11 -0
- package/src/models/Anime/anime-episode.model.ts +12 -0
- package/src/models/Anime/anime-picture.model.ts +5 -0
- package/src/models/Anime/anime-staff.model.ts +6 -0
- package/src/models/Anime/anime-statistics.model.ts +6 -0
- package/src/models/Anime/anime-video.model.ts +38 -0
- package/src/models/Anime/anime.model.ts +95 -0
- package/src/models/Anime/index.ts +7 -0
- package/src/models/Common/character.model.ts +18 -0
- package/src/models/Common/image.model.ts +12 -0
- package/src/models/Common/index.ts +6 -0
- package/src/models/Common/person.model.ts +8 -0
- package/src/models/Common/recommendation.model.ts +12 -0
- package/src/models/Common/resource.model.ts +31 -0
- package/src/models/Common/statistics.model.ts +13 -0
- package/src/models/Manga/index.ts +2 -0
- package/src/models/Manga/manga-statistics.model.ts +6 -0
- package/src/models/Manga/manga.model.ts +58 -0
- package/src/models/Params/index.ts +2 -0
- package/src/models/Params/search-params.model.ts +72 -0
- package/src/models/Params/top-params.model.ts +41 -0
- package/src/models/Response/index.ts +1 -0
- package/src/models/Response/response.model.ts +21 -0
- package/src/models/index.ts +4 -0
- package/tsconfig.eslint.json +5 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { BaseClient, ClientArgs } from './base.client';
|
|
2
|
+
import { MangaEndpoints } from '../constants';
|
|
3
|
+
import { CacheAxiosResponse } from 'axios-cache-interceptor';
|
|
4
|
+
import { AxiosError } from 'axios';
|
|
5
|
+
import {
|
|
6
|
+
CommonCharacter,
|
|
7
|
+
JikanImages,
|
|
8
|
+
JikanResponse,
|
|
9
|
+
JikanUniqueResponse,
|
|
10
|
+
Manga,
|
|
11
|
+
MangaStatistics,
|
|
12
|
+
Recommendation,
|
|
13
|
+
} from '../models';
|
|
14
|
+
import { MangaSearchParams } from '../models/Params';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* **Manga Client**
|
|
18
|
+
*
|
|
19
|
+
* Client used to access the Manga Endpoints:
|
|
20
|
+
* - [MangaSearch](https://docs.api.jikan.moe/#tag/manga)
|
|
21
|
+
* - [MangaFullById](https://docs.api.jikan.moe/#tag/manga/operation/getMangaFullById)
|
|
22
|
+
* - [MangaById](https://docs.api.jikan.moe/#tag/manga/operation/getMangaById)
|
|
23
|
+
* - [MangaCharacters](https://docs.api.jikan.moe/#tag/manga/operation/getMangaCharacters)
|
|
24
|
+
* - [MangaPictures](https://docs.api.jikan.moe/#tag/manga/operation/getMangaPictures)
|
|
25
|
+
* - [MangaStatistics](https://docs.api.jikan.moe/#tag/manga/operation/getMangaStatistics)
|
|
26
|
+
* - [MangaRecommendations](https://docs.api.jikan.moe/#tag/manga/operation/getMangaRecommendations)
|
|
27
|
+
*
|
|
28
|
+
* See also: [JikanAPI Documentation](https://docs.api.jikan.moe/)
|
|
29
|
+
*/
|
|
30
|
+
export class MangaClient extends BaseClient {
|
|
31
|
+
/**
|
|
32
|
+
* @argument clientOptions Options for the client.
|
|
33
|
+
*/
|
|
34
|
+
constructor(clientOptions?: ClientArgs) {
|
|
35
|
+
super(clientOptions);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get all the filtered Mangas. Returns all the Mangas if no filters are given.
|
|
40
|
+
* @param searchParams Filter parameters
|
|
41
|
+
* @returns A JikanResponse with Manga data
|
|
42
|
+
*/
|
|
43
|
+
public async getMangaSearch(searchParams: MangaSearchParams): Promise<JikanResponse<Manga>> {
|
|
44
|
+
return new Promise<JikanResponse<Manga>>((resolve, reject) => {
|
|
45
|
+
const endpoint = `${MangaEndpoints.MangaSearch}`;
|
|
46
|
+
this.api
|
|
47
|
+
.get<JikanResponse<Manga>>(endpoint, { params: searchParams })
|
|
48
|
+
.then((response: CacheAxiosResponse<JikanResponse<Manga>>) => resolve(response.data))
|
|
49
|
+
.catch((error: AxiosError<string>) => reject(error));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get a Manga with full information by its ID
|
|
55
|
+
* @param mal_id The Manga ID
|
|
56
|
+
* @returns A JikanUniqueResponse with Manga data
|
|
57
|
+
*/
|
|
58
|
+
public async getMangaFullById(mal_id: number): Promise<JikanUniqueResponse<Manga>> {
|
|
59
|
+
return new Promise<JikanUniqueResponse<Manga>>((resolve, reject) => {
|
|
60
|
+
const endpoint = `${MangaEndpoints.MangaFullById.replace('{id}', String(mal_id))}`;
|
|
61
|
+
this.api
|
|
62
|
+
.get<JikanUniqueResponse<Manga>>(endpoint)
|
|
63
|
+
.then((response: CacheAxiosResponse<JikanUniqueResponse<Manga>>) => resolve(response.data))
|
|
64
|
+
.catch((error: AxiosError<string>) => reject(error));
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get a Manga by its ID
|
|
70
|
+
* @param mal_id The Manga ID
|
|
71
|
+
* @returns A JikanUniqueResponse with Manga data
|
|
72
|
+
*/
|
|
73
|
+
public async getMangaById(mal_id: number): Promise<JikanUniqueResponse<Manga>> {
|
|
74
|
+
return new Promise<JikanUniqueResponse<Manga>>((resolve, reject) => {
|
|
75
|
+
const endpoint = `${MangaEndpoints.MangaById.replace('{id}', String(mal_id))}`;
|
|
76
|
+
this.api
|
|
77
|
+
.get<JikanUniqueResponse<Manga>>(endpoint)
|
|
78
|
+
.then((response: CacheAxiosResponse<JikanUniqueResponse<Manga>>) => resolve(response.data))
|
|
79
|
+
.catch((error: AxiosError<string>) => reject(error));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Get Characters of a specific Manga
|
|
85
|
+
* @param mal_id The Manga ID
|
|
86
|
+
* @returns A JikanResponse with CommonCharacter data
|
|
87
|
+
*/
|
|
88
|
+
public async getMangaCharacters(mal_id: number): Promise<JikanResponse<CommonCharacter>> {
|
|
89
|
+
return new Promise<JikanResponse<CommonCharacter>>((resolve, reject) => {
|
|
90
|
+
const endpoint = `${MangaEndpoints.MangaCharacters.replace('{id}', String(mal_id))}`;
|
|
91
|
+
this.api
|
|
92
|
+
.get<JikanResponse<CommonCharacter>>(endpoint)
|
|
93
|
+
.then((response: CacheAxiosResponse<JikanResponse<CommonCharacter>>) => resolve(response.data))
|
|
94
|
+
.catch((error: AxiosError<string>) => reject(error));
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get Pictures related to a specific Manga
|
|
100
|
+
* @param mal_id The Manga ID
|
|
101
|
+
* @returns A JikanResponse with JikanImages data
|
|
102
|
+
*/
|
|
103
|
+
public async getMangaPictures(mal_id: number): Promise<JikanResponse<JikanImages>> {
|
|
104
|
+
return new Promise<JikanResponse<JikanImages>>((resolve, reject) => {
|
|
105
|
+
const endpoint = `${MangaEndpoints.MangaPictures.replace('{id}', String(mal_id))}`;
|
|
106
|
+
this.api
|
|
107
|
+
.get<JikanResponse<JikanImages>>(endpoint)
|
|
108
|
+
.then((response: CacheAxiosResponse<JikanResponse<JikanImages>>) => resolve(response.data))
|
|
109
|
+
.catch((error: AxiosError<string>) => reject(error));
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get Statistics related to a specific Manga
|
|
115
|
+
* @param mal_id The Manga ID
|
|
116
|
+
* @returns A JikanUniqueResponse with MangaStatistics data
|
|
117
|
+
*/
|
|
118
|
+
public async getAnimeStatistics(mal_id: number): Promise<JikanUniqueResponse<MangaStatistics>> {
|
|
119
|
+
return new Promise<JikanUniqueResponse<MangaStatistics>>((resolve, reject) => {
|
|
120
|
+
const endpoint = `${MangaEndpoints.MangaStatistics.replace('{id}', String(mal_id))}`;
|
|
121
|
+
this.api
|
|
122
|
+
.get<JikanUniqueResponse<MangaStatistics>>(endpoint)
|
|
123
|
+
.then((response: CacheAxiosResponse<JikanUniqueResponse<MangaStatistics>>) => resolve(response.data))
|
|
124
|
+
.catch((error: AxiosError<string>) => reject(error));
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Get Recommendations related to a specific Manga
|
|
130
|
+
* @param mal_id The Manga ID
|
|
131
|
+
* @returns A JikanResponse with Recommendation data
|
|
132
|
+
*/
|
|
133
|
+
public async getMangaRecommendation(mal_id: number): Promise<JikanResponse<Recommendation>> {
|
|
134
|
+
return new Promise<JikanResponse<Recommendation>>((resolve, reject) => {
|
|
135
|
+
const endpoint = `${MangaEndpoints.MangaRecommendations.replace('{id}', String(mal_id))}`;
|
|
136
|
+
this.api
|
|
137
|
+
.get<JikanResponse<Recommendation>>(endpoint)
|
|
138
|
+
.then((response: CacheAxiosResponse<JikanResponse<Recommendation>>) => resolve(response.data))
|
|
139
|
+
.catch((error: AxiosError<string>) => reject(error));
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { BaseClient, ClientArgs } from './base.client';
|
|
2
|
+
import { Anime, JikanResponse, Manga } from '../models';
|
|
3
|
+
import { TopEndpoints } from '../constants';
|
|
4
|
+
import { CacheAxiosResponse } from 'axios-cache-interceptor';
|
|
5
|
+
import { AxiosError } from 'axios';
|
|
6
|
+
import { AnimeTopParams, MangaTopParams } from '../models/Params';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* **Anime Client**
|
|
10
|
+
*
|
|
11
|
+
* Client used to access the Top Endpoints:
|
|
12
|
+
* - [TopAnime](https://docs.api.jikan.moe/#tag/top/operation/getTopAnime)
|
|
13
|
+
* - [TopManga](https://docs.api.jikan.moe/#tag/top/operation/getTopManga)
|
|
14
|
+
*
|
|
15
|
+
* See also: [JikanAPI Documentation](https://docs.api.jikan.moe/)
|
|
16
|
+
*/
|
|
17
|
+
export class TopClient extends BaseClient {
|
|
18
|
+
/**
|
|
19
|
+
* @argument clientOptions Options for the client.
|
|
20
|
+
*/
|
|
21
|
+
constructor(clientOptions?: ClientArgs) {
|
|
22
|
+
super(clientOptions);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get the top Animes
|
|
27
|
+
* @returns A JikanResponse with Anime data
|
|
28
|
+
*/
|
|
29
|
+
public async getTopAnime(searchParams: AnimeTopParams): Promise<JikanResponse<Anime>> {
|
|
30
|
+
return new Promise<JikanResponse<Anime>>((resolve, reject) => {
|
|
31
|
+
const endpoint = `${TopEndpoints.TopAnime}`;
|
|
32
|
+
this.api
|
|
33
|
+
.get<JikanResponse<Anime>>(endpoint, { params: searchParams })
|
|
34
|
+
.then((response: CacheAxiosResponse<JikanResponse<Anime>>) => resolve(response.data))
|
|
35
|
+
.catch((error: AxiosError<string>) => reject(error));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get the top Mangas
|
|
41
|
+
* @returns A JikanResponse with Manga data
|
|
42
|
+
*/
|
|
43
|
+
public async getTopManga(searchParams: MangaTopParams): Promise<JikanResponse<Manga>> {
|
|
44
|
+
return new Promise<JikanResponse<Manga>>((resolve, reject) => {
|
|
45
|
+
const endpoint = `${TopEndpoints.TopManga}`;
|
|
46
|
+
this.api
|
|
47
|
+
.get<JikanResponse<Manga>>(endpoint, { params: searchParams })
|
|
48
|
+
.then((response: CacheAxiosResponse<JikanResponse<Manga>>) => resolve(response.data))
|
|
49
|
+
.catch((error: AxiosError<string>) => reject(error));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { buildMemoryStorage, defaultHeaderInterpreter, defaultKeyGenerator } from 'axios-cache-interceptor';
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_CACHE_OPTIONS = {
|
|
4
|
+
storage: buildMemoryStorage(),
|
|
5
|
+
generateKey: defaultKeyGenerator,
|
|
6
|
+
headerInterpreter: defaultHeaderInterpreter,
|
|
7
|
+
debug: undefined,
|
|
8
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DestinationStream, Logger, LoggerOptions, pino } from 'pino';
|
|
2
|
+
import { AxiosError } from 'axios';
|
|
3
|
+
import { CacheAxiosResponse, CacheRequestConfig } from 'axios-cache-interceptor';
|
|
4
|
+
|
|
5
|
+
export const createLogger = (options: LoggerOptions | DestinationStream): Logger => pino(options);
|
|
6
|
+
|
|
7
|
+
export const handleRequest = (config: CacheRequestConfig, logger: Logger): CacheRequestConfig => {
|
|
8
|
+
logger.info(`[ Request Config ] ${config.method?.toUpperCase() || ''} | ${config.url || ''}`);
|
|
9
|
+
return config;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const handleRequestError = (error: AxiosError, logger: Logger): Promise<AxiosError> => {
|
|
13
|
+
logger.error(`[ Request Error] CODE ${error.code || 'UNKNOWN'} | ${error.message}`);
|
|
14
|
+
throw error;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const handleResponse = (response: CacheAxiosResponse, logger: Logger): CacheAxiosResponse => {
|
|
18
|
+
logger.info(response.data);
|
|
19
|
+
return response;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const handleResponseError = (error: AxiosError, logger: Logger): Promise<AxiosError> => {
|
|
23
|
+
logger.error(`[ Response Error ] CODE ${error.code || 'UNKNOWN'} | ${error.message}`);
|
|
24
|
+
throw error;
|
|
25
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export enum AnimeEndpoints {
|
|
2
|
+
AnimeSearch = '/anime',
|
|
3
|
+
AnimeFullById = '/anime/{id}/full',
|
|
4
|
+
AnimeById = '/anime/{id}',
|
|
5
|
+
AnimeCharacters = '/anime/{id}/characters',
|
|
6
|
+
AnimeStaff = '/anime/{id}/staff',
|
|
7
|
+
AnimeEpisodes = '/anime/{id}/episodes',
|
|
8
|
+
AnimeEpisodeById = '/anime/{id}/episodes/{episode}',
|
|
9
|
+
AnimeVideos = '/anime/{id}/videos',
|
|
10
|
+
AnimeVideosEpisodes = '/anime/{id}/videos/episodes',
|
|
11
|
+
AnimePictures = '/anime/{id}/pictures',
|
|
12
|
+
AnimeStatistics = '/anime/{id}/statistics',
|
|
13
|
+
AnimeRecommendations = '/anime/{id}/recommendations',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum MangaEndpoints {
|
|
17
|
+
MangaSearch = '/manga',
|
|
18
|
+
MangaFullById = '/manga/{id}/full',
|
|
19
|
+
MangaById = '/manga/{id}',
|
|
20
|
+
MangaCharacters = '/manga/{id}/characters',
|
|
21
|
+
MangaPictures = '/manga/{id}/pictures',
|
|
22
|
+
MangaStatistics = '/manga/{id}/statistics',
|
|
23
|
+
MangaRecommendations = '/manga/{id}/recommendations',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export enum TopEndpoints {
|
|
27
|
+
TopAnime = '/top/anime',
|
|
28
|
+
TopManga = '/top/manga',
|
|
29
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommonCharacter } from '../Common/character.model';
|
|
2
|
+
import { JikanPerson } from '../Common/person.model';
|
|
3
|
+
|
|
4
|
+
export interface AnimeCharacter extends CommonCharacter {
|
|
5
|
+
voice_actors: AnimeCharacterVoiceActor[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface AnimeCharacterVoiceActor {
|
|
9
|
+
person: JikanPerson;
|
|
10
|
+
language: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { JikanImages, JikanImagesCollection } from '../Common';
|
|
2
|
+
|
|
3
|
+
export interface AnimeVideo {
|
|
4
|
+
promo: AnimeVideoPromo[];
|
|
5
|
+
episodes: AnimeVideoEpisode[];
|
|
6
|
+
music_videos: AnimeMusicVideo[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface AnimeVideoPromo {
|
|
10
|
+
title: string;
|
|
11
|
+
trailer: AnimeYoutubeVideo;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface AnimeYoutubeVideo {
|
|
15
|
+
youtube_id: string;
|
|
16
|
+
url: string;
|
|
17
|
+
embed_url: string;
|
|
18
|
+
images?: JikanImagesCollection;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface AnimeVideoEpisode {
|
|
22
|
+
mal_id: number;
|
|
23
|
+
url: string;
|
|
24
|
+
title: string;
|
|
25
|
+
episode: string;
|
|
26
|
+
images: JikanImages;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface AnimeMusicVideo {
|
|
30
|
+
title: string;
|
|
31
|
+
video: AnimeYoutubeVideo;
|
|
32
|
+
meta: AnimeVideoMeta;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface AnimeVideoMeta {
|
|
36
|
+
title: string;
|
|
37
|
+
author: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
JikanImages,
|
|
3
|
+
JikanNamedResource,
|
|
4
|
+
JikanResourcePeriod,
|
|
5
|
+
JikanResourceRelation,
|
|
6
|
+
JikanResourceTitle,
|
|
7
|
+
JikanUniqueResource,
|
|
8
|
+
} from '../Common';
|
|
9
|
+
import { AnimeYoutubeVideo } from './anime-video.model';
|
|
10
|
+
|
|
11
|
+
export interface Anime {
|
|
12
|
+
mal_id: string;
|
|
13
|
+
url: string;
|
|
14
|
+
images: JikanImages;
|
|
15
|
+
trailer: AnimeYoutubeVideo;
|
|
16
|
+
approved: boolean;
|
|
17
|
+
titles: JikanResourceTitle[];
|
|
18
|
+
title: string;
|
|
19
|
+
title_english: string;
|
|
20
|
+
title_japanese: string;
|
|
21
|
+
title_synonyms: string[];
|
|
22
|
+
type: AnimeType;
|
|
23
|
+
source: string;
|
|
24
|
+
episodes: number;
|
|
25
|
+
status: AnimeStatus;
|
|
26
|
+
airing: boolean;
|
|
27
|
+
aired: JikanResourcePeriod;
|
|
28
|
+
duration: string;
|
|
29
|
+
rating: AnimeRating;
|
|
30
|
+
score: number;
|
|
31
|
+
scored_by: number;
|
|
32
|
+
rank: number;
|
|
33
|
+
popularity: number;
|
|
34
|
+
members: number;
|
|
35
|
+
favorites: number;
|
|
36
|
+
synopsis: string;
|
|
37
|
+
background: string;
|
|
38
|
+
season?: AnimeSeason;
|
|
39
|
+
year: number;
|
|
40
|
+
broadcast: AnimeBroadcast;
|
|
41
|
+
producers: JikanUniqueResource[];
|
|
42
|
+
licensors: JikanUniqueResource[];
|
|
43
|
+
studio: JikanUniqueResource[];
|
|
44
|
+
genres: JikanUniqueResource[];
|
|
45
|
+
explicit_genres: JikanUniqueResource[];
|
|
46
|
+
themes: JikanUniqueResource[];
|
|
47
|
+
demographic: JikanUniqueResource[];
|
|
48
|
+
relations?: JikanResourceRelation[];
|
|
49
|
+
theme?: AnimeTheme;
|
|
50
|
+
external?: JikanNamedResource[];
|
|
51
|
+
streaming: JikanNamedResource[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface AnimeBroadcast {
|
|
55
|
+
day: string;
|
|
56
|
+
time: string;
|
|
57
|
+
timezone: string;
|
|
58
|
+
string: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface AnimeTheme {
|
|
62
|
+
openings: string[];
|
|
63
|
+
endings: string[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export enum AnimeType {
|
|
67
|
+
tv = 'TV',
|
|
68
|
+
movie = 'Movie',
|
|
69
|
+
ova = 'Ova',
|
|
70
|
+
special = 'Special',
|
|
71
|
+
ona = 'Ona',
|
|
72
|
+
music = 'Music',
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export enum AnimeStatus {
|
|
76
|
+
finished = 'Finished Airing',
|
|
77
|
+
airing = 'Currently Airing',
|
|
78
|
+
complete = 'Complete',
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export enum AnimeRating {
|
|
82
|
+
g = 'g',
|
|
83
|
+
pg = 'pg',
|
|
84
|
+
pg13 = 'pg13',
|
|
85
|
+
r17 = 'r17',
|
|
86
|
+
r = 'r',
|
|
87
|
+
rx = 'rx',
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export enum AnimeSeason {
|
|
91
|
+
spring = 'spring',
|
|
92
|
+
summer = 'summer',
|
|
93
|
+
fall = 'fall',
|
|
94
|
+
winter = 'winter',
|
|
95
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './anime.model';
|
|
2
|
+
export * from './anime-character.model';
|
|
3
|
+
export * from './anime-staff.model';
|
|
4
|
+
export * from './anime-episode.model';
|
|
5
|
+
export * from './anime-video.model';
|
|
6
|
+
export * from './anime-picture.model';
|
|
7
|
+
export * from './anime-statistics.model';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JikanImages } from './image.model';
|
|
2
|
+
|
|
3
|
+
export interface CommonCharacter {
|
|
4
|
+
character: CommonCharacterData;
|
|
5
|
+
role: CharacterRole;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface CommonCharacterData {
|
|
9
|
+
mal_id: number;
|
|
10
|
+
url: string;
|
|
11
|
+
images: JikanImages;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export enum CharacterRole {
|
|
16
|
+
main = 'Main',
|
|
17
|
+
supporting = 'Supporting',
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface JikanImages {
|
|
2
|
+
jpg: JikanImagesCollection;
|
|
3
|
+
webp?: JikanImagesCollection;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface JikanImagesCollection {
|
|
7
|
+
image_url: string;
|
|
8
|
+
small_image_url?: string;
|
|
9
|
+
medium_image_url?: string;
|
|
10
|
+
large_image_url?: string;
|
|
11
|
+
maximum_image_url?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface JikanUniqueResource {
|
|
2
|
+
mal_id: number;
|
|
3
|
+
type: string;
|
|
4
|
+
name: string;
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface JikanNamedResource {
|
|
9
|
+
name: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface JikanResourceTitle {
|
|
14
|
+
type: string;
|
|
15
|
+
title: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface JikanResourcePeriod {
|
|
19
|
+
from: string;
|
|
20
|
+
to: string;
|
|
21
|
+
prop: {
|
|
22
|
+
form: { day: number; month: number; year: number };
|
|
23
|
+
to: { day: number; month: number; year: number };
|
|
24
|
+
string: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface JikanResourceRelation {
|
|
29
|
+
relation: string;
|
|
30
|
+
entry: JikanUniqueResource[];
|
|
31
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
JikanImages,
|
|
3
|
+
JikanNamedResource,
|
|
4
|
+
JikanResourcePeriod,
|
|
5
|
+
JikanResourceRelation,
|
|
6
|
+
JikanResourceTitle,
|
|
7
|
+
JikanUniqueResource,
|
|
8
|
+
} from '../Common';
|
|
9
|
+
|
|
10
|
+
export interface Manga {
|
|
11
|
+
mal_id: number;
|
|
12
|
+
url: string;
|
|
13
|
+
images: JikanImages;
|
|
14
|
+
approved: boolean;
|
|
15
|
+
titles: JikanResourceTitle[];
|
|
16
|
+
title: string;
|
|
17
|
+
title_japanese: string;
|
|
18
|
+
title_synonyms?: string[];
|
|
19
|
+
type: MangaType;
|
|
20
|
+
chapters: number;
|
|
21
|
+
volumes: number;
|
|
22
|
+
status: MangaStatus;
|
|
23
|
+
publishing: boolean;
|
|
24
|
+
published: JikanResourcePeriod;
|
|
25
|
+
score: number;
|
|
26
|
+
scored_by: number;
|
|
27
|
+
rank: number;
|
|
28
|
+
popularity: number;
|
|
29
|
+
members: number;
|
|
30
|
+
favorites: number;
|
|
31
|
+
synopsis: string;
|
|
32
|
+
background: string;
|
|
33
|
+
authors: JikanUniqueResource[];
|
|
34
|
+
serializations: JikanUniqueResource[];
|
|
35
|
+
explicit_genres: JikanUniqueResource[];
|
|
36
|
+
themes: JikanUniqueResource[];
|
|
37
|
+
demographics: JikanUniqueResource[];
|
|
38
|
+
relations?: JikanResourceRelation[];
|
|
39
|
+
external?: JikanNamedResource[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export enum MangaType {
|
|
43
|
+
manga = 'Manga',
|
|
44
|
+
novel = 'Novel',
|
|
45
|
+
lightnovel = 'Lightnovel',
|
|
46
|
+
oneshot = 'Oneshot',
|
|
47
|
+
doujin = 'Doujin',
|
|
48
|
+
manwha = 'Manwha',
|
|
49
|
+
manhua = 'Manhua',
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export enum MangaStatus {
|
|
53
|
+
publishing = 'Publishing',
|
|
54
|
+
complete = 'Complete',
|
|
55
|
+
hiatus = 'Hiatus',
|
|
56
|
+
discontinued = 'Discontinued',
|
|
57
|
+
upcoming = 'Upcoming',
|
|
58
|
+
}
|