@tutkli/jikan-ts 1.2.2 → 2.0.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/README.md +4 -5
- package/dist/index.d.ts +195 -240
- package/dist/index.js +1 -11
- package/package.json +53 -58
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
|
-
> Jikan API wrapper for Typescript and
|
|
15
|
+
> Jikan API wrapper for Typescript and Node.js with built-in typings.
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
@@ -40,10 +40,9 @@ const animeClient = new AnimeClient();
|
|
|
40
40
|
|
|
41
41
|
animeClient
|
|
42
42
|
.getAnimeById(1)
|
|
43
|
-
.then((
|
|
43
|
+
.then((response: JikanResponse<Anime>) => {
|
|
44
44
|
/* ... */
|
|
45
45
|
})
|
|
46
|
-
.catch(error => console.error(error));
|
|
47
46
|
```
|
|
48
47
|
|
|
49
48
|
Or, using the **JikanClient**:
|
|
@@ -55,10 +54,9 @@ const jikanClient = new JikanClient();
|
|
|
55
54
|
|
|
56
55
|
jikanClient.anime
|
|
57
56
|
.getAnimeById(1)
|
|
58
|
-
.then((
|
|
57
|
+
.then((response: JikanResponse<Anime>) => {
|
|
59
58
|
/* ... */
|
|
60
59
|
})
|
|
61
|
-
.catch(error => console.error(error));
|
|
62
60
|
```
|
|
63
61
|
|
|
64
62
|
## Client configuration
|
|
@@ -100,6 +98,7 @@ const animeClient = new AnimeClient({
|
|
|
100
98
|
- TopClient
|
|
101
99
|
- SchedulesClient
|
|
102
100
|
- SeasonsClient
|
|
101
|
+
- RandomClient
|
|
103
102
|
- JikanClient (Main client)
|
|
104
103
|
|
|
105
104
|
## Leave you feedback
|
package/dist/index.d.ts
CHANGED
|
@@ -35,10 +35,7 @@ interface CharacterVoiceActor {
|
|
|
35
35
|
person: JikanPerson;
|
|
36
36
|
language: string;
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
main = "Main",
|
|
40
|
-
supporting = "Supporting"
|
|
41
|
-
}
|
|
38
|
+
type CharacterRole = 'Main' | 'Supporting';
|
|
42
39
|
|
|
43
40
|
interface JikanMoreInfo {
|
|
44
41
|
moreinfo: string;
|
|
@@ -116,7 +113,7 @@ interface JikanResourceRelation {
|
|
|
116
113
|
|
|
117
114
|
interface SeasonsListData {
|
|
118
115
|
year: number;
|
|
119
|
-
seasons:
|
|
116
|
+
seasons: AnimeSeason[];
|
|
120
117
|
}
|
|
121
118
|
|
|
122
119
|
interface Statistics {
|
|
@@ -132,6 +129,28 @@ interface StatisticsScore {
|
|
|
132
129
|
percentage: number;
|
|
133
130
|
}
|
|
134
131
|
|
|
132
|
+
interface JikanForum {
|
|
133
|
+
mal_id: number;
|
|
134
|
+
url: string;
|
|
135
|
+
title: string;
|
|
136
|
+
date: string;
|
|
137
|
+
author_username: string;
|
|
138
|
+
author_url: string;
|
|
139
|
+
comments: number;
|
|
140
|
+
last_comment: {
|
|
141
|
+
url: string;
|
|
142
|
+
author_username: string;
|
|
143
|
+
author_url: string;
|
|
144
|
+
date: string;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
type ForumFilter = 'all' | 'episode' | 'other';
|
|
148
|
+
|
|
149
|
+
interface JikanExternalLink {
|
|
150
|
+
name: string;
|
|
151
|
+
url: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
135
154
|
interface AnimeCharacter extends CommonCharacter {
|
|
136
155
|
voice_actors: CharacterVoiceActor[];
|
|
137
156
|
}
|
|
@@ -149,23 +168,6 @@ interface AnimeEpisode {
|
|
|
149
168
|
forum_url: string;
|
|
150
169
|
}
|
|
151
170
|
|
|
152
|
-
interface AnimeForum {
|
|
153
|
-
mal_id: number;
|
|
154
|
-
url: string;
|
|
155
|
-
title: string;
|
|
156
|
-
date: string;
|
|
157
|
-
author_username: string;
|
|
158
|
-
author_url: string;
|
|
159
|
-
comments: number;
|
|
160
|
-
last_comment: {
|
|
161
|
-
url: string;
|
|
162
|
-
author_username: string;
|
|
163
|
-
author_url: string;
|
|
164
|
-
date: string;
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
type AnimeForumFilter = 'all' | 'episode' | 'other';
|
|
168
|
-
|
|
169
171
|
interface AnimePicture {
|
|
170
172
|
images: JikanImages;
|
|
171
173
|
}
|
|
@@ -264,34 +266,10 @@ interface AnimeTheme {
|
|
|
264
266
|
openings: string[];
|
|
265
267
|
endings: string[];
|
|
266
268
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
special = "Special",
|
|
272
|
-
ona = "Ona",
|
|
273
|
-
music = "Music"
|
|
274
|
-
}
|
|
275
|
-
declare enum AnimeStatus {
|
|
276
|
-
finished = "Finished Airing",
|
|
277
|
-
airing = "Currently Airing",
|
|
278
|
-
complete = "Complete",
|
|
279
|
-
upcoming = "Not yet aired"
|
|
280
|
-
}
|
|
281
|
-
declare enum AnimeRating {
|
|
282
|
-
g = "g",
|
|
283
|
-
pg = "pg",
|
|
284
|
-
pg13 = "pg13",
|
|
285
|
-
r17 = "r17",
|
|
286
|
-
r = "r",
|
|
287
|
-
rx = "rx"
|
|
288
|
-
}
|
|
289
|
-
declare enum AnimeSeason {
|
|
290
|
-
spring = "spring",
|
|
291
|
-
summer = "summer",
|
|
292
|
-
fall = "fall",
|
|
293
|
-
winter = "winter"
|
|
294
|
-
}
|
|
269
|
+
type AnimeType = 'TV' | 'Movie' | 'Ova' | 'Special' | 'Ona' | 'Music';
|
|
270
|
+
type AnimeStatus = 'Finished Airing' | 'Currently Airing' | 'Complete' | 'Not yet aired';
|
|
271
|
+
type AnimeRating = 'g' | 'pg' | 'pg13' | 'r17' | 'r' | 'rx';
|
|
272
|
+
type AnimeSeason = 'spring' | 'summer' | 'fall' | 'winter';
|
|
295
273
|
|
|
296
274
|
interface Character {
|
|
297
275
|
mal_id: number;
|
|
@@ -302,6 +280,8 @@ interface Character {
|
|
|
302
280
|
nicknames: string[];
|
|
303
281
|
favorites: number;
|
|
304
282
|
about: string;
|
|
283
|
+
}
|
|
284
|
+
interface CharacterFull extends Character {
|
|
305
285
|
anime: CharacterAnime[];
|
|
306
286
|
manga: CharacterManga[];
|
|
307
287
|
voices: CharacterVoiceActor[];
|
|
@@ -361,60 +341,15 @@ interface Manga {
|
|
|
361
341
|
relations?: JikanResourceRelation[];
|
|
362
342
|
external?: JikanNamedResource[];
|
|
363
343
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
declare enum MangaStatus {
|
|
374
|
-
publishing = "Publishing",
|
|
375
|
-
complete = "Complete",
|
|
376
|
-
hiatus = "On Hiatus",
|
|
377
|
-
discontinued = "Discontinued",
|
|
378
|
-
upcoming = "Upcoming"
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
declare enum SortOptions {
|
|
382
|
-
asc = "asc",
|
|
383
|
-
desc = "desc"
|
|
384
|
-
}
|
|
385
|
-
declare enum SearchOrder {
|
|
386
|
-
mal_id = "mal_id",
|
|
387
|
-
title = "title",
|
|
388
|
-
start_date = "start_date",
|
|
389
|
-
end_date = "end_date",
|
|
390
|
-
score = "score",
|
|
391
|
-
scored_by = "scored_by",
|
|
392
|
-
rank = "rank",
|
|
393
|
-
popularity = "popularity",
|
|
394
|
-
members = "members",
|
|
395
|
-
favorites = "favorites"
|
|
396
|
-
}
|
|
397
|
-
declare enum AnimeSearchOrder {
|
|
398
|
-
type = "type",
|
|
399
|
-
rating = "rating",
|
|
400
|
-
episodes = "episodes"
|
|
401
|
-
}
|
|
402
|
-
declare enum AnimeSearchStatus {
|
|
403
|
-
airing = "airing",
|
|
404
|
-
complete = "complete",
|
|
405
|
-
upcoming = "upcoming"
|
|
406
|
-
}
|
|
407
|
-
declare enum MangaSearchOrder {
|
|
408
|
-
chapters = "chapters",
|
|
409
|
-
volumes = "volumes"
|
|
410
|
-
}
|
|
411
|
-
declare enum MangaSearchStatus {
|
|
412
|
-
publishing = "publishing",
|
|
413
|
-
complete = "complete",
|
|
414
|
-
hiatus = "hiatus",
|
|
415
|
-
discontinued = "discontinued",
|
|
416
|
-
upcoming = "upcoming"
|
|
417
|
-
}
|
|
344
|
+
type MangaType = 'Manga' | 'Novel' | 'Lightnovel' | 'Oneshot' | 'Doujin' | 'Manhwa' | 'Manhua';
|
|
345
|
+
type MangaStatus = 'Publishing' | 'Complete' | 'On Hiatus' | 'Discontinued' | 'Upcoming';
|
|
346
|
+
|
|
347
|
+
type SortOptions = 'asc' | 'desc';
|
|
348
|
+
type SearchOrder = 'mal_id' | 'title' | 'start_date' | 'end_date' | 'score' | 'scored_by' | 'rank' | 'popularity' | 'members' | 'favorites';
|
|
349
|
+
type AnimeSearchOrder = 'type' | 'rating' | 'episodes' | SearchOrder;
|
|
350
|
+
type AnimeSearchStatus = 'airing' | 'complete' | 'upcoming';
|
|
351
|
+
type MangaSearchOrder = 'chapters' | 'volumes' | SearchOrder;
|
|
352
|
+
type MangaSearchStatus = 'publishing' | 'complete' | 'hiatus' | 'discontinued' | 'upcoming';
|
|
418
353
|
interface JikanSearchParams {
|
|
419
354
|
q?: string;
|
|
420
355
|
page?: number;
|
|
@@ -425,7 +360,7 @@ interface JikanSearchParams {
|
|
|
425
360
|
sfw?: boolean;
|
|
426
361
|
genres?: string;
|
|
427
362
|
genres_exclude?: string;
|
|
428
|
-
sort?: SortOptions
|
|
363
|
+
sort?: SortOptions;
|
|
429
364
|
letter?: string;
|
|
430
365
|
producers?: string;
|
|
431
366
|
start_date?: string;
|
|
@@ -438,9 +373,9 @@ interface JikanSearchParams {
|
|
|
438
373
|
* See also: [Jikan API Documentation](https://docs.api.jikan.moe/#tag/manga/operation/getMangaSearch)
|
|
439
374
|
*/
|
|
440
375
|
interface MangaSearchParams extends JikanSearchParams {
|
|
441
|
-
type?: MangaType
|
|
442
|
-
status?: MangaSearchStatus
|
|
443
|
-
order_by?: MangaSearchOrder
|
|
376
|
+
type?: MangaType;
|
|
377
|
+
status?: MangaSearchStatus;
|
|
378
|
+
order_by?: MangaSearchOrder;
|
|
444
379
|
magazines?: string;
|
|
445
380
|
}
|
|
446
381
|
/**
|
|
@@ -449,10 +384,10 @@ interface MangaSearchParams extends JikanSearchParams {
|
|
|
449
384
|
* See also: [Jikan API Documentation](https://docs.api.jikan.moe/#tag/anime/operation/getAnimeSearch)
|
|
450
385
|
*/
|
|
451
386
|
interface AnimeSearchParams extends JikanSearchParams {
|
|
452
|
-
type?: AnimeType
|
|
453
|
-
status?: AnimeSearchStatus
|
|
454
|
-
rating?: AnimeRating
|
|
455
|
-
order_by?: AnimeSearchOrder
|
|
387
|
+
type?: AnimeType;
|
|
388
|
+
status?: AnimeSearchStatus;
|
|
389
|
+
rating?: AnimeRating;
|
|
390
|
+
order_by?: AnimeSearchOrder;
|
|
456
391
|
}
|
|
457
392
|
|
|
458
393
|
interface CharactersSearchParams {
|
|
@@ -463,18 +398,9 @@ interface CharactersSearchParams {
|
|
|
463
398
|
sort?: SortOptions;
|
|
464
399
|
letter?: string;
|
|
465
400
|
}
|
|
466
|
-
|
|
467
|
-
mal_id = "mal_id",
|
|
468
|
-
name = "name",
|
|
469
|
-
favorites = "favorites"
|
|
470
|
-
}
|
|
401
|
+
type CharactersSearchOrder = 'mal_id' | 'name' | 'favorites';
|
|
471
402
|
|
|
472
|
-
|
|
473
|
-
genres = "genres",
|
|
474
|
-
explicit_genres = "explicit_genres",
|
|
475
|
-
theme = "themes",
|
|
476
|
-
demographics = "demographics"
|
|
477
|
-
}
|
|
403
|
+
type GenresFilter = 'genres' | 'explicit_genres' | 'themes' | 'demographics';
|
|
478
404
|
|
|
479
405
|
interface SchedulesParams {
|
|
480
406
|
page?: number;
|
|
@@ -484,15 +410,7 @@ interface SchedulesParams {
|
|
|
484
410
|
sfw?: boolean;
|
|
485
411
|
unapproved?: boolean;
|
|
486
412
|
}
|
|
487
|
-
|
|
488
|
-
monday = "monday",
|
|
489
|
-
tuesday = "tuesday",
|
|
490
|
-
wednesday = "wednesday",
|
|
491
|
-
thursday = "thursday",
|
|
492
|
-
friday = "friday",
|
|
493
|
-
unknown = "unknown",
|
|
494
|
-
other = "other"
|
|
495
|
-
}
|
|
413
|
+
type SchedulesFilter = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'unknown' | 'other';
|
|
496
414
|
|
|
497
415
|
interface JikanSeasonsParams {
|
|
498
416
|
page?: number;
|
|
@@ -501,22 +419,12 @@ interface JikanSeasonsParams {
|
|
|
501
419
|
}
|
|
502
420
|
/**
|
|
503
421
|
* QueryParams used in **getSeasonNow** call
|
|
504
|
-
*
|
|
505
422
|
*/
|
|
506
423
|
type SeasonNowParams = Omit<JikanSeasonsParams, 'filter'>;
|
|
507
424
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
bypopularity = "bypopularity",
|
|
512
|
-
favorite = "favorite"
|
|
513
|
-
}
|
|
514
|
-
declare enum TopMangaFilter {
|
|
515
|
-
publishing = "publishing",
|
|
516
|
-
upcoming = "upcoming",
|
|
517
|
-
bypopularity = "bypopularity",
|
|
518
|
-
favorite = "favorite"
|
|
519
|
-
}
|
|
425
|
+
type TopFilter = 'upcoming' | 'bypopularity' | 'favorite';
|
|
426
|
+
type TopAnimeFilter = 'airing' | TopFilter;
|
|
427
|
+
type TopMangaFilter = 'publishing' | TopFilter;
|
|
520
428
|
interface JikanTopParams {
|
|
521
429
|
page?: number;
|
|
522
430
|
limit?: number;
|
|
@@ -586,12 +494,12 @@ interface ClientArgs {
|
|
|
586
494
|
declare abstract class BaseClient {
|
|
587
495
|
private api;
|
|
588
496
|
constructor(clientOptions?: Partial<ClientArgs>);
|
|
589
|
-
protected getResource<T>(endpoint: string,
|
|
497
|
+
protected getResource<T>(endpoint: string, pathParams?: {
|
|
590
498
|
[key in string]: unknown;
|
|
591
499
|
}, params?: {
|
|
592
500
|
[key in string]: unknown;
|
|
593
|
-
}): Promise<T
|
|
594
|
-
private
|
|
501
|
+
}): Promise<JikanResponse<T>>;
|
|
502
|
+
private replacePathParams;
|
|
595
503
|
private addLoggingInterceptors;
|
|
596
504
|
}
|
|
597
505
|
|
|
@@ -644,9 +552,9 @@ declare class AnimeClient extends BaseClient {
|
|
|
644
552
|
/**
|
|
645
553
|
* Get a list of forum topics related to the anime
|
|
646
554
|
* @param id anime id
|
|
647
|
-
* @param filter
|
|
555
|
+
* @param filter filter topics
|
|
648
556
|
*/
|
|
649
|
-
getAnimeForum(id: number, filter?:
|
|
557
|
+
getAnimeForum(id: number, filter?: ForumFilter): Promise<JikanResponse<JikanForum[]>>;
|
|
650
558
|
/**
|
|
651
559
|
* Get videos related to the anime
|
|
652
560
|
* @param id anime id
|
|
@@ -683,10 +591,14 @@ declare class AnimeClient extends BaseClient {
|
|
|
683
591
|
* @param id anime id
|
|
684
592
|
*/
|
|
685
593
|
getAnimeRelations(id: number): Promise<JikanResponse<JikanRelation[]>>;
|
|
594
|
+
/**
|
|
595
|
+
* Get anime external links
|
|
596
|
+
* @param id anime id
|
|
597
|
+
*/
|
|
598
|
+
getAnimeExternal(id: number): Promise<JikanResponse<JikanExternalLink[]>>;
|
|
686
599
|
/**
|
|
687
600
|
* Get all the Animes within the given filter. Returns all the Animes if no filters are given.
|
|
688
601
|
* @param searchParams Filter parameters
|
|
689
|
-
* @returns JikanResponse with Anime array data
|
|
690
602
|
*/
|
|
691
603
|
getAnimeSearch(searchParams?: Partial<AnimeSearchParams>): Promise<JikanResponse<Anime[]>>;
|
|
692
604
|
}
|
|
@@ -702,43 +614,36 @@ declare class CharactersClient extends BaseClient {
|
|
|
702
614
|
/**
|
|
703
615
|
* Get complete Character data
|
|
704
616
|
* @param id The Character ID
|
|
705
|
-
* @returns JikanResponse with Character data
|
|
706
617
|
*/
|
|
707
|
-
getCharacterFullById(id: number): Promise<JikanResponse<
|
|
618
|
+
getCharacterFullById(id: number): Promise<JikanResponse<CharacterFull>>;
|
|
708
619
|
/**
|
|
709
620
|
* Get Character data
|
|
710
621
|
* @param id The Character ID
|
|
711
|
-
* @returns JikanResponse with Character data
|
|
712
622
|
*/
|
|
713
623
|
getCharacterById(id: number): Promise<JikanResponse<Character>>;
|
|
714
624
|
/**
|
|
715
625
|
* Get Character anime data
|
|
716
626
|
* @param id The Character ID
|
|
717
|
-
* @returns JikanResponse with CharacterAnime data
|
|
718
627
|
*/
|
|
719
628
|
getCharacterAnime(id: number): Promise<JikanResponse<CharacterAnime[]>>;
|
|
720
629
|
/**
|
|
721
630
|
* Get Character manga data
|
|
722
631
|
* @param id The Character ID
|
|
723
|
-
* @returns JikanResponse with CharacterManga data
|
|
724
632
|
*/
|
|
725
633
|
getCharacterManga(id: number): Promise<JikanResponse<CharacterManga[]>>;
|
|
726
634
|
/**
|
|
727
635
|
* Get Character voices data
|
|
728
636
|
* @param id The Character ID
|
|
729
|
-
* @returns JikanResponse with CharacterVoiceActor data
|
|
730
637
|
*/
|
|
731
638
|
getCharacterVoiceActors(id: number): Promise<JikanResponse<CharacterVoiceActor[]>>;
|
|
732
639
|
/**
|
|
733
640
|
* Get Character pictures data
|
|
734
641
|
* @param id The Character ID
|
|
735
|
-
* @returns JikanResponse with JikanImagesCollection data
|
|
736
642
|
*/
|
|
737
643
|
getCharacterPictures(id: number): Promise<JikanResponse<JikanImagesCollection[]>>;
|
|
738
644
|
/**
|
|
739
645
|
* Get all the Characters within the given filter. Returns all Characters if no filters are given.
|
|
740
|
-
@param searchParams Filter parameters
|
|
741
|
-
* @returns JikanResponse with Character array data
|
|
646
|
+
* @param searchParams Filter parameters
|
|
742
647
|
*/
|
|
743
648
|
getCharacterSearch(searchParams: Partial<CharactersSearchParams>): Promise<JikanResponse<Character[]>>;
|
|
744
649
|
}
|
|
@@ -774,47 +679,88 @@ declare class MangaClient extends BaseClient {
|
|
|
774
679
|
/**
|
|
775
680
|
* Get a Manga with full information by its ID
|
|
776
681
|
* @param id The Manga ID
|
|
777
|
-
* @returns JikanResponse with Manga data
|
|
778
682
|
*/
|
|
779
683
|
getMangaFullById(id: number): Promise<JikanResponse<Manga>>;
|
|
780
684
|
/**
|
|
781
685
|
* Get a Manga by its ID
|
|
782
686
|
* @param id The Manga ID
|
|
783
|
-
* @returns JikanResponse with Manga data
|
|
784
687
|
*/
|
|
785
688
|
getMangaById(id: number): Promise<JikanResponse<Manga>>;
|
|
786
689
|
/**
|
|
787
690
|
* Get Characters of a specific Manga
|
|
788
691
|
* @param id The Manga ID
|
|
789
|
-
* @returns JikanResponse with CommonCharacter array data
|
|
790
692
|
*/
|
|
791
693
|
getMangaCharacters(id: number): Promise<JikanResponse<CommonCharacter[]>>;
|
|
694
|
+
/**
|
|
695
|
+
* Get a list of manga news
|
|
696
|
+
* @param id The Manga ID
|
|
697
|
+
*/
|
|
698
|
+
getMangaNews(id: string): Promise<JikanResponse<JikanNews[]>>;
|
|
699
|
+
/**
|
|
700
|
+
* Get a list og manga forum topics
|
|
701
|
+
* @param id The manga ID
|
|
702
|
+
* @param filter Filter topics
|
|
703
|
+
*/
|
|
704
|
+
getMangaTopics(id: string, filter?: ForumFilter): Promise<JikanResponse<JikanForum[]>>;
|
|
792
705
|
/**
|
|
793
706
|
* Get Pictures related to a specific Manga
|
|
794
707
|
* @param id The Manga ID
|
|
795
|
-
* @returns JikanResponse with JikanImages array data
|
|
796
708
|
*/
|
|
797
709
|
getMangaPictures(id: number): Promise<JikanResponse<JikanImages[]>>;
|
|
798
710
|
/**
|
|
799
711
|
* Get Statistics related to a specific Manga
|
|
800
712
|
* @param id The Manga ID
|
|
801
|
-
* @returns JikanResponse with MangaStatistics data
|
|
802
713
|
*/
|
|
803
714
|
getMangaStatistics(id: number): Promise<JikanResponse<MangaStatistics>>;
|
|
715
|
+
/**
|
|
716
|
+
* Get more info related to the manga
|
|
717
|
+
* @param id manga id
|
|
718
|
+
*/
|
|
719
|
+
getMangaMoreInfo(id: number): Promise<JikanResponse<JikanMoreInfo>>;
|
|
804
720
|
/**
|
|
805
721
|
* Get Recommendations related to a specific Manga
|
|
806
722
|
* @param id The Manga ID
|
|
807
|
-
* @returns JikanResponse with Recommendation array data
|
|
808
723
|
*/
|
|
809
724
|
getMangaRecommendations(id: number): Promise<JikanResponse<Recommendation[]>>;
|
|
725
|
+
/**
|
|
726
|
+
* Get anime Relations
|
|
727
|
+
* @param id manga id
|
|
728
|
+
*/
|
|
729
|
+
getMangaRelations(id: number): Promise<JikanResponse<JikanRelation[]>>;
|
|
730
|
+
/**
|
|
731
|
+
* Get manga external links
|
|
732
|
+
* @param id manga id
|
|
733
|
+
*/
|
|
734
|
+
getMangaExternal(id: number): Promise<JikanResponse<JikanExternalLink[]>>;
|
|
810
735
|
/**
|
|
811
736
|
* Get all the filtered Mangas. Returns all the Mangas if no filters are given.
|
|
812
737
|
* @param searchParams Filter parameters
|
|
813
|
-
* @returns JikanResponse with Manga array data
|
|
814
738
|
*/
|
|
815
739
|
getMangaSearch(searchParams?: Partial<MangaSearchParams>): Promise<JikanResponse<Manga[]>>;
|
|
816
740
|
}
|
|
817
741
|
|
|
742
|
+
/**
|
|
743
|
+
* **Random Client**
|
|
744
|
+
*
|
|
745
|
+
* Client used to access the Random Endpoints:
|
|
746
|
+
*
|
|
747
|
+
* See also: [Jikan Documentation](https://docs.api.jikan.moe/)
|
|
748
|
+
*/
|
|
749
|
+
declare class RandomClient extends BaseClient {
|
|
750
|
+
/**
|
|
751
|
+
* Get random anime
|
|
752
|
+
*/
|
|
753
|
+
getRandomAnime(): Promise<JikanResponse<Anime>>;
|
|
754
|
+
/**
|
|
755
|
+
* Get random manga
|
|
756
|
+
*/
|
|
757
|
+
getRandomManga(): Promise<JikanResponse<Manga>>;
|
|
758
|
+
/**
|
|
759
|
+
* Get random character
|
|
760
|
+
*/
|
|
761
|
+
getRandomCharacters(): Promise<JikanResponse<Character>>;
|
|
762
|
+
}
|
|
763
|
+
|
|
818
764
|
/**
|
|
819
765
|
* **Schedules Client**
|
|
820
766
|
*
|
|
@@ -826,7 +772,6 @@ declare class SchedulesClient extends BaseClient {
|
|
|
826
772
|
/**
|
|
827
773
|
* Returns weekly schedule
|
|
828
774
|
* @param searchParams Filter parameters
|
|
829
|
-
* @returns JikanResponse with Anime array data
|
|
830
775
|
*/
|
|
831
776
|
getSchedules(searchParams?: Partial<SchedulesParams>): Promise<JikanResponse<Anime[]>>;
|
|
832
777
|
}
|
|
@@ -844,24 +789,20 @@ declare class SeasonsClient extends BaseClient {
|
|
|
844
789
|
* @param year Season year
|
|
845
790
|
* @param season Season value
|
|
846
791
|
* @param searchParams Filter parameters
|
|
847
|
-
* @returns JikanResponse with Anime array data
|
|
848
792
|
*/
|
|
849
793
|
getSeason(year: number, season: AnimeSeason, searchParams?: Partial<JikanSeasonsParams>): Promise<JikanResponse<Anime[]>>;
|
|
850
794
|
/**
|
|
851
795
|
* Get current seasonal anime
|
|
852
796
|
* @param searchParams Filter parameters
|
|
853
|
-
* @returns JikanResponse with Anime array data
|
|
854
797
|
*/
|
|
855
798
|
getSeasonNow(searchParams?: Partial<SeasonNowParams>): Promise<JikanResponse<Anime[]>>;
|
|
856
799
|
/**
|
|
857
800
|
* Get available list of seasons
|
|
858
|
-
* @returns JikanResponse with Seasons array data
|
|
859
801
|
*/
|
|
860
802
|
getSeasonsList(): Promise<JikanResponse<SeasonsListData[]>>;
|
|
861
803
|
/**
|
|
862
804
|
* Get upcoming season's anime
|
|
863
805
|
* @param searchParams Filter parameters
|
|
864
|
-
* @returns JikanResponse with Anime array data
|
|
865
806
|
*/
|
|
866
807
|
getSeasonUpcoming(searchParams?: Partial<JikanSeasonsParams>): Promise<JikanResponse<Anime[]>>;
|
|
867
808
|
}
|
|
@@ -877,15 +818,18 @@ declare class TopClient extends BaseClient {
|
|
|
877
818
|
/**
|
|
878
819
|
* Get the top Animes
|
|
879
820
|
* @param searchParams Filter parameters
|
|
880
|
-
* @returns JikanResponse with Anime array data
|
|
881
821
|
*/
|
|
882
822
|
getTopAnime(searchParams?: Partial<AnimeTopParams>): Promise<JikanResponse<Anime[]>>;
|
|
883
823
|
/**
|
|
884
824
|
* Get the top Mangas
|
|
885
825
|
* @param searchParams Filter parameters
|
|
886
|
-
* @returns JikanResponse with Manga array data
|
|
887
826
|
*/
|
|
888
827
|
getTopManga(searchParams?: Partial<MangaTopParams>): Promise<JikanResponse<Manga[]>>;
|
|
828
|
+
/**
|
|
829
|
+
* Get the top Characters
|
|
830
|
+
* @param searchParams Filter parameters
|
|
831
|
+
*/
|
|
832
|
+
getTopCharacters(searchParams?: Partial<JikanTopParams>): Promise<JikanResponse<Character[]>>;
|
|
889
833
|
}
|
|
890
834
|
|
|
891
835
|
/**
|
|
@@ -903,6 +847,7 @@ declare class JikanClient {
|
|
|
903
847
|
top: TopClient;
|
|
904
848
|
schedules: SchedulesClient;
|
|
905
849
|
seasons: SeasonsClient;
|
|
850
|
+
random: RandomClient;
|
|
906
851
|
constructor(clientOptions?: Partial<ClientArgs>);
|
|
907
852
|
}
|
|
908
853
|
|
|
@@ -911,69 +856,79 @@ declare const handleRequestError: (error: AxiosError) => Promise<AxiosError>;
|
|
|
911
856
|
declare const handleResponse: (response: CacheAxiosResponse) => CacheAxiosResponse;
|
|
912
857
|
declare const handleResponseError: (error: AxiosError) => Promise<AxiosError>;
|
|
913
858
|
|
|
914
|
-
declare
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
859
|
+
declare const BaseURL = "https://api.jikan.moe/v4";
|
|
860
|
+
|
|
861
|
+
declare const AnimeEndpoints: {
|
|
862
|
+
readonly animeFullById: "/anime/{id}/full";
|
|
863
|
+
readonly animeById: "/anime/{id}";
|
|
864
|
+
readonly animeCharacters: "/anime/{id}/characters";
|
|
865
|
+
readonly animeStaff: "/anime/{id}/staff";
|
|
866
|
+
readonly animeEpisodes: "/anime/{id}/episodes";
|
|
867
|
+
readonly animeEpisodeById: "/anime/{id}/episodes/{episode}";
|
|
868
|
+
readonly animeNews: "/anime/{id}/news";
|
|
869
|
+
readonly animeForum: "/anime/{id}/forum";
|
|
870
|
+
readonly animeVideos: "/anime/{id}/videos";
|
|
871
|
+
readonly animeVideosEpisodes: "/anime/{id}/videos/episodes";
|
|
872
|
+
readonly animePictures: "/anime/{id}/pictures";
|
|
873
|
+
readonly animeStatistics: "/anime/{id}/statistics";
|
|
874
|
+
readonly animeMoreInfo: "/anime/{id}/moreinfo";
|
|
875
|
+
readonly animeRecommendations: "/anime/{id}/recommendations";
|
|
876
|
+
readonly animeUserUpdates: "/anime/{id}/userupdates";
|
|
877
|
+
readonly animeReviews: "/anime/{id}/reviews";
|
|
878
|
+
readonly animeRelations: "/anime/{id}/relations";
|
|
879
|
+
readonly animeThemes: "/anime/{id}/themes";
|
|
880
|
+
readonly animeExternal: "/anime/{id}/external";
|
|
881
|
+
readonly animeStreaming: "/anime/{id}/streaming";
|
|
882
|
+
readonly animeSearch: "/anime/{id}/search";
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
declare const CharactersEndpoints: {
|
|
886
|
+
readonly characterFullById: "/characters/{id}/full";
|
|
887
|
+
readonly characterById: "/characters/{id}";
|
|
888
|
+
readonly characterAnime: "/characters/{id}/anime";
|
|
889
|
+
readonly charactersManga: "/characters/{id}/manga";
|
|
890
|
+
readonly characterVoiceActors: "/characters/{id}/voices";
|
|
891
|
+
readonly characterPictures: "/characters/{id}/pictures";
|
|
892
|
+
readonly characterSearch: "/characters";
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
declare const GenresEndpoints: {
|
|
896
|
+
readonly animeGenres: "/genres/anime";
|
|
897
|
+
readonly mangaGenres: "/genres/manga";
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
declare const MangaEndpoints: {
|
|
901
|
+
readonly mangaSearch: "/manga";
|
|
902
|
+
readonly mangaFullById: "/manga/{id}/full";
|
|
903
|
+
readonly mangaById: "/manga/{id}";
|
|
904
|
+
readonly mangaCharacters: "/manga/{id}/characters";
|
|
905
|
+
readonly mangaNews: "manga/{id}/news";
|
|
906
|
+
readonly mangaTopics: "/manga/{id}/forum";
|
|
907
|
+
readonly mangaPictures: "/manga/{id}/pictures";
|
|
908
|
+
readonly mangaStatistics: "/manga/{id}/statistics";
|
|
909
|
+
readonly mangaMoreInfo: "/manga/{id}/moreinfo";
|
|
910
|
+
readonly mangaRelations: "manga/{id}/relations";
|
|
911
|
+
readonly mangaExternal: "/manga/{id}/external";
|
|
912
|
+
readonly mangaRecommendations: "/manga/{id}/recommendations";
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
declare const SeasonsEndpoints: {
|
|
916
|
+
readonly season: "/seasons/{year}/{season}";
|
|
917
|
+
readonly seasonNow: "/seasons/now";
|
|
918
|
+
readonly seasonsList: "/seasons";
|
|
919
|
+
readonly seasonUpcoming: "/seasons/upcoming";
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
declare const TopEndpoints: {
|
|
923
|
+
readonly topAnime: "/top/anime";
|
|
924
|
+
readonly topManga: "/top/manga";
|
|
925
|
+
readonly topCharacters: "/top/characters";
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
declare const RandomEndpoints: {
|
|
929
|
+
readonly randomAnime: "/random/anime";
|
|
930
|
+
readonly randomManga: "/random/manga";
|
|
931
|
+
readonly randomCharacters: "/random/characters";
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
export { type Anime, type AnimeBroadcast, type AnimeCharacter, AnimeClient, AnimeEndpoints, type AnimeEpisode, type AnimeEpisodeVideo, type AnimeMusicVideo, type AnimePicture, type AnimePromoVideo, type AnimeRating, type AnimeSearchOrder, type AnimeSearchParams, type AnimeSearchStatus, type AnimeSeason, type AnimeStaff, type AnimeStatistics, type AnimeStatus, type AnimeTheme, type AnimeTopParams, type AnimeType, type AnimeVideoMeta, type AnimeVideos, type AnimeYoutubeVideo, BaseClient, BaseURL, type Character, type CharacterAnime, type CharacterFull, type CharacterManga, type CharacterRole, type CharacterVoiceActor, CharactersClient, CharactersEndpoints, type CharactersSearchOrder, type CharactersSearchParams, type ClientArgs, type CommonCharacter, type CommonCharacterData, type ForumFilter, type Genre, GenresClient, GenresEndpoints, type GenresFilter, JikanClient, type JikanExternalLink, type JikanForum, type JikanImages, type JikanImagesCollection, type JikanMoreInfo, type JikanNamedResource, type JikanNews, type JikanPagination, type JikanPaginationItems, type JikanPerson, type JikanRelation, type JikanResource, type JikanResourcePeriod, type JikanResourceRelation, type JikanResourceTitle, type JikanResponse, type JikanSearchParams, type JikanSeasonsParams, type JikanTopParams, type Manga, MangaClient, MangaEndpoints, type MangaSearchOrder, type MangaSearchParams, type MangaSearchStatus, type MangaStatistics, type MangaStatus, type MangaTopParams, type MangaType, RandomClient, RandomEndpoints, type Recommendation, type RecommendationEntry, type RelationEntry, SchedulesClient, type SchedulesFilter, type SchedulesParams, type SearchOrder, type SeasonNowParams, SeasonsClient, SeasonsEndpoints, type SeasonsListData, type SortOptions, type Statistics, type StatisticsScore, type TopAnimeFilter, TopClient, TopEndpoints, type TopMangaFilter, handleRequest, handleRequestError, handleResponse, handleResponseError };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Node.js wrapper for the Jikan API with built-in typings.
|
|
4
|
-
* Version: 1.2.2 | Build Date: 5/6/2024
|
|
5
|
-
* Build Environment: Node v20.12.2
|
|
6
|
-
* License: MIT
|
|
7
|
-
*
|
|
8
|
-
* Clara Castillo <https://github.com/tutkli>
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
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=(i=>(i.CharacterFullById="/characters/{id}/full",i.CharacterById="/characters/{id}",i.CharacterAnime="/characters/{id}/anime",i.CharactersManga="/characters/{id}/manga",i.CharacterVoiceActors="/characters/{id}/voices",i.CharacterPictures="/characters/{id}/pictures",i.CharacterSearch="/characters",i))(b||{});var J=(n=>(n.AnimeGenres="/genres/anime",n.MangaGenres="genres/manga",n))(J||{});var A=(i=>(i.MangaSearch="/manga",i.MangaFullById="/manga/{id}/full",i.MangaById="/manga/{id}",i.MangaCharacters="/manga/{id}/characters",i.MangaPictures="/manga/{id}/pictures",i.MangaStatistics="/manga/{id}/statistics",i.MangaRecommendations="/manga/{id}/recommendations",i))(A||{});var y=(r=>(r.Season="/seasons/{year}/{season}",r.SeasonNow="/seasons/now",r.SeasonsList="/seasons",r.SeasonUpcoming="/seasons/upcoming",r))(y||{});var P=(n=>(n.TopAnime="/top/anime",n.TopManga="/top/manga",n))(P||{});import _ from"axios";import{setupCache as S}from"axios-cache-interceptor";var C=s=>(console.info(`[Request] ${s.method?.toUpperCase()??""} | ${s.url??""}`),s),I=s=>{throw console.error(`[Request Error] CODE ${s.code??"UNKNOWN"} | ${s.message}`),s},M=s=>(console.info(`[Request Response] ${s.config.method?.toUpperCase()??""} | ${s.config.url??""}`,s.data),s),w=s=>{throw console.error(`[ Response Error ] CODE ${s.code??"UNKNOWN"} | ${s.message}`),s};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,n={},o={}){return(await this.api.get(this.replaceIdentifiers(e,n),{params:o})).data}replaceIdentifiers(e,n){let o=e;for(let r of Object.keys(n)){if(!RegExp(`{${r}}`).exec(o))throw new Error(`Path does not contain "${r}" parameter.`);o=o.replace(`{${r}}`,String(n[r]))}return o}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,n=1){return this.getResource("/anime/{id}/episodes",{id:e},{page:n})}async getAnimeEpisodeById(e,n){return this.getResource("/anime/{id}/episodes/{episode}",{id:e,episode:n})}async getAnimeNews(e,n){return this.getResource("/anime/{id}/news",{id:e},{page:n})}async getAnimeForum(e,n){return this.getResource("/anime/{id}/news",{id:e},n?{filter:n}:void 0)}async getAnimeVideos(e){return this.getResource("/anime/{id}/videos",{id:e})}async getAnimeEpisodeVideos(e,n=1){return this.getResource("/anime/{id}/videos/episodes",{id:e},{page:n})}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,n,o){return this.getResource("/seasons/{year}/{season}",{year:e,season:n},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=(r=>(r.finished="Finished Airing",r.airing="Currently Airing",r.complete="Complete",r.upcoming="Not yet aired",r))(N||{}),V=(m=>(m.g="g",m.pg="pg",m.pg13="pg13",m.r17="r17",m.r="r",m.rx="rx",m))(V||{}),T=(r=>(r.spring="spring",r.summer="summer",r.fall="fall",r.winter="winter",r))(T||{});var L=(n=>(n.main="Main",n.supporting="Supporting",n))(L||{});var q=(i=>(i.manga="Manga",i.novel="Novel",i.lightnovel="Lightnovel",i.oneshot="Oneshot",i.doujin="Doujin",i.manhwa="Manhwa",i.manhua="Manhua",i))(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=(r=>(r.genres="genres",r.explicit_genres="explicit_genres",r.theme="themes",r.demographics="demographics",r))(G||{});var D=(i=>(i.monday="monday",i.tuesday="tuesday",i.wednesday="wednesday",i.thursday="thursday",i.friday="friday",i.unknown="unknown",i.other="other",i))(D||{});var j=(n=>(n.asc="asc",n.desc="desc",n))(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=(n=>(n.chapters="chapters",n.volumes="volumes",n))(W||{}),Y=(c=>(c.publishing="publishing",c.complete="complete",c.hiatus="hiatus",c.discontinued="discontinued",c.upcoming="upcoming",c))(Y||{});var E=(r=>(r.airing="airing",r.upcoming="upcoming",r.bypopularity="bypopularity",r.favorite="favorite",r))(E||{}),H=(r=>(r.publishing="publishing",r.upcoming="upcoming",r.bypopularity="bypopularity",r.favorite="favorite",r))(H||{});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,E as TopAnimeFilter,f as TopClient,P as TopEndpoints,H as TopMangaFilter,C as handleRequest,I as handleRequestError,M as handleResponse,w as handleResponseError};
|
|
1
|
+
var C="https://api.jikan.moe/v4";var t={animeFullById:"/anime/{id}/full",animeById:"/anime/{id}",animeCharacters:"/anime/{id}/characters",animeStaff:"/anime/{id}/staff",animeEpisodes:"/anime/{id}/episodes",animeEpisodeById:"/anime/{id}/episodes/{episode}",animeNews:"/anime/{id}/news",animeForum:"/anime/{id}/forum",animeVideos:"/anime/{id}/videos",animeVideosEpisodes:"/anime/{id}/videos/episodes",animePictures:"/anime/{id}/pictures",animeStatistics:"/anime/{id}/statistics",animeMoreInfo:"/anime/{id}/moreinfo",animeRecommendations:"/anime/{id}/recommendations",animeUserUpdates:"/anime/{id}/userupdates",animeReviews:"/anime/{id}/reviews",animeRelations:"/anime/{id}/relations",animeThemes:"/anime/{id}/themes",animeExternal:"/anime/{id}/external",animeStreaming:"/anime/{id}/streaming",animeSearch:"/anime/{id}/search"};var s={characterFullById:"/characters/{id}/full",characterById:"/characters/{id}",characterAnime:"/characters/{id}/anime",charactersManga:"/characters/{id}/manga",characterVoiceActors:"/characters/{id}/voices",characterPictures:"/characters/{id}/pictures",characterSearch:"/characters"};var A={animeGenres:"/genres/anime",mangaGenres:"/genres/manga"};var o={mangaSearch:"/manga",mangaFullById:"/manga/{id}/full",mangaById:"/manga/{id}",mangaCharacters:"/manga/{id}/characters",mangaNews:"manga/{id}/news",mangaTopics:"/manga/{id}/forum",mangaPictures:"/manga/{id}/pictures",mangaStatistics:"/manga/{id}/statistics",mangaMoreInfo:"/manga/{id}/moreinfo",mangaRelations:"manga/{id}/relations",mangaExternal:"/manga/{id}/external",mangaRecommendations:"/manga/{id}/recommendations"};var m={season:"/seasons/{year}/{season}",seasonNow:"/seasons/now",seasonsList:"/seasons",seasonUpcoming:"/seasons/upcoming"};var p={topAnime:"/top/anime",topManga:"/top/manga",topCharacters:"/top/characters"};var u={randomAnime:"/random/anime",randomManga:"/random/manga",randomCharacters:"/random/characters"};import I from"axios";import{setupCache as w}from"axios-cache-interceptor";var E=r=>(console.info(`[Request] ${r.method?.toUpperCase()??""} | ${r.url??""}`),r),S=r=>{throw console.error(`[Request Error] CODE ${r.code??"UNKNOWN"} | ${r.message}`),r},M=r=>(console.info(`[Request Response] ${r.config.method?.toUpperCase()??""} | ${r.config.url??""}`,r.data),r),P=r=>{throw console.error(`[ Response Error ] CODE ${r.code??"UNKNOWN"} | ${r.message}`),r};var n=class{api;constructor(e={}){this.api=w(I.create({baseURL:e.baseURL??C,headers:{"Content-Type":"application/json"}}),{...e.cacheOptions,cacheTakeover:!1}),e.enableLogging&&this.addLoggingInterceptors()}async getResource(e,a={},i={}){return(await this.api.get(this.replacePathParams(e,a),{params:i})).data}replacePathParams(e,a){let i=e;for(let c of Object.keys(a)){if(!RegExp(`{${c}}`).exec(i))throw new Error(`Path does not contain "${c}" parameter.`);i=i.replace(`{${c}}`,String(a[c]))}return i}addLoggingInterceptors(){this.api.interceptors.request.use(e=>E(e),e=>S(e)),this.api.interceptors.response.use(e=>M(e),e=>P(e))}};var g=class extends n{getAnimeFullById(e){return this.getResource(t.animeFullById,{id:e})}getAnimeById(e){return this.getResource(t.animeById,{id:e})}getAnimeCharacters(e){return this.getResource(t.animeCharacters,{id:e})}getAnimeStaff(e){return this.getResource(t.animeStaff,{id:e})}getAnimeEpisodes(e,a=1){return this.getResource(t.animeEpisodes,{id:e},{page:a})}getAnimeEpisodeById(e,a){return this.getResource(t.animeEpisodeById,{id:e,episode:a})}getAnimeNews(e,a){return this.getResource(t.animeNews,{id:e},{page:a})}getAnimeForum(e,a){return this.getResource(t.animeForum,{id:e},a?{filter:a}:void 0)}getAnimeVideos(e){return this.getResource(t.animeVideos,{id:e})}getAnimeEpisodeVideos(e,a=1){return this.getResource(t.animeVideosEpisodes,{id:e},{page:a})}getAnimePictures(e){return this.getResource(t.animePictures,{id:e})}getAnimeStatistics(e){return this.getResource(t.animeStatistics,{id:e})}getAnimeMoreInfo(e){return this.getResource(t.animeMoreInfo,{id:e})}getAnimeRecommendations(e){return this.getResource(t.animeRecommendations,{id:e})}getAnimeRelations(e){return this.getResource(t.animeRelations,{id:e})}getAnimeExternal(e){return this.getResource(t.animeExternal,{id:e})}getAnimeSearch(e){return this.getResource(t.animeSearch,{},e)}};var h=class extends n{getCharacterFullById(e){return this.getResource(s.characterFullById,{id:e})}getCharacterById(e){return this.getResource(s.characterById,{id:e})}getCharacterAnime(e){return this.getResource(s.characterAnime,{id:e})}getCharacterManga(e){return this.getResource(s.charactersManga,{id:e})}getCharacterVoiceActors(e){return this.getResource(s.characterVoiceActors,{id:e})}getCharacterPictures(e){return this.getResource(s.characterPictures,{id:e})}getCharacterSearch(e){return this.getResource(s.characterSearch,{},e)}};var l=class extends n{getAnimeGenres(e){return this.getResource(A.animeGenres,{},{filter:e})}getMangaGenres(e){return this.getResource(A.mangaGenres,{},{filter:e})}};var d=class extends n{getMangaFullById(e){return this.getResource(o.mangaFullById,{id:e})}getMangaById(e){return this.getResource(o.mangaById,{id:e})}getMangaCharacters(e){return this.getResource(o.mangaCharacters,{id:e})}getMangaNews(e){return this.getResource(o.mangaNews,{id:e})}getMangaTopics(e,a){return this.getResource(o.mangaTopics,{id:e},a?{filter:a}:void 0)}getMangaPictures(e){return this.getResource(o.mangaPictures,{id:e})}getMangaStatistics(e){return this.getResource(o.mangaStatistics,{id:e})}getMangaMoreInfo(e){return this.getResource(o.mangaMoreInfo,{id:e})}getMangaRecommendations(e){return this.getResource(o.mangaRecommendations,{id:e})}getMangaRelations(e){return this.getResource(o.mangaRelations,{id:e})}getMangaExternal(e){return this.getResource(o.mangaExternal,{id:e})}getMangaSearch(e){return this.getResource(o.mangaSearch,{},e)}};var f=class extends n{getRandomAnime(){return this.getResource(u.randomAnime)}getRandomManga(){return this.getResource(u.randomManga)}getRandomCharacters(){return this.getResource(u.randomCharacters)}};var y={schedules:"/schedules"};var x=class extends n{getSchedules(e){return this.getResource(y.schedules,{},e)}};var R=class extends n{getSeason(e,a,i){return this.getResource(m.season,{year:e,season:a},i)}getSeasonNow(e){return this.getResource(m.seasonNow,{},e)}getSeasonsList(){return this.getResource(m.seasonsList)}getSeasonUpcoming(e){return this.getResource(m.seasonUpcoming,{},e)}};var b=class extends n{getTopAnime(e){return this.getResource(p.topAnime,{},e)}getTopManga(e){return this.getResource(p.topManga,{},e)}getTopCharacters(e){return this.getResource(p.topCharacters,{},e)}};var k=class{anime;characters;genres;manga;top;schedules;seasons;random;constructor(e){this.anime=new g(e),this.characters=new h(e),this.genres=new l(e),this.manga=new d(e),this.top=new b(e),this.schedules=new x(e),this.seasons=new R(e),this.random=new f(e)}};export{g as AnimeClient,t as AnimeEndpoints,n as BaseClient,C as BaseURL,h as CharactersClient,s as CharactersEndpoints,l as GenresClient,A as GenresEndpoints,k as JikanClient,d as MangaClient,o as MangaEndpoints,f as RandomClient,u as RandomEndpoints,x as SchedulesClient,R as SeasonsClient,m as SeasonsEndpoints,b as TopClient,p as TopEndpoints,E as handleRequest,S as handleRequestError,M as handleResponse,P as handleResponseError};
|
package/package.json
CHANGED
|
@@ -1,60 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"lint-staged": "^15.2.2",
|
|
56
|
-
"tsup": "^8.0.1",
|
|
57
|
-
"typescript": "5.3.3",
|
|
58
|
-
"vitest": "^1.2.2"
|
|
59
|
-
}
|
|
2
|
+
"name": "@tutkli/jikan-ts",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Node.js wrapper for the Jikan API with built-in typings.",
|
|
5
|
+
"source": "src/index.ts",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"prepare": "git config core.hookspath .githooks",
|
|
11
|
+
"build": "tsup --config tsup.config.ts",
|
|
12
|
+
"prepublishOnly": "yarn run build",
|
|
13
|
+
"test:ci": "vitest --silent --run",
|
|
14
|
+
"test:coverage": "vitest run --coverage",
|
|
15
|
+
"test:dev": "vitest",
|
|
16
|
+
"test:ui": "vitest --ui --coverage",
|
|
17
|
+
"version": "auto-changelog -p -l false && git add CHANGELOG.md",
|
|
18
|
+
"format": "biome format ./src",
|
|
19
|
+
"format:fix": "biome format --write ./src",
|
|
20
|
+
"lint": "biome check src",
|
|
21
|
+
"lint:ci": "biome ci src",
|
|
22
|
+
"lint:fix": "biome check --apply-unsafe ./src"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/tutkli/jikan-ts.git"
|
|
27
|
+
},
|
|
28
|
+
"keywords": ["jikan", "jikan-api", "jikanAPI", "MyAnimeList"],
|
|
29
|
+
"author": {
|
|
30
|
+
"name": "Clara Castillo",
|
|
31
|
+
"url": "https://github.com/tutkli"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/tutkli/jikan-ts/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/tutkli/jikan-ts#readme",
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"axios": "^1.6.8",
|
|
40
|
+
"axios-cache-interceptor": "^1.5.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@biomejs/biome": "1.7.3",
|
|
44
|
+
"@types/node": "20.12.10",
|
|
45
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
46
|
+
"@vitest/ui": "^1.6.0",
|
|
47
|
+
"auto-changelog": "^2.4.0",
|
|
48
|
+
"axios": "^1.6.8",
|
|
49
|
+
"axios-cache-interceptor": "^1.5.2",
|
|
50
|
+
"lint-staged": "^15.2.2",
|
|
51
|
+
"tsup": "^8.0.2",
|
|
52
|
+
"typescript": "5.4.5",
|
|
53
|
+
"vitest": "^1.6.0"
|
|
54
|
+
}
|
|
60
55
|
}
|