@tutkli/jikan-ts 1.0.1 → 1.2.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.
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ npx lint-staged --concurrent false --relative
@@ -0,0 +1,3 @@
1
+ {
2
+ "*.{js,ts,css,scss,html,json,md}": "prettier --write"
3
+ }
package/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  ![jikan-ts-890w](https://user-images.githubusercontent.com/49206247/207465731-9908e843-7c8d-4e05-838b-41bcd8c677f8.png)
4
4
 
5
-
6
5
  ![Language Shield](https://img.shields.io/badge/language-typescript-blue?style=for-the-badge)
7
6
  ![License Shield](https://img.shields.io/badge/license-mit-blueviolet?style=for-the-badge)
8
7
  ![Build Shield](https://img.shields.io/badge/build-passing-brightgreen?style=for-the-badge)
@@ -18,8 +17,6 @@
18
17
  - 📄 Logging
19
18
  - 📦 ESM with tree shaking support
20
19
 
21
- #### 📖 Check out the [documentation page](https://tutkli.github.io/jikan-ts/)!
22
-
23
20
  ## Installation
24
21
 
25
22
  ```bash
@@ -39,8 +36,10 @@ const animeClient = new AnimeClient();
39
36
 
40
37
  animeClient
41
38
  .getAnimeById(1)
42
- .then((jikanResponse: JikanResponse<Anime>) => { /* ... */ })
43
- .catch((error) => console.error(error));
39
+ .then((jikanResponse: JikanResponse<Anime>) => {
40
+ /* ... */
41
+ })
42
+ .catch(error => console.error(error));
44
43
  ```
45
44
 
46
45
  Or, using the **JikanClient**:
@@ -52,8 +51,10 @@ const jikanClient = new JikanClient();
52
51
 
53
52
  jikanClient.anime
54
53
  .getAnimeById(1)
55
- .then((jikanResponse: JikanResponse<Anime>) => { /* ... */ })
56
- .catch((error) => console.error(error));
54
+ .then((jikanResponse: JikanResponse<Anime>) => {
55
+ /* ... */
56
+ })
57
+ .catch(error => console.error(error));
57
58
  ```
58
59
 
59
60
  ## Client configuration
@@ -66,7 +67,7 @@ To use a specific configuration, pass the `cacheOptions` argument when instantia
66
67
  ```ts
67
68
  import { AnimeClient } from '@tutkli/jikan-ts';
68
69
 
69
- const animeClient = new AnimeClient({
70
+ const animeClient = new AnimeClient({
70
71
  cacheOptions: { ... } // axios-cache-interceptor options
71
72
  }
72
73
  );
@@ -81,10 +82,9 @@ To enable logging, pass the `enableLogging` argument as `true`.
81
82
  ```ts
82
83
  import { AnimeClient } from '@tutkli/jikan-ts';
83
84
 
84
- const animeClient = new AnimeClient({
85
- enableLogging: true,
86
- }
87
- );
85
+ const animeClient = new AnimeClient({
86
+ enableLogging: true,
87
+ });
88
88
  ```
89
89
 
90
90
  ## Available Clients
@@ -103,4 +103,3 @@ const animeClient = new AnimeClient({
103
103
  - Did you find this project useful? [Leave a ⭐](https://github.com/tutkli/jikan-ts)
104
104
  - Found a problem? [Create an issue 🔎](https://github.com/tutkli/jikan-ts/issues)
105
105
  - Want to contribute? [Submit a PR 📑](https://github.com/tutkli/jikan-ts/pulls)
106
-
package/dist/index.d.ts CHANGED
@@ -1,81 +1,8 @@
1
- // Generated by dts-bundle-generator v8.0.1
2
-
3
- /// <reference types="node" />
1
+ // Generated by dts-bundle-generator v9.3.1
4
2
 
5
3
  import { AxiosError } from 'axios';
6
- import { AxiosCacheInstance, CacheAxiosResponse, CacheOptions, CacheRequestConfig } from 'axios-cache-interceptor';
4
+ import { CacheAxiosResponse, CacheOptions, InternalCacheRequestConfig } from 'axios-cache-interceptor';
7
5
 
8
- /**
9
- * **Client Args**
10
- *
11
- * Used to pass optional configuration for logging and cache to the clients.
12
- */
13
- export interface ClientArgs {
14
- /**
15
- * **EnableLogging**
16
- * Enables logging request responses.
17
- */
18
- enableLogging: boolean;
19
- /**
20
- * **Axios Cache Options**
21
- * Options for cache.
22
- * @see https://axios-cache-interceptor.js.org/#/pages/configuration
23
- */
24
- cacheOptions: Partial<CacheOptions>;
25
- /**
26
- * **Base URL**
27
- * Location of the JikanAPI. Leave empty to use the official JikanAPI instance.
28
- */
29
- baseURL: string;
30
- }
31
- /**
32
- * **Base Client**
33
- *
34
- * This client is responsible for creating an Axios Instance and the cache and logging configurations
35
- */
36
- export declare abstract class BaseClient {
37
- api: AxiosCacheInstance;
38
- constructor(clientOptions?: Partial<ClientArgs>);
39
- protected replacePathParams(path: string, params: {
40
- [key in string]: unknown;
41
- }): string;
42
- private addLoggingInterceptors;
43
- }
44
- export interface JikanResource {
45
- mal_id: number;
46
- type: string;
47
- name: string;
48
- url: string;
49
- }
50
- export interface JikanNamedResource {
51
- name: string;
52
- url: string;
53
- }
54
- export interface JikanResourceTitle {
55
- type: string;
56
- title: string;
57
- }
58
- export interface JikanResourcePeriod {
59
- from: string;
60
- to: string;
61
- prop: {
62
- form: {
63
- day: number;
64
- month: number;
65
- year: number;
66
- };
67
- to: {
68
- day: number;
69
- month: number;
70
- year: number;
71
- };
72
- string: string;
73
- };
74
- }
75
- export interface JikanResourceRelation {
76
- relation: string;
77
- entry: JikanResource[];
78
- }
79
6
  export interface JikanImages {
80
7
  jpg: JikanImagesCollection;
81
8
  webp?: JikanImagesCollection;
@@ -112,6 +39,21 @@ export declare enum CharacterRole {
112
39
  main = "Main",
113
40
  supporting = "Supporting"
114
41
  }
42
+ export interface JikanMoreInfo {
43
+ moreinfo: string;
44
+ }
45
+ export interface JikanNews {
46
+ mal_id: number;
47
+ url: string;
48
+ title: string;
49
+ date: string;
50
+ author_username: string;
51
+ author_url: string;
52
+ forum_url: string;
53
+ images: JikanImages;
54
+ comments: number;
55
+ excerpt: string;
56
+ }
115
57
  export interface Recommendation {
116
58
  entry: RecommendationEntry;
117
59
  }
@@ -121,6 +63,55 @@ export interface RecommendationEntry {
121
63
  images: JikanImages;
122
64
  title: string;
123
65
  }
66
+ export interface JikanRelation {
67
+ relation: string;
68
+ entry: RelationEntry[];
69
+ }
70
+ export interface RelationEntry {
71
+ mal_id: number;
72
+ type: string;
73
+ name: string;
74
+ url: string;
75
+ }
76
+ export interface JikanResource {
77
+ mal_id: number;
78
+ type: string;
79
+ name: string;
80
+ url: string;
81
+ }
82
+ export interface JikanNamedResource {
83
+ name: string;
84
+ url: string;
85
+ }
86
+ export interface JikanResourceTitle {
87
+ type: string;
88
+ title: string;
89
+ }
90
+ export interface JikanResourcePeriod {
91
+ from: string;
92
+ to: string;
93
+ prop: {
94
+ form: {
95
+ day: number;
96
+ month: number;
97
+ year: number;
98
+ };
99
+ to: {
100
+ day: number;
101
+ month: number;
102
+ year: number;
103
+ };
104
+ string: string;
105
+ };
106
+ }
107
+ export interface JikanResourceRelation {
108
+ relation: string;
109
+ entry: JikanResource[];
110
+ }
111
+ export interface SeasonsListData {
112
+ year: number;
113
+ seasons: Array<keyof typeof AnimeSeason>;
114
+ }
124
115
  export interface Statistics {
125
116
  completed: number;
126
117
  on_hold: number;
@@ -133,9 +124,47 @@ export interface StatisticsScore {
133
124
  votes: number;
134
125
  percentage: number;
135
126
  }
136
- export interface SeasonsListData {
137
- year: number;
138
- seasons: Array<keyof typeof AnimeSeason>;
127
+ export interface AnimeCharacter extends CommonCharacter {
128
+ voice_actors: CharacterVoiceActor[];
129
+ }
130
+ export interface AnimeEpisode {
131
+ mal_id: number;
132
+ url: string;
133
+ title: string;
134
+ title_japanese: string;
135
+ title_romanji: string;
136
+ duration: number;
137
+ aired: string;
138
+ filler: boolean;
139
+ recap: boolean;
140
+ forum_url: string;
141
+ }
142
+ export interface AnimeForum {
143
+ mal_id: number;
144
+ url: string;
145
+ title: string;
146
+ date: string;
147
+ author_username: string;
148
+ author_url: string;
149
+ comments: number;
150
+ last_comment: {
151
+ url: string;
152
+ author_username: string;
153
+ author_url: string;
154
+ date: string;
155
+ };
156
+ }
157
+ export type AnimeForumFilter = "all" | "episode" | "other";
158
+ export interface AnimePicture {
159
+ images: JikanImages;
160
+ }
161
+ export interface AnimeStaff {
162
+ person: JikanPerson;
163
+ positions: string[];
164
+ }
165
+ export interface AnimeStatistics extends Statistics {
166
+ watching: number;
167
+ plan_to_watch: number;
139
168
  }
140
169
  export interface AnimeVideos {
141
170
  promo: AnimePromoVideo[];
@@ -248,31 +277,38 @@ export declare enum AnimeSeason {
248
277
  fall = "fall",
249
278
  winter = "winter"
250
279
  }
251
- export interface AnimeCharacter extends CommonCharacter {
252
- voice_actors: CharacterVoiceActor[];
253
- }
254
- export interface AnimeStaff {
255
- person: JikanPerson;
256
- positions: string[];
257
- }
258
- export interface AnimeEpisode {
280
+ export interface Character {
259
281
  mal_id: number;
260
282
  url: string;
261
- title: string;
262
- title_japanese: string;
263
- title_romanji: string;
264
- duration: number;
265
- aired: string;
266
- filler: boolean;
267
- recap: boolean;
268
- forum_url: string;
269
- }
270
- export interface AnimePicture {
271
283
  images: JikanImages;
284
+ name: string;
285
+ name_kanji: string;
286
+ nicknames: string[];
287
+ favorites: number;
288
+ about: string;
289
+ anime: CharacterAnime[];
290
+ manga: CharacterManga[];
291
+ voices: CharacterVoiceActor[];
272
292
  }
273
- export interface AnimeStatistics extends Statistics {
274
- watching: number;
275
- plan_to_watch: number;
293
+ export interface CharacterAnime {
294
+ role: CharacterRole;
295
+ anime: CommonCharacterData & {
296
+ title: string;
297
+ };
298
+ }
299
+ export interface CharacterManga {
300
+ role: CharacterRole;
301
+ manga: CommonCharacterData & {
302
+ title: string;
303
+ };
304
+ }
305
+ export interface Genre extends JikanNamedResource {
306
+ mal_id: number;
307
+ count: number;
308
+ }
309
+ export interface MangaStatistics extends Statistics {
310
+ reading: number;
311
+ plan_to_read: number;
276
312
  }
277
313
  export interface Manga {
278
314
  mal_id: number;
@@ -322,24 +358,6 @@ export declare enum MangaStatus {
322
358
  discontinued = "Discontinued",
323
359
  upcoming = "Upcoming"
324
360
  }
325
- export interface MangaStatistics extends Statistics {
326
- reading: number;
327
- plan_to_read: number;
328
- }
329
- export interface JikanPagination {
330
- last_visible_page: number;
331
- has_next_page: boolean;
332
- items?: JikanPaginationItems;
333
- }
334
- export interface JikanPaginationItems {
335
- count: number;
336
- total: number;
337
- per_page: number;
338
- }
339
- export interface JikanResponse<T> {
340
- data: T;
341
- pagination?: JikanPagination;
342
- }
343
361
  export declare enum SortOptions {
344
362
  asc = "asc",
345
363
  desc = "desc"
@@ -416,23 +434,69 @@ export interface AnimeSearchParams extends JikanSearchParams {
416
434
  rating?: AnimeRating | string;
417
435
  order_by?: AnimeSearchOrder | SearchOrder | string;
418
436
  }
419
- export declare enum TopAnimeFilter {
420
- airing = "airing",
421
- upcoming = "upcoming",
422
- bypopularity = "bypopularity",
423
- favorite = "favorite"
437
+ export interface CharactersSearchParams {
438
+ page?: number;
439
+ limit?: number;
440
+ q?: string;
441
+ order_by?: CharactersSearchOrder;
442
+ sort?: SortOptions;
443
+ letter?: string;
424
444
  }
425
- export declare enum TopMangaFilter {
426
- publishing = "publishing",
427
- upcoming = "upcoming",
428
- bypopularity = "bypopularity",
429
- favorite = "favorite"
445
+ export declare enum CharactersSearchOrder {
446
+ mal_id = "mal_id",
447
+ name = "name",
448
+ favorites = "favorites"
430
449
  }
431
- export interface JikanTopParams {
450
+ export declare enum GenresFilter {
451
+ genres = "genres",
452
+ explicit_genres = "explicit_genres",
453
+ theme = "themes",
454
+ demographics = "demographics"
455
+ }
456
+ export interface SchedulesParams {
432
457
  page?: number;
433
458
  limit?: number;
459
+ filter?: SchedulesFilter;
460
+ kids?: boolean;
461
+ sfw?: boolean;
462
+ unapproved?: boolean;
434
463
  }
435
- /**
464
+ export declare enum SchedulesFilter {
465
+ monday = "monday",
466
+ tuesday = "tuesday",
467
+ wednesday = "wednesday",
468
+ thursday = "thursday",
469
+ friday = "friday",
470
+ unknown = "unknown",
471
+ other = "other"
472
+ }
473
+ export interface JikanSeasonsParams {
474
+ page?: number;
475
+ limit?: number;
476
+ filter?: AnimeType;
477
+ }
478
+ /**
479
+ * QueryParams used in **getSeasonNow** call
480
+ *
481
+ */
482
+ export type SeasonNowParams = Omit<JikanSeasonsParams, "filter">;
483
+ export declare enum TopAnimeFilter {
484
+ airing = "airing",
485
+ upcoming = "upcoming",
486
+ bypopularity = "bypopularity",
487
+ favorite = "favorite"
488
+ }
489
+ export declare enum TopMangaFilter {
490
+ publishing = "publishing",
491
+ upcoming = "upcoming",
492
+ bypopularity = "bypopularity",
493
+ favorite = "favorite"
494
+ }
495
+ export interface JikanTopParams {
496
+ page?: number;
497
+ limit?: number;
498
+ }
499
+ /**
436
500
  * QueryParams used in **getTopAnime** call
437
501
  *
438
502
  * See also: [Jikan API Documentation](https://docs.api.jikan.moe/#tag/top/operation/getTopAnime)
@@ -450,80 +514,58 @@ export interface MangaTopParams extends JikanTopParams {
450
514
  type?: MangaType;
451
515
  filter?: TopMangaFilter;
452
516
  }
453
- export interface JikanSeasonsParams {
454
- page?: number;
455
- limit?: number;
456
- filter?: AnimeType;
517
+ export interface JikanPagination {
518
+ last_visible_page: number;
519
+ has_next_page: boolean;
520
+ items?: JikanPaginationItems;
521
+ }
522
+ export interface JikanPaginationItems {
523
+ count: number;
524
+ total: number;
525
+ per_page: number;
526
+ }
527
+ export interface JikanResponse<T> {
528
+ data: T;
529
+ pagination?: JikanPagination;
457
530
  }
458
531
  /**
459
- * QueryParams used in **getSeasonNow** call
532
+ * **Client Args**
460
533
  *
534
+ * Used to pass optional configuration for logging and cache to the clients.
461
535
  */
462
- export type SeasonNowParams = Omit<JikanSeasonsParams, "filter">;
463
- export declare enum GenresFilter {
464
- genres = "genres",
465
- explicit_genres = "explicit_genres",
466
- theme = "themes",
467
- demographics = "demographics"
468
- }
469
- export interface CharactersSearchParams {
470
- page?: number;
471
- limit?: number;
472
- q?: string;
473
- order_by?: CharactersSearchOrder;
474
- sort?: SortOptions;
475
- letter?: string;
476
- }
477
- export declare enum CharactersSearchOrder {
478
- mal_id = "mal_id",
479
- name = "name",
480
- favorites = "favorites"
481
- }
482
- export interface SchedulesParams {
483
- page?: number;
484
- limit?: number;
485
- filter?: SchedulesFilter;
486
- kids?: boolean;
487
- sfw?: boolean;
488
- unapproved?: boolean;
489
- }
490
- export declare enum SchedulesFilter {
491
- monday = "monday",
492
- tuesday = "tuesday",
493
- wednesday = "wednesday",
494
- thursday = "thursday",
495
- friday = "friday",
496
- unknown = "unknown",
497
- other = "other"
498
- }
499
- export interface Character {
500
- mal_id: number;
501
- url: string;
502
- images: JikanImages;
503
- name: string;
504
- name_kanji: string;
505
- nicknames: string[];
506
- favorites: number;
507
- about: string;
508
- anime: CharacterAnime[];
509
- manga: CharacterManga[];
510
- voices: CharacterVoiceActor[];
511
- }
512
- export interface CharacterAnime {
513
- role: CharacterRole;
514
- anime: CommonCharacterData & {
515
- title: string;
516
- };
517
- }
518
- export interface CharacterManga {
519
- role: CharacterRole;
520
- manga: CommonCharacterData & {
521
- title: string;
522
- };
536
+ export interface ClientArgs {
537
+ /**
538
+ * **EnableLogging**
539
+ * Enables logging request responses.
540
+ */
541
+ enableLogging: boolean;
542
+ /**
543
+ * **Axios Cache Options**
544
+ * Options for cache.
545
+ * @see https://axios-cache-interceptor.js.org/#/pages/configuration
546
+ */
547
+ cacheOptions: Partial<CacheOptions>;
548
+ /**
549
+ * **Base URL**
550
+ * Location of the JikanAPI. Leave empty to use the official JikanAPI instance.
551
+ */
552
+ baseURL: string;
523
553
  }
524
- export interface Genre extends JikanNamedResource {
525
- mal_id: number;
526
- count: number;
554
+ /**
555
+ * **Base Client**
556
+ *
557
+ * This client is responsible for creating an Axios Instance and the cache and logging configurations
558
+ */
559
+ export declare abstract class BaseClient {
560
+ private api;
561
+ constructor(clientOptions?: Partial<ClientArgs>);
562
+ protected getResource<T>(endpoint: string, pathParams?: {
563
+ [key in string]: unknown;
564
+ }, params?: {
565
+ [key in string]: unknown;
566
+ }): Promise<T>;
567
+ private replacePathParams;
568
+ private addLoggingInterceptors;
527
569
  }
528
570
  /**
529
571
  * **Anime Client**
@@ -534,80 +576,161 @@ export interface Genre extends JikanNamedResource {
534
576
  */
535
577
  export declare class AnimeClient extends BaseClient {
536
578
  /**
537
- * Get all the Animes within the given filter. Returns all the Animes if no filters are given.
538
- * @param searchParams Filter parameters
539
- * @returns JikanResponse with Anime array data
579
+ * Get complete anime resource data
580
+ * @param id anime id
540
581
  */
541
- getAnimeSearch(searchParams?: Partial<AnimeSearchParams>): Promise<JikanResponse<Anime[]>>;
582
+ getAnimeFullById(id: number): Promise<JikanResponse<Anime>>;
542
583
  /**
543
- * Get a complete Anime resource data
544
- * @param mal_id The Anime ID
545
- * @returns JikanResponse with Anime data
584
+ * Get anime resource
585
+ * @param id anime id
546
586
  */
547
- getAnimeFullById(mal_id: number): Promise<JikanResponse<Anime>>;
587
+ getAnimeById(id: number): Promise<JikanResponse<Anime>>;
548
588
  /**
549
- * Get Anime resource data
550
- * @param mal_id The Anime ID
551
- * @returns JikanResponse with Anime data
589
+ * Get characters of a specific anime
590
+ * @param id anime id
552
591
  */
553
- getAnimeById(mal_id: number): Promise<JikanResponse<Anime>>;
592
+ getAnimeCharacters(id: number): Promise<JikanResponse<AnimeCharacter[]>>;
554
593
  /**
555
- * Get Characters of a specific Anime
556
- * @param mal_id The Anime ID
557
- * @returns JikanResponse with AnimeCharacter array data
594
+ * Get staff of a specific Anime
595
+ * @param id anime id
558
596
  */
559
- getAnimeCharacters(mal_id: number): Promise<JikanResponse<AnimeCharacter[]>>;
597
+ getAnimeStaff(id: number): Promise<JikanResponse<AnimeStaff[]>>;
560
598
  /**
561
- * Get Staff of a specific Anime
562
- * @param mal_id The Anime ID
563
- * @returns JikanResponse with AnimeStaff array data
599
+ * Get a list of all the episodes of a specific anime
600
+ * @param id anime id
601
+ * @param page page number
564
602
  */
565
- getAnimeStaff(mal_id: number): Promise<JikanResponse<AnimeStaff[]>>;
603
+ getAnimeEpisodes(id: number, page?: number): Promise<JikanResponse<AnimeEpisode[]>>;
566
604
  /**
567
- * Get a list of all the episodes of a specific Anime
568
- * @param mal_id The Anime ID
569
- * @param page The page number
570
- * @returns JikanResponse with AnimeEpisode array data
605
+ * Get a single episode of a specific anime by its id
606
+ * @param anime_id anime id
607
+ * @param episode_id episode id
571
608
  */
572
- getAnimeEpisodes(mal_id: number, page?: number): Promise<JikanResponse<AnimeEpisode[]>>;
609
+ getAnimeEpisodeById(anime_id: number, episode_id: number): Promise<JikanResponse<AnimeEpisode>>;
573
610
  /**
574
- * Get a single Episode of a specific Anime by its ID
575
- * @param anime_mal_id The Anime ID
576
- * @param episode_mal_id The Episode ID
577
- * @returns JikanResponse with AnimeEpisode data
611
+ * Get a list of news articles related to the anime
612
+ * @param id anime id
613
+ * @param page page number
578
614
  */
579
- getAnimeEpisodeById(anime_mal_id: number, episode_mal_id: number): Promise<JikanResponse<AnimeEpisode>>;
615
+ getAnimeNews(id: number, page: number): Promise<JikanResponse<JikanNews>>;
580
616
  /**
581
- * Get Videos related to a specific Anime
582
- * @param mal_id The Anime ID
583
- * @returns JikanResponse with AnimeVideo data
617
+ * Get a list of forum topics related to the anime
618
+ * @param id anime id
619
+ * @param filter forum filter
584
620
  */
585
- getAnimeVideos(mal_id: number): Promise<JikanResponse<AnimeVideos>>;
621
+ getAnimeForum(id: number, filter: AnimeForumFilter): Promise<JikanResponse<AnimeForum[]>>;
586
622
  /**
587
- * Get Episode Videos related to a specific Anime
588
- * @param mal_id The Anime ID
589
- * @param page The page number
590
- * @returns JikanResponse with AnimeVideoEpisode array data
623
+ * Get videos related to the anime
624
+ * @param id anime id
591
625
  */
592
- getAnimeEpisodeVideos(mal_id: number, page?: number): Promise<JikanResponse<AnimeEpisodeVideo[]>>;
626
+ getAnimeVideos(id: number): Promise<JikanResponse<AnimeVideos>>;
593
627
  /**
594
- * Get Pictures related to a specific Anime
595
- * @param mal_id The Anime ID
596
- * @returns JikanResponse with AnimePicture array data
628
+ * Get episode videos related to the anime
629
+ * @param id anime id
630
+ * @param page page number
597
631
  */
598
- getAnimePictures(mal_id: number): Promise<JikanResponse<AnimePicture[]>>;
632
+ getAnimeEpisodeVideos(id: number, page?: number): Promise<JikanResponse<AnimeEpisodeVideo[]>>;
599
633
  /**
600
- * Get Statistics related to a specific Anime
601
- * @param mal_id The Anime ID
602
- * @returns JikanResponse with AnimeStatistics data
634
+ * Get pictures related to the Anime
635
+ * @param id anime id
603
636
  */
604
- getAnimeStatistics(mal_id: number): Promise<JikanResponse<AnimeStatistics>>;
637
+ getAnimePictures(id: number): Promise<JikanResponse<AnimePicture[]>>;
605
638
  /**
606
- * Get Recommendations related to a specific Anime
607
- * @param mal_id The Anime ID
608
- * @returns JikanResponse with Recommendation array data
639
+ * Get statistics related to the Anime
640
+ * @param id anime id
641
+ */
642
+ getAnimeStatistics(id: number): Promise<JikanResponse<AnimeStatistics>>;
643
+ /**
644
+ * Get more info related to the anime
645
+ * @param id anime id
646
+ */
647
+ getAnimeMoreInfo(id: number): Promise<JikanResponse<JikanMoreInfo>>;
648
+ /**
649
+ * Get recommendations based on the anime
650
+ * @param id anime id
651
+ */
652
+ getAnimeRecommendations(id: number): Promise<JikanResponse<Recommendation[]>>;
653
+ /**
654
+ * Get anime relations
655
+ * @param id anime id
656
+ */
657
+ getAnimeRelations(id: number): Promise<JikanResponse<JikanRelation[]>>;
658
+ /**
659
+ * Get all the Animes within the given filter. Returns all the Animes if no filters are given.
660
+ * @param searchParams Filter parameters
661
+ * @returns JikanResponse with Anime array data
662
+ */
663
+ getAnimeSearch(searchParams?: Partial<AnimeSearchParams>): Promise<JikanResponse<Anime[]>>;
664
+ }
665
+ /**
666
+ * **Characters Client**
667
+ *
668
+ * Client used to access the Character Endpoints:
669
+ *
670
+ * See also: [Jikan Documentation](https://docs.api.jikan.moe/)
671
+ */
672
+ export declare class CharactersClient extends BaseClient {
673
+ /**
674
+ * Get complete Character data
675
+ * @param id The Character ID
676
+ * @returns JikanResponse with Character data
677
+ */
678
+ getCharacterFullById(id: number): Promise<JikanResponse<Character>>;
679
+ /**
680
+ * Get Character data
681
+ * @param id The Character ID
682
+ * @returns JikanResponse with Character data
683
+ */
684
+ getCharacterById(id: number): Promise<JikanResponse<Character>>;
685
+ /**
686
+ * Get Character anime data
687
+ * @param id The Character ID
688
+ * @returns JikanResponse with CharacterAnime data
689
+ */
690
+ getCharacterAnime(id: number): Promise<JikanResponse<CharacterAnime[]>>;
691
+ /**
692
+ * Get Character manga data
693
+ * @param id The Character ID
694
+ * @returns JikanResponse with CharacterManga data
695
+ */
696
+ getCharacterManga(id: number): Promise<JikanResponse<CharacterManga[]>>;
697
+ /**
698
+ * Get Character voices data
699
+ * @param id The Character ID
700
+ * @returns JikanResponse with CharacterVoiceActor data
701
+ */
702
+ getCharacterVoiceActors(id: number): Promise<JikanResponse<CharacterVoiceActor[]>>;
703
+ /**
704
+ * Get Character pictures data
705
+ * @param id The Character ID
706
+ * @returns JikanResponse with JikanImagesCollection data
707
+ */
708
+ getCharacterPictures(id: number): Promise<JikanResponse<JikanImagesCollection[]>>;
709
+ /**
710
+ * Get all the Characters within the given filter. Returns all Characters if no filters are given.
711
+ @param searchParams Filter parameters
712
+ * @returns JikanResponse with Character array data
713
+ */
714
+ getCharacterSearch(searchParams: Partial<CharactersSearchParams>): Promise<JikanResponse<Character[]>>;
715
+ }
716
+ /**
717
+ * **Genres Client**
718
+ *
719
+ * Client used to access the Genres Endpoints:
720
+ *
721
+ * See also: [Jikan Documentation](https://docs.api.jikan.moe/)
722
+ */
723
+ export declare class GenresClient extends BaseClient {
724
+ /**
725
+ * Get Anime genres
726
+ * @param filter Type of the desired genres
727
+ */
728
+ getAnimeGenres(filter?: GenresFilter): Promise<JikanResponse<Genre[]>>;
729
+ /**
730
+ * Get Manga genres
731
+ * @param filter Type of the desired genres
609
732
  */
610
- getAnimeRecommendations(mal_id: number): Promise<JikanResponse<Recommendation[]>>;
733
+ getMangaGenres(filter?: GenresFilter): Promise<JikanResponse<Genre[]>>;
611
734
  }
612
735
  /**
613
736
  * **Manga Client**
@@ -617,69 +740,63 @@ export declare class AnimeClient extends BaseClient {
617
740
  * See also: [Jikan Documentation](https://docs.api.jikan.moe/)
618
741
  */
619
742
  export declare class MangaClient extends BaseClient {
620
- /**
621
- * Get all the filtered Mangas. Returns all the Mangas if no filters are given.
622
- * @param searchParams Filter parameters
623
- * @returns JikanResponse with Manga array data
624
- */
625
- getMangaSearch(searchParams?: Partial<MangaSearchParams>): Promise<JikanResponse<Manga[]>>;
626
743
  /**
627
744
  * Get a Manga with full information by its ID
628
- * @param mal_id The Manga ID
745
+ * @param id The Manga ID
629
746
  * @returns JikanResponse with Manga data
630
747
  */
631
- getMangaFullById(mal_id: number): Promise<JikanResponse<Manga>>;
748
+ getMangaFullById(id: number): Promise<JikanResponse<Manga>>;
632
749
  /**
633
750
  * Get a Manga by its ID
634
- * @param mal_id The Manga ID
751
+ * @param id The Manga ID
635
752
  * @returns JikanResponse with Manga data
636
753
  */
637
- getMangaById(mal_id: number): Promise<JikanResponse<Manga>>;
754
+ getMangaById(id: number): Promise<JikanResponse<Manga>>;
638
755
  /**
639
756
  * Get Characters of a specific Manga
640
- * @param mal_id The Manga ID
757
+ * @param id The Manga ID
641
758
  * @returns JikanResponse with CommonCharacter array data
642
759
  */
643
- getMangaCharacters(mal_id: number): Promise<JikanResponse<CommonCharacter[]>>;
760
+ getMangaCharacters(id: number): Promise<JikanResponse<CommonCharacter[]>>;
644
761
  /**
645
762
  * Get Pictures related to a specific Manga
646
- * @param mal_id The Manga ID
763
+ * @param id The Manga ID
647
764
  * @returns JikanResponse with JikanImages array data
648
765
  */
649
- getMangaPictures(mal_id: number): Promise<JikanResponse<JikanImages[]>>;
766
+ getMangaPictures(id: number): Promise<JikanResponse<JikanImages[]>>;
650
767
  /**
651
768
  * Get Statistics related to a specific Manga
652
- * @param mal_id The Manga ID
769
+ * @param id The Manga ID
653
770
  * @returns JikanResponse with MangaStatistics data
654
771
  */
655
- getMangaStatistics(mal_id: number): Promise<JikanResponse<MangaStatistics>>;
772
+ getMangaStatistics(id: number): Promise<JikanResponse<MangaStatistics>>;
656
773
  /**
657
774
  * Get Recommendations related to a specific Manga
658
- * @param mal_id The Manga ID
775
+ * @param id The Manga ID
659
776
  * @returns JikanResponse with Recommendation array data
660
777
  */
661
- getMangaRecommendations(mal_id: number): Promise<JikanResponse<Recommendation[]>>;
778
+ getMangaRecommendations(id: number): Promise<JikanResponse<Recommendation[]>>;
779
+ /**
780
+ * Get all the filtered Mangas. Returns all the Mangas if no filters are given.
781
+ * @param searchParams Filter parameters
782
+ * @returns JikanResponse with Manga array data
783
+ */
784
+ getMangaSearch(searchParams?: Partial<MangaSearchParams>): Promise<JikanResponse<Manga[]>>;
662
785
  }
663
786
  /**
664
- * **Top Client**
787
+ * **Schedules Client**
665
788
  *
666
- * Client used to access the Top Endpoints:
789
+ * Client used to access the Schedules Endpoints
667
790
  *
668
791
  * See also: [Jikan Documentation](https://docs.api.jikan.moe/)
669
792
  */
670
- export declare class TopClient extends BaseClient {
793
+ export declare class SchedulesClient extends BaseClient {
671
794
  /**
672
- * Get the top Animes
795
+ * Returns weekly schedule
673
796
  * @param searchParams Filter parameters
674
797
  * @returns JikanResponse with Anime array data
675
798
  */
676
- getTopAnime(searchParams?: Partial<AnimeTopParams>): Promise<JikanResponse<Anime[]>>;
677
- /**
678
- * Get the top Mangas
679
- * @param searchParams Filter parameters
680
- * @returns JikanResponse with Manga array data
681
- */
682
- getTopManga(searchParams?: Partial<MangaTopParams>): Promise<JikanResponse<Manga[]>>;
799
+ getSchedules(searchParams?: Partial<SchedulesParams>): Promise<JikanResponse<Anime[]>>;
683
800
  }
684
801
  /**
685
802
  * **Seasons Client**
@@ -716,89 +833,25 @@ export declare class SeasonsClient extends BaseClient {
716
833
  getSeasonUpcoming(searchParams?: Partial<JikanSeasonsParams>): Promise<JikanResponse<Anime[]>>;
717
834
  }
718
835
  /**
719
- * **Anime Client**
720
- *
721
- * Client used to access the Anime Endpoints:
722
- *
723
- * See also: [Jikan Documentation](https://docs.api.jikan.moe/)
724
- */
725
- export declare class GenresClient extends BaseClient {
726
- /**
727
- * Get Anime genres
728
- * @param filter Type of the desired genres
729
- */
730
- getAnimeGenres(filter?: GenresFilter): Promise<JikanResponse<Genre[]>>;
731
- /**
732
- * Get Manga genres
733
- * @param filter Type of the desired genres
734
- */
735
- getMangaGenres(filter?: GenresFilter): Promise<JikanResponse<Genre[]>>;
736
- }
737
- /**
738
- * **Characters Client**
836
+ * **Top Client**
739
837
  *
740
- * Client used to access the Character Endpoints:
838
+ * Client used to access the Top Endpoints:
741
839
  *
742
840
  * See also: [Jikan Documentation](https://docs.api.jikan.moe/)
743
841
  */
744
- export declare class CharactersClient extends BaseClient {
745
- /**
746
- * Get complete Character data
747
- * @param mal_id The Character ID
748
- * @returns JikanResponse with Character data
749
- */
750
- getCharacterFullById(mal_id: number): Promise<JikanResponse<Character>>;
751
- /**
752
- * Get Character data
753
- * @param mal_id The Character ID
754
- * @returns JikanResponse with Character data
755
- */
756
- getCharacterById(mal_id: number): Promise<JikanResponse<Character>>;
757
- /**
758
- * Get Character anime data
759
- * @param mal_id The Character ID
760
- * @returns JikanResponse with CharacterAnime data
761
- */
762
- getCharacterAnime(mal_id: number): Promise<JikanResponse<CharacterAnime[]>>;
763
- /**
764
- * Get Character manga data
765
- * @param mal_id The Character ID
766
- * @returns JikanResponse with CharacterManga data
767
- */
768
- getCharacterManga(mal_id: number): Promise<JikanResponse<CharacterManga[]>>;
769
- /**
770
- * Get Character voices data
771
- * @param mal_id The Character ID
772
- * @returns JikanResponse with CharacterVoiceActor data
773
- */
774
- getCharacterVoiceActors(mal_id: number): Promise<JikanResponse<CharacterVoiceActor[]>>;
775
- /**
776
- * Get Character pictures data
777
- * @param mal_id The Character ID
778
- * @returns JikanResponse with JikanImagesCollection data
779
- */
780
- getCharacterPictures(mal_id: number): Promise<JikanResponse<JikanImagesCollection[]>>;
842
+ export declare class TopClient extends BaseClient {
781
843
  /**
782
- * Get all the Characters within the given filter. Returns all Characters if no filters are given.
783
- @param searchParams Filter parameters
784
- * @returns JikanResponse with Character array data
844
+ * Get the top Animes
845
+ * @param searchParams Filter parameters
846
+ * @returns JikanResponse with Anime array data
785
847
  */
786
- getCharacterSearch(searchParams: Partial<CharactersSearchParams>): Promise<JikanResponse<Character[]>>;
787
- }
788
- /**
789
- * **Schedules Client**
790
- *
791
- * Client used to access the Schedules Endpoints
792
- *
793
- * See also: [Jikan Documentation](https://docs.api.jikan.moe/)
794
- */
795
- export declare class SchedulesClient extends BaseClient {
848
+ getTopAnime(searchParams?: Partial<AnimeTopParams>): Promise<JikanResponse<Anime[]>>;
796
849
  /**
797
- * Returns weekly schedule
850
+ * Get the top Mangas
798
851
  * @param searchParams Filter parameters
799
- * @returns JikanResponse with Anime array data
852
+ * @returns JikanResponse with Manga array data
800
853
  */
801
- getSchedules(searchParams?: Partial<SchedulesParams>): Promise<JikanResponse<Anime[]>>;
854
+ getTopManga(searchParams?: Partial<MangaTopParams>): Promise<JikanResponse<Manga[]>>;
802
855
  }
803
856
  /**
804
857
  * **Jikan Client**
@@ -817,7 +870,7 @@ export declare class JikanClient {
817
870
  seasons: SeasonsClient;
818
871
  constructor(clientOptions?: Partial<ClientArgs>);
819
872
  }
820
- export declare const handleRequest: (requestConfig: CacheRequestConfig) => CacheRequestConfig;
873
+ export declare const handleRequest: (requestConfig: InternalCacheRequestConfig) => InternalCacheRequestConfig;
821
874
  export declare const handleRequestError: (error: AxiosError) => Promise<AxiosError>;
822
875
  export declare const handleResponse: (response: CacheAxiosResponse) => CacheAxiosResponse;
823
876
  export declare const handleResponseError: (error: AxiosError) => Promise<AxiosError>;
@@ -825,18 +878,27 @@ export declare enum BaseURL {
825
878
  REST = "https://api.jikan.moe/v4"
826
879
  }
827
880
  export declare enum AnimeEndpoints {
828
- AnimeSearch = "/anime",
829
881
  AnimeFullById = "/anime/{id}/full",
830
882
  AnimeById = "/anime/{id}",
831
883
  AnimeCharacters = "/anime/{id}/characters",
832
884
  AnimeStaff = "/anime/{id}/staff",
833
885
  AnimeEpisodes = "/anime/{id}/episodes",
834
886
  AnimeEpisodeById = "/anime/{id}/episodes/{episode}",
887
+ AnimeNews = "/anime/{id}/news",
888
+ AnimeForum = "/anime/{id}/forum",
835
889
  AnimeVideos = "/anime/{id}/videos",
836
890
  AnimeVideosEpisodes = "/anime/{id}/videos/episodes",
837
891
  AnimePictures = "/anime/{id}/pictures",
838
892
  AnimeStatistics = "/anime/{id}/statistics",
839
- AnimeRecommendations = "/anime/{id}/recommendations"
893
+ AnimeMoreInfo = "/anime/{id}/moreinfo",
894
+ AnimeRecommendations = "/anime/{id}/recommendations",
895
+ AnimeUserUpdates = "/anime/{id}/userupdates",
896
+ AnimeReviews = "/anime/{id}/reviews",
897
+ AnimeRelations = "/anime/{id}/relations",
898
+ AnimeThemes = "/anime/{id}/themes",
899
+ AnimeExternal = "/anime/{id}/external",
900
+ AnimeStreaming = "/anime/{id}/streaming",
901
+ AnimeSearch = "/anime"
840
902
  }
841
903
  export declare enum CharactersEndpoints {
842
904
  CharacterFullById = "/characters/{id}/full",
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{setupCache as S}from"axios-cache-interceptor";import v from"axios";var A=(n=>(n.REST="https://api.jikan.moe/v4",n))(A||{});var k=(p=>(p.AnimeSearch="/anime",p.AnimeFullById="/anime/{id}/full",p.AnimeById="/anime/{id}",p.AnimeCharacters="/anime/{id}/characters",p.AnimeStaff="/anime/{id}/staff",p.AnimeEpisodes="/anime/{id}/episodes",p.AnimeEpisodeById="/anime/{id}/episodes/{episode}",p.AnimeVideos="/anime/{id}/videos",p.AnimeVideosEpisodes="/anime/{id}/videos/episodes",p.AnimePictures="/anime/{id}/pictures",p.AnimeStatistics="/anime/{id}/statistics",p.AnimeRecommendations="/anime/{id}/recommendations",p))(k||{});var J=(r=>(r.CharacterFullById="/characters/{id}/full",r.CharacterById="/characters/{id}",r.CharacterAnime="/characters/{id}/anime",r.CharactersManga="/characters/{id}/manga",r.CharacterVoiceActors="/characters/{id}/voices",r.CharacterPictures="/characters/{id}/pictures",r.CharacterSearch="/characters",r))(J||{});var P=(a=>(a.AnimeGenres="/genres/anime",a.MangaGenres="genres/manga",a))(P||{});var f=(r=>(r.MangaSearch="/manga",r.MangaFullById="/manga/{id}/full",r.MangaById="/manga/{id}",r.MangaCharacters="/manga/{id}/characters",r.MangaPictures="/manga/{id}/pictures",r.MangaStatistics="/manga/{id}/statistics",r.MangaRecommendations="/manga/{id}/recommendations",r))(f||{});var C=(s=>(s.Season="/seasons/{year}/{season}",s.SeasonNow="/seasons/now",s.SeasonsList="/seasons",s.SeasonUpcoming="/seasons/upcoming",s))(C||{});var b=(a=>(a.TopAnime="/top/anime",a.TopManga="/top/manga",a))(b||{});var y=t=>(console.info(`[Request] ${t.method?.toUpperCase()||""} | ${t.url||""}`),t),w=t=>{throw console.error(`[Request Error] CODE ${t.code||"UNKNOWN"} | ${t.message}`),t},E=t=>(console.info(`[Request Response] ${t.config.method?.toUpperCase()||""} | ${t.config.url||""}`,t.data),t),M=t=>{throw console.error(`[ Response Error ] CODE ${t.code||"UNKNOWN"} | ${t.message}`),t};var m=class{api;constructor(n={}){this.api=S(v.create({baseURL:n.baseURL??"https://api.jikan.moe/v4",headers:{"Content-Type":"application/json"}}),n.cacheOptions),n.enableLogging&&this.addLoggingInterceptors()}replacePathParams(n,a){for(let i of Object.keys(a)){if(!n.match(`{${i}}`))throw new Error(`Path does not contain "${i}" parameter.`);n=n.replace(`{${i}}`,String(a[i]))}return n}addLoggingInterceptors(){this.api.interceptors.request.use(n=>y(n),n=>w(n)),this.api.interceptors.response.use(n=>E(n),n=>M(n))}};var h=class extends m{async getAnimeSearch(n){return new Promise((a,i)=>{let s="/anime";this.api.get(s,{params:n}).then(e=>a(e.data)).catch(e=>i(e))})}async getAnimeFullById(n){return new Promise((a,i)=>{let s=this.replacePathParams("/anime/{id}/full",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getAnimeById(n){return new Promise((a,i)=>{let s=this.replacePathParams("/anime/{id}",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getAnimeCharacters(n){return new Promise((a,i)=>{let s=this.replacePathParams("/anime/{id}/characters",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getAnimeStaff(n){return new Promise((a,i)=>{let s=this.replacePathParams("/anime/{id}/staff",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getAnimeEpisodes(n,a=1){return new Promise((i,s)=>{let e=this.replacePathParams("/anime/{id}/episodes",{id:n});this.api.get(e,{params:{page:a}}).then(o=>i(o.data)).catch(o=>s(o))})}async getAnimeEpisodeById(n,a){return new Promise((i,s)=>{let e=this.replacePathParams("/anime/{id}/episodes/{episode}",{id:n,episode:a});this.api.get(e).then(o=>i(o.data)).catch(o=>s(o))})}async getAnimeVideos(n){return new Promise((a,i)=>{let s=this.replacePathParams("/anime/{id}/videos",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getAnimeEpisodeVideos(n,a=1){return new Promise((i,s)=>{let e=this.replacePathParams("/anime/{id}/videos/episodes",{id:n});this.api.get(e,{params:{page:a}}).then(o=>i(o.data)).catch(o=>s(o))})}async getAnimePictures(n){return new Promise((a,i)=>{let s=this.replacePathParams("/anime/{id}/pictures",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getAnimeStatistics(n){return new Promise((a,i)=>{let s=this.replacePathParams("/anime/{id}/statistics",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getAnimeRecommendations(n){return new Promise((a,i)=>{let s=this.replacePathParams("/anime/{id}/recommendations",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}};var g=class extends m{async getMangaSearch(n){return new Promise((a,i)=>{let s="/manga";this.api.get(s,{params:n}).then(e=>a(e.data)).catch(e=>i(e))})}async getMangaFullById(n){return new Promise((a,i)=>{let s=this.replacePathParams("/manga/{id}/full",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getMangaById(n){return new Promise((a,i)=>{let s=this.replacePathParams("/manga/{id}",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getMangaCharacters(n){return new Promise((a,i)=>{let s=this.replacePathParams("/manga/{id}/characters",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getMangaPictures(n){return new Promise((a,i)=>{let s=this.replacePathParams("/manga/{id}/pictures",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getMangaStatistics(n){return new Promise((a,i)=>{let s=this.replacePathParams("/manga/{id}/statistics",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getMangaRecommendations(n){return new Promise((a,i)=>{let s=this.replacePathParams("/manga/{id}/recommendations",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}};var u=class extends m{async getTopAnime(n){return new Promise((a,i)=>{let s="/top/anime";this.api.get(s,{params:n}).then(e=>a(e.data)).catch(e=>i(e))})}async getTopManga(n){return new Promise((a,i)=>{let s="/top/manga";this.api.get(s,{params:n}).then(e=>a(e.data)).catch(e=>i(e))})}};var d=class extends m{async getSeason(n,a,i){return new Promise((s,e)=>{let o=this.replacePathParams("/seasons/{year}/{season}",{year:n,season:a});this.api.get(o,{params:i}).then(r=>s(r.data)).catch(r=>e(r))})}async getSeasonNow(n){return new Promise((a,i)=>{let s="/seasons/now";this.api.get(s,{params:n}).then(e=>a(e.data)).catch(e=>i(e))})}async getSeasonsList(){return new Promise((n,a)=>{let i="/seasons";this.api.get(i).then(s=>n(s.data)).catch(s=>a(s))})}async getSeasonUpcoming(n){return new Promise((a,i)=>{let s="/seasons/upcoming";this.api.get(s,{params:n}).then(e=>a(e.data)).catch(e=>i(e))})}};var R=class extends m{async getAnimeGenres(n){return new Promise((a,i)=>{let s="/genres/anime";this.api.get(s,{params:{filter:n}}).then(e=>a(e.data)).catch(e=>i(e))})}async getMangaGenres(n){return new Promise((a,i)=>{let s="genres/manga";this.api.get(s,{params:{filter:n}}).then(e=>a(e.data)).catch(e=>i(e))})}};var l=class extends m{async getCharacterFullById(n){return new Promise((a,i)=>{let s=this.replacePathParams("/characters/{id}/full",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getCharacterById(n){return new Promise((a,i)=>{let s=this.replacePathParams("/characters/{id}",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getCharacterAnime(n){return new Promise((a,i)=>{let s=this.replacePathParams("/characters/{id}/anime",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getCharacterManga(n){return new Promise((a,i)=>{let s=this.replacePathParams("/characters/{id}/manga",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getCharacterVoiceActors(n){return new Promise((a,i)=>{let s=this.replacePathParams("/characters/{id}/voices",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getCharacterPictures(n){return new Promise((a,i)=>{let s=this.replacePathParams("/characters/{id}/pictures",{id:n});this.api.get(s).then(e=>a(e.data)).catch(e=>i(e))})}async getCharacterSearch(n){return new Promise((a,i)=>{let s="/characters";this.api.get(s,{params:n}).then(e=>a(e.data)).catch(e=>i(e))})}};var x=class extends m{async getSchedules(n){return new Promise((a,i)=>{let s="/schedules";this.api.get(s,{params:n}).then(e=>a(e.data)).catch(e=>i(e))})}};var I=class{anime;characters;genres;manga;top;schedules;seasons;constructor(n){this.anime=new h(n),this.characters=new l(n),this.genres=new R(n),this.manga=new g(n),this.top=new u(n),this.schedules=new x(n),this.seasons=new d(n)}};var _=(o=>(o.tv="TV",o.movie="Movie",o.ova="Ova",o.special="Special",o.ona="Ona",o.music="Music",o))(_||{}),B=(s=>(s.finished="Finished Airing",s.airing="Currently Airing",s.complete="Complete",s.upcoming="Not yet aired",s))(B||{}),V=(o=>(o.g="g",o.pg="pg",o.pg13="pg13",o.r17="r17",o.r="r",o.rx="rx",o))(V||{}),$=(s=>(s.spring="spring",s.summer="summer",s.fall="fall",s.winter="winter",s))($||{});var N=(a=>(a.main="Main",a.supporting="Supporting",a))(N||{});var L=(r=>(r.manga="Manga",r.novel="Novel",r.lightnovel="Lightnovel",r.oneshot="Oneshot",r.doujin="Doujin",r.manhwa="Manhwa",r.manhua="Manhua",r))(L||{}),T=(e=>(e.publishing="Publishing",e.complete="Complete",e.hiatus="On Hiatus",e.discontinued="Discontinued",e.upcoming="Upcoming",e))(T||{});var q=(a=>(a.asc="asc",a.desc="desc",a))(q||{}),G=(c=>(c.mal_id="mal_id",c.title="title",c.start_date="start_date",c.end_date="end_date",c.score="score",c.scored_by="scored_by",c.rank="rank",c.popularity="popularity",c.members="members",c.favorites="favorites",c))(G||{}),D=(i=>(i.type="type",i.rating="rating",i.episodes="episodes",i))(D||{}),U=(i=>(i.airing="airing",i.complete="complete",i.upcoming="upcoming",i))(U||{}),j=(a=>(a.chapters="chapters",a.volumes="volumes",a))(j||{}),z=(e=>(e.publishing="publishing",e.complete="complete",e.hiatus="hiatus",e.discontinued="discontinued",e.upcoming="upcoming",e))(z||{});var K=(s=>(s.airing="airing",s.upcoming="upcoming",s.bypopularity="bypopularity",s.favorite="favorite",s))(K||{}),W=(s=>(s.publishing="publishing",s.upcoming="upcoming",s.bypopularity="bypopularity",s.favorite="favorite",s))(W||{});var Y=(s=>(s.genres="genres",s.explicit_genres="explicit_genres",s.theme="themes",s.demographics="demographics",s))(Y||{});var H=(i=>(i.mal_id="mal_id",i.name="name",i.favorites="favorites",i))(H||{});var Q=(r=>(r.monday="monday",r.tuesday="tuesday",r.wednesday="wednesday",r.thursday="thursday",r.friday="friday",r.unknown="unknown",r.other="other",r))(Q||{});export{h as AnimeClient,k as AnimeEndpoints,V as AnimeRating,D as AnimeSearchOrder,U as AnimeSearchStatus,$ as AnimeSeason,B as AnimeStatus,_ as AnimeType,m as BaseClient,A as BaseURL,N as CharacterRole,l as CharactersClient,J as CharactersEndpoints,H as CharactersSearchOrder,R as GenresClient,P as GenresEndpoints,Y as GenresFilter,I as JikanClient,g as MangaClient,f as MangaEndpoints,j as MangaSearchOrder,z as MangaSearchStatus,T as MangaStatus,L as MangaType,x as SchedulesClient,Q as SchedulesFilter,G as SearchOrder,d as SeasonsClient,C as SeasonsEndpoints,q as SortOptions,K as TopAnimeFilter,u as TopClient,b as TopEndpoints,W as TopMangaFilter,y as handleRequest,w as handleRequestError,E as handleResponse,M as handleResponseError};
1
+ var k=(e=>(e.REST="https://api.jikan.moe/v4",e))(k||{});var x=(a=>(a.AnimeFullById="/anime/{id}/full",a.AnimeById="/anime/{id}",a.AnimeCharacters="/anime/{id}/characters",a.AnimeStaff="/anime/{id}/staff",a.AnimeEpisodes="/anime/{id}/episodes",a.AnimeEpisodeById="/anime/{id}/episodes/{episode}",a.AnimeNews="/anime/{id}/news",a.AnimeForum="/anime/{id}/forum",a.AnimeVideos="/anime/{id}/videos",a.AnimeVideosEpisodes="/anime/{id}/videos/episodes",a.AnimePictures="/anime/{id}/pictures",a.AnimeStatistics="/anime/{id}/statistics",a.AnimeMoreInfo="/anime/{id}/moreinfo",a.AnimeRecommendations="/anime/{id}/recommendations",a.AnimeUserUpdates="/anime/{id}/userupdates",a.AnimeReviews="/anime/{id}/reviews",a.AnimeRelations="/anime/{id}/relations",a.AnimeThemes="/anime/{id}/themes",a.AnimeExternal="/anime/{id}/external",a.AnimeStreaming="/anime/{id}/streaming",a.AnimeSearch="/anime",a))(x||{});var b=(n=>(n.CharacterFullById="/characters/{id}/full",n.CharacterById="/characters/{id}",n.CharacterAnime="/characters/{id}/anime",n.CharactersManga="/characters/{id}/manga",n.CharacterVoiceActors="/characters/{id}/voices",n.CharacterPictures="/characters/{id}/pictures",n.CharacterSearch="/characters",n))(b||{});var J=(r=>(r.AnimeGenres="/genres/anime",r.MangaGenres="genres/manga",r))(J||{});var A=(n=>(n.MangaSearch="/manga",n.MangaFullById="/manga/{id}/full",n.MangaById="/manga/{id}",n.MangaCharacters="/manga/{id}/characters",n.MangaPictures="/manga/{id}/pictures",n.MangaStatistics="/manga/{id}/statistics",n.MangaRecommendations="/manga/{id}/recommendations",n))(A||{});var y=(s=>(s.Season="/seasons/{year}/{season}",s.SeasonNow="/seasons/now",s.SeasonsList="/seasons",s.SeasonUpcoming="/seasons/upcoming",s))(y||{});var P=(r=>(r.TopAnime="/top/anime",r.TopManga="/top/manga",r))(P||{});import _ from"axios";import{setupCache as S}from"axios-cache-interceptor";var C=i=>(console.info(`[Request] ${i.method?.toUpperCase()??""} | ${i.url??""}`),i),I=i=>{throw console.error(`[Request Error] CODE ${i.code??"UNKNOWN"} | ${i.message}`),i},M=i=>(console.info(`[Request Response] ${i.config.method?.toUpperCase()??""} | ${i.config.url??""}`,i.data),i),w=i=>{throw console.error(`[ Response Error ] CODE ${i.code??"UNKNOWN"} | ${i.message}`),i};var t=class{api;constructor(e={}){this.api=S(_.create({baseURL:e.baseURL??"https://api.jikan.moe/v4",headers:{"Content-Type":"application/json"}}),{...e.cacheOptions,cacheTakeover:!1}),e.enableLogging&&this.addLoggingInterceptors()}async getResource(e,r={},o={}){return(await this.api.get(this.replacePathParams(e,r),{params:o})).data}replacePathParams(e,r){for(let o of Object.keys(r)){if(!e.match(`{${o}}`))throw new Error(`Path does not contain "${o}" parameter.`);e=e.replace(`{${o}}`,String(r[o]))}return e}addLoggingInterceptors(){this.api.interceptors.request.use(e=>C(e),e=>I(e)),this.api.interceptors.response.use(e=>M(e),e=>w(e))}};var u=class extends t{async getAnimeFullById(e){return this.getResource("/anime/{id}/full",{id:e})}async getAnimeById(e){return this.getResource("/anime/{id}",{id:e})}async getAnimeCharacters(e){return this.getResource("/anime/{id}/characters",{id:e})}async getAnimeStaff(e){return this.getResource("/anime/{id}/staff",{id:e})}async getAnimeEpisodes(e,r=1){return this.getResource("/anime/{id}/episodes",{id:e},{page:r})}async getAnimeEpisodeById(e,r){return this.getResource("/anime/{id}/episodes/{episode}",{id:e,episode:r})}async getAnimeNews(e,r){return this.getResource("/anime/{id}/news",{id:e},{page:r})}async getAnimeForum(e,r){return this.getResource("/anime/{id}/news",{id:e},{filter:r})}async getAnimeVideos(e){return this.getResource("/anime/{id}/videos",{id:e})}async getAnimeEpisodeVideos(e,r=1){return this.getResource("/anime/{id}/videos/episodes",{id:e},{page:r})}async getAnimePictures(e){return this.getResource("/anime/{id}/pictures",{id:e})}async getAnimeStatistics(e){return this.getResource("/anime/{id}/statistics",{id:e})}async getAnimeMoreInfo(e){return this.getResource("/anime/{id}/moreinfo",{id:e})}async getAnimeRecommendations(e){return this.getResource("/anime/{id}/recommendations",{id:e})}async getAnimeRelations(e){return this.getResource("/anime/{id}/relations",{id:e})}async getAnimeSearch(e){return this.getResource("/anime",{},e)}};var g=class extends t{async getCharacterFullById(e){return this.getResource("/characters/{id}/full",{id:e})}async getCharacterById(e){return this.getResource("/characters/{id}",{id:e})}async getCharacterAnime(e){return this.getResource("/characters/{id}/anime",{id:e})}async getCharacterManga(e){return this.getResource("/characters/{id}/manga",{id:e})}async getCharacterVoiceActors(e){return this.getResource("/characters/{id}/voices",{id:e})}async getCharacterPictures(e){return this.getResource("/characters/{id}/pictures",{id:e})}async getCharacterSearch(e){return this.getResource("/characters/{id}/pictures",{},e)}};var l=class extends t{async getAnimeGenres(e){return this.getResource("/genres/anime",{},{filter:e})}async getMangaGenres(e){return this.getResource("genres/manga",{},{filter:e})}};var R=class extends t{async getMangaFullById(e){return this.getResource("/manga/{id}/full",{id:e})}async getMangaById(e){return this.getResource("/manga/{id}",{id:e})}async getMangaCharacters(e){return this.getResource("/manga/{id}/characters",{id:e})}async getMangaPictures(e){return this.getResource("/manga/{id}/pictures",{id:e})}async getMangaStatistics(e){return this.getResource("/manga/{id}/statistics",{id:e})}async getMangaRecommendations(e){return this.getResource("/manga/{id}/recommendations",{id:e})}async getMangaSearch(e){return this.getResource("/manga",{},e)}};var h=class extends t{async getSchedules(e){return this.getResource("/schedules",{},e)}};var d=class extends t{async getSeason(e,r,o){return this.getResource("/seasons/{year}/{season}",{year:e,season:r},o)}async getSeasonNow(e){return this.getResource("/seasons/now",{},e)}async getSeasonsList(){return this.getResource("/seasons")}async getSeasonUpcoming(e){return this.getResource("/seasons/upcoming",{},e)}};var f=class extends t{async getTopAnime(e){return this.getResource("/top/anime",{},e)}async getTopManga(e){return this.getResource("/top/manga",{},e)}};var v=class{anime;characters;genres;manga;top;schedules;seasons;constructor(e){this.anime=new u(e),this.characters=new g(e),this.genres=new l(e),this.manga=new R(e),this.top=new f(e),this.schedules=new h(e),this.seasons=new d(e)}};var B=(m=>(m.tv="TV",m.movie="Movie",m.ova="Ova",m.special="Special",m.ona="Ona",m.music="Music",m))(B||{}),N=(s=>(s.finished="Finished Airing",s.airing="Currently Airing",s.complete="Complete",s.upcoming="Not yet aired",s))(N||{}),V=(m=>(m.g="g",m.pg="pg",m.pg13="pg13",m.r17="r17",m.r="r",m.rx="rx",m))(V||{}),T=(s=>(s.spring="spring",s.summer="summer",s.fall="fall",s.winter="winter",s))(T||{});var L=(r=>(r.main="Main",r.supporting="Supporting",r))(L||{});var q=(n=>(n.manga="Manga",n.novel="Novel",n.lightnovel="Lightnovel",n.oneshot="Oneshot",n.doujin="Doujin",n.manhwa="Manhwa",n.manhua="Manhua",n))(q||{}),U=(c=>(c.publishing="Publishing",c.complete="Complete",c.hiatus="On Hiatus",c.discontinued="Discontinued",c.upcoming="Upcoming",c))(U||{});var $=(o=>(o.mal_id="mal_id",o.name="name",o.favorites="favorites",o))($||{});var G=(s=>(s.genres="genres",s.explicit_genres="explicit_genres",s.theme="themes",s.demographics="demographics",s))(G||{});var D=(n=>(n.monday="monday",n.tuesday="tuesday",n.wednesday="wednesday",n.thursday="thursday",n.friday="friday",n.unknown="unknown",n.other="other",n))(D||{});var j=(r=>(r.asc="asc",r.desc="desc",r))(j||{}),F=(p=>(p.mal_id="mal_id",p.title="title",p.start_date="start_date",p.end_date="end_date",p.score="score",p.scored_by="scored_by",p.rank="rank",p.popularity="popularity",p.members="members",p.favorites="favorites",p))(F||{}),z=(o=>(o.type="type",o.rating="rating",o.episodes="episodes",o))(z||{}),K=(o=>(o.airing="airing",o.complete="complete",o.upcoming="upcoming",o))(K||{}),W=(r=>(r.chapters="chapters",r.volumes="volumes",r))(W||{}),Y=(c=>(c.publishing="publishing",c.complete="complete",c.hiatus="hiatus",c.discontinued="discontinued",c.upcoming="upcoming",c))(Y||{});var H=(s=>(s.airing="airing",s.upcoming="upcoming",s.bypopularity="bypopularity",s.favorite="favorite",s))(H||{}),E=(s=>(s.publishing="publishing",s.upcoming="upcoming",s.bypopularity="bypopularity",s.favorite="favorite",s))(E||{});export{u as AnimeClient,x as AnimeEndpoints,V as AnimeRating,z as AnimeSearchOrder,K as AnimeSearchStatus,T as AnimeSeason,N as AnimeStatus,B as AnimeType,t as BaseClient,k as BaseURL,L as CharacterRole,g as CharactersClient,b as CharactersEndpoints,$ as CharactersSearchOrder,l as GenresClient,J as GenresEndpoints,G as GenresFilter,v as JikanClient,R as MangaClient,A as MangaEndpoints,W as MangaSearchOrder,Y as MangaSearchStatus,U as MangaStatus,q as MangaType,h as SchedulesClient,D as SchedulesFilter,F as SearchOrder,d as SeasonsClient,y as SeasonsEndpoints,j as SortOptions,H as TopAnimeFilter,f as TopClient,P as TopEndpoints,E as TopMangaFilter,C as handleRequest,I as handleRequestError,M as handleResponse,w as handleResponseError};
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@tutkli/jikan-ts",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "Node.js wrapper for the Jikan API with built-in typings.",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "type": "module",
9
9
  "scripts": {
10
+ "prepare": "git config core.hookspath .githooks",
10
11
  "prebuild": "rimraf dist",
11
12
  "build": "yarn run esbuild && yarn run build-types",
12
13
  "esbuild": "node ./esbuild.config.js",
@@ -15,9 +16,8 @@
15
16
  "test:coverage": "jest --coverage",
16
17
  "test:dev": "jest --verbose --colors --expand --maxWorkers=50% --detectOpenHandles --errorOnDeprecated --bail",
17
18
  "lint:fix": "npx eslint src/** --fix",
18
- "docs:dev": "vitepress dev docs",
19
- "docs:build": "vitepress build docs",
20
- "docs:preview": "vitepress preview docs"
19
+ "prettify": "prettier --write .",
20
+ "version": "auto-changelog -p -l false && git add CHANGELOG.md"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",
@@ -38,29 +38,33 @@
38
38
  "url": "https://github.com/tutkli/jikan-ts/issues"
39
39
  },
40
40
  "homepage": "https://github.com/tutkli/jikan-ts#readme",
41
- "dependencies": {
42
- "axios": "^0.27.2",
43
- "axios-cache-interceptor": "^0.10.7"
41
+ "peerDependencies": {
42
+ "axios": "^1.6.7",
43
+ "axios-cache-interceptor": "^1.5.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@swc/core": "1.3.78",
47
- "@swc/jest": "0.2.29",
48
- "@types/jest": "29.5.3",
49
- "@types/node": "20.5.1",
50
- "@typescript-eslint/eslint-plugin": "6.4.1",
51
- "@typescript-eslint/parser": "6.4.1",
52
- "dts-bundle-generator": "8.0.1",
53
- "esbuild": "0.19.2",
54
- "esbuild-node-externals": "1.8.0",
55
- "eslint": "8.47.0",
56
- "eslint-config-prettier": "9.0.0",
57
- "eslint-plugin-jest": "27.2.3",
46
+ "@swc/core": "1.4.0",
47
+ "@swc/jest": "0.2.36",
48
+ "@types/jest": "29.5.12",
49
+ "@types/node": "20.11.16",
50
+ "@typescript-eslint/eslint-plugin": "6.21.0",
51
+ "@typescript-eslint/parser": "6.21.0",
52
+ "auto-changelog": "^2.4.0",
53
+ "axios": "^1.6.7",
54
+ "axios-cache-interceptor": "^1.5.1",
55
+ "dts-bundle-generator": "9.3.1",
56
+ "esbuild": "0.20.0",
57
+ "esbuild-node-externals": "1.12.0",
58
+ "eslint": "8.56.0",
59
+ "eslint-config-prettier": "9.1.0",
60
+ "eslint-plugin-jest": "27.6.3",
58
61
  "eslint-plugin-node": "^11.1.0",
59
- "eslint-plugin-prettier": "5.0.0",
60
- "jest": "29.6.3",
61
- "prettier": "3.0.2",
62
- "rimraf": "5.0.1",
63
- "typescript": "5.1.6",
64
- "vitepress": "^1.0.0-rc.4"
62
+ "eslint-plugin-prettier": "5.1.3",
63
+ "jest": "29.7.0",
64
+ "lint-staged": "^15.2.2",
65
+ "prettier": "3.2.5",
66
+ "prettier-plugin-organize-imports": "^3.2.4",
67
+ "rimraf": "5.0.5",
68
+ "typescript": "5.3.3"
65
69
  }
66
70
  }