@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.
Files changed (55) hide show
  1. package/.editorconfig +16 -0
  2. package/.eslintignore +17 -0
  3. package/.eslintrc.json +27 -0
  4. package/.prettierrc.json +8 -0
  5. package/CHANGELOG.md +30 -0
  6. package/LICENSE +21 -0
  7. package/README.md +64 -0
  8. package/dist/index.d.ts +671 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +584 -0
  11. package/dist/index.js.map +1 -0
  12. package/jest.config.js +25 -0
  13. package/package.json +60 -0
  14. package/src/__tests__/anime-client.spec.ts +33 -0
  15. package/src/__tests__/manga-client.spec.ts +33 -0
  16. package/src/__tests__/top-client.spec.ts +33 -0
  17. package/src/clients/anime.client.ts +233 -0
  18. package/src/clients/base.client.ts +82 -0
  19. package/src/clients/index.ts +4 -0
  20. package/src/clients/jikan.client.ts +28 -0
  21. package/src/clients/manga.client.ts +142 -0
  22. package/src/clients/top.client.ts +52 -0
  23. package/src/config/cache.config.ts +8 -0
  24. package/src/config/index.ts +2 -0
  25. package/src/config/logger.config.ts +25 -0
  26. package/src/constants/base.constant.ts +3 -0
  27. package/src/constants/endpoints.constant.ts +29 -0
  28. package/src/constants/index.ts +2 -0
  29. package/src/index.ts +4 -0
  30. package/src/models/Anime/anime-character.model.ts +11 -0
  31. package/src/models/Anime/anime-episode.model.ts +12 -0
  32. package/src/models/Anime/anime-picture.model.ts +5 -0
  33. package/src/models/Anime/anime-staff.model.ts +6 -0
  34. package/src/models/Anime/anime-statistics.model.ts +6 -0
  35. package/src/models/Anime/anime-video.model.ts +38 -0
  36. package/src/models/Anime/anime.model.ts +95 -0
  37. package/src/models/Anime/index.ts +7 -0
  38. package/src/models/Common/character.model.ts +18 -0
  39. package/src/models/Common/image.model.ts +12 -0
  40. package/src/models/Common/index.ts +6 -0
  41. package/src/models/Common/person.model.ts +8 -0
  42. package/src/models/Common/recommendation.model.ts +12 -0
  43. package/src/models/Common/resource.model.ts +31 -0
  44. package/src/models/Common/statistics.model.ts +13 -0
  45. package/src/models/Manga/index.ts +2 -0
  46. package/src/models/Manga/manga-statistics.model.ts +6 -0
  47. package/src/models/Manga/manga.model.ts +58 -0
  48. package/src/models/Params/index.ts +2 -0
  49. package/src/models/Params/search-params.model.ts +72 -0
  50. package/src/models/Params/top-params.model.ts +41 -0
  51. package/src/models/Response/index.ts +1 -0
  52. package/src/models/Response/response.model.ts +21 -0
  53. package/src/models/index.ts +4 -0
  54. package/tsconfig.eslint.json +5 -0
  55. 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
+ }
@@ -0,0 +1,4 @@
1
+ export * from './Anime';
2
+ export * from './Common';
3
+ export * from './Manga';
4
+ export * from './Response';
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["src/**/*", "jest.config.ts"],
4
+ "exclude": ["node_modules", "dist"]
5
+ }
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
+ }