@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,72 @@
|
|
|
1
|
+
import { MangaStatus, MangaType } from '../Manga';
|
|
2
|
+
import { AnimeRating, AnimeStatus, AnimeType } from '../Anime';
|
|
3
|
+
|
|
4
|
+
export enum SortOptions {
|
|
5
|
+
asc = 'asc',
|
|
6
|
+
desc = 'desc',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum SearchOrder {
|
|
10
|
+
mal_id = 'mal_id',
|
|
11
|
+
title = 'title',
|
|
12
|
+
start_date = 'start_date',
|
|
13
|
+
end_date = 'end_date',
|
|
14
|
+
score = 'score',
|
|
15
|
+
scored_by = 'scored_by',
|
|
16
|
+
rank = 'rank',
|
|
17
|
+
popularity = 'popularity',
|
|
18
|
+
members = 'members',
|
|
19
|
+
favorites = 'favorites',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export enum AnimeSearchOrder {
|
|
23
|
+
type = 'type',
|
|
24
|
+
rating = 'rating',
|
|
25
|
+
episodes = 'episodes',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export enum MangaSearchOrder {
|
|
29
|
+
chapters = 'chapters',
|
|
30
|
+
volumes = 'volumes',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface JikanSearchParams {
|
|
34
|
+
q?: string;
|
|
35
|
+
page?: number;
|
|
36
|
+
limit?: number;
|
|
37
|
+
score?: number;
|
|
38
|
+
min_score?: number;
|
|
39
|
+
max_score?: number;
|
|
40
|
+
sfw?: boolean;
|
|
41
|
+
genres?: string;
|
|
42
|
+
genres_exclude?: string;
|
|
43
|
+
sort?: SortOptions | string;
|
|
44
|
+
letter?: string;
|
|
45
|
+
producers?: string;
|
|
46
|
+
start_date?: string;
|
|
47
|
+
end_date?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* QueryParams used in **getMangaSearch** call
|
|
52
|
+
*
|
|
53
|
+
* See also: [Jikan API Documentation](https://docs.api.jikan.moe/#tag/manga/operation/getMangaSearch)
|
|
54
|
+
*/
|
|
55
|
+
export interface MangaSearchParams extends JikanSearchParams {
|
|
56
|
+
type?: MangaType | string;
|
|
57
|
+
status?: MangaStatus | string;
|
|
58
|
+
order_by?: MangaSearchOrder | SearchOrder | string;
|
|
59
|
+
magazines?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* QueryParams used in **getAnimeSearch** call
|
|
64
|
+
*
|
|
65
|
+
* See also: [Jikan API Documentation](https://docs.api.jikan.moe/#tag/anime/operation/getAnimeSearch)
|
|
66
|
+
*/
|
|
67
|
+
export interface AnimeSearchParams extends JikanSearchParams {
|
|
68
|
+
type?: AnimeType | string;
|
|
69
|
+
status?: AnimeStatus | string;
|
|
70
|
+
rating?: AnimeRating | string;
|
|
71
|
+
order_by?: AnimeSearchOrder | SearchOrder | string;
|
|
72
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AnimeType } from '../Anime';
|
|
2
|
+
import { MangaType } from '../Manga';
|
|
3
|
+
|
|
4
|
+
export enum TopAnimeFilter {
|
|
5
|
+
airing = 'airing',
|
|
6
|
+
upcoming = 'upcoming',
|
|
7
|
+
bypopularity = 'bypopularity',
|
|
8
|
+
favorite = 'favorite',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum TopMangaFilter {
|
|
12
|
+
publishing = 'publishing',
|
|
13
|
+
upcoming = 'upcoming',
|
|
14
|
+
bypopularity = 'bypopularity',
|
|
15
|
+
favorite = 'favorite',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface JikanTopParams {
|
|
19
|
+
page?: number;
|
|
20
|
+
limit?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* QueryParams used in **getTopAnime** call
|
|
25
|
+
*
|
|
26
|
+
* See also: [Jikan API Documentation](https://docs.api.jikan.moe/#tag/top/operation/getTopAnime)
|
|
27
|
+
*/
|
|
28
|
+
export interface AnimeTopParams extends JikanTopParams {
|
|
29
|
+
type?: AnimeType;
|
|
30
|
+
filter?: TopAnimeFilter;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* QueryParams used in **getTopManga** call
|
|
35
|
+
*
|
|
36
|
+
* See also: [Jikan API Documentation](https://docs.api.jikan.moe/#tag/top/operation/getTopManga)
|
|
37
|
+
*/
|
|
38
|
+
export interface MangaTopParams extends JikanTopParams {
|
|
39
|
+
type?: MangaType;
|
|
40
|
+
filter: TopMangaFilter;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './response.model';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface JikanPagination {
|
|
2
|
+
last_visible_page: number;
|
|
3
|
+
has_next_page: boolean;
|
|
4
|
+
items?: JikanPaginationItems;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface JikanPaginationItems {
|
|
8
|
+
count: number;
|
|
9
|
+
total: number;
|
|
10
|
+
per_page: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface JikanResponse<T> {
|
|
14
|
+
data: T[];
|
|
15
|
+
pagination?: JikanPagination;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface JikanUniqueResponse<T> {
|
|
19
|
+
data: T;
|
|
20
|
+
pagination?: JikanPagination;
|
|
21
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"skipLibCheck": false,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "CommonJS",
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"typeRoots": ["./node_modules/@types"],
|
|
13
|
+
"experimentalDecorators": true,
|
|
14
|
+
"emitDecoratorMetadata": true,
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"isolatedModules": true,
|
|
17
|
+
"importHelpers": true,
|
|
18
|
+
"rootDir": "./src",
|
|
19
|
+
"outDir": "./dist"
|
|
20
|
+
},
|
|
21
|
+
"include": ["src/**/*"],
|
|
22
|
+
"exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts"]
|
|
23
|
+
}
|