@tutkli/jikan-ts 0.6.2 → 0.6.4
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/dist/index.d.ts +69 -5
- package/dist/index.js +1 -1
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -174,7 +174,7 @@ export interface AnimeVideoMeta {
|
|
|
174
174
|
author: string;
|
|
175
175
|
}
|
|
176
176
|
export interface Anime {
|
|
177
|
-
mal_id:
|
|
177
|
+
mal_id: number;
|
|
178
178
|
url: string;
|
|
179
179
|
images: JikanImages;
|
|
180
180
|
trailer: AnimeYoutubeVideo;
|
|
@@ -209,7 +209,7 @@ export interface Anime {
|
|
|
209
209
|
genres: JikanResource[];
|
|
210
210
|
explicit_genres: JikanResource[];
|
|
211
211
|
themes: JikanResource[];
|
|
212
|
-
|
|
212
|
+
demographics: JikanResource[];
|
|
213
213
|
relations?: JikanResourceRelation[];
|
|
214
214
|
theme?: AnimeTheme;
|
|
215
215
|
external?: JikanNamedResource[];
|
|
@@ -236,7 +236,8 @@ export declare enum AnimeType {
|
|
|
236
236
|
export declare enum AnimeStatus {
|
|
237
237
|
finished = "Finished Airing",
|
|
238
238
|
airing = "Currently Airing",
|
|
239
|
-
complete = "Complete"
|
|
239
|
+
complete = "Complete",
|
|
240
|
+
upcoming = "Not yet aired"
|
|
240
241
|
}
|
|
241
242
|
export declare enum AnimeRating {
|
|
242
243
|
g = "g",
|
|
@@ -307,6 +308,7 @@ export interface Manga {
|
|
|
307
308
|
background: string;
|
|
308
309
|
authors: JikanResource[];
|
|
309
310
|
serializations: JikanResource[];
|
|
311
|
+
genres: JikanResource[];
|
|
310
312
|
explicit_genres: JikanResource[];
|
|
311
313
|
themes: JikanResource[];
|
|
312
314
|
demographics: JikanResource[];
|
|
@@ -501,9 +503,10 @@ export declare class AnimeClient extends BaseClient {
|
|
|
501
503
|
/**
|
|
502
504
|
* Get a list of all the episodes of a specific Anime
|
|
503
505
|
* @param mal_id The Anime ID
|
|
506
|
+
* @param page The page number
|
|
504
507
|
* @returns JikanResponse with AnimeEpisode array data
|
|
505
508
|
*/
|
|
506
|
-
getAnimeEpisodes(mal_id: number): Promise<JikanResponse<AnimeEpisode[]>>;
|
|
509
|
+
getAnimeEpisodes(mal_id: number, page?: number): Promise<JikanResponse<AnimeEpisode[]>>;
|
|
507
510
|
/**
|
|
508
511
|
* Get a single Episode of a specific Anime by its ID
|
|
509
512
|
* @param anime_mal_id The Anime ID
|
|
@@ -520,9 +523,10 @@ export declare class AnimeClient extends BaseClient {
|
|
|
520
523
|
/**
|
|
521
524
|
* Get Episode Videos related to a specific Anime
|
|
522
525
|
* @param mal_id The Anime ID
|
|
526
|
+
* @param page The page number
|
|
523
527
|
* @returns JikanResponse with AnimeVideoEpisode array data
|
|
524
528
|
*/
|
|
525
|
-
getAnimeEpisodeVideos(mal_id: number): Promise<JikanResponse<AnimeEpisodeVideo[]>>;
|
|
529
|
+
getAnimeEpisodeVideos(mal_id: number, page?: number): Promise<JikanResponse<AnimeEpisodeVideo[]>>;
|
|
526
530
|
/**
|
|
527
531
|
* Get Pictures related to a specific Anime
|
|
528
532
|
* @param mal_id The Anime ID
|
|
@@ -631,6 +635,58 @@ export declare class TopClient extends BaseClient {
|
|
|
631
635
|
*/
|
|
632
636
|
getTopManga(searchParams?: Partial<MangaTopParams>): Promise<JikanResponse<Manga[]>>;
|
|
633
637
|
}
|
|
638
|
+
export interface JikanSeasonsParams {
|
|
639
|
+
page?: number;
|
|
640
|
+
limit?: number;
|
|
641
|
+
filter?: AnimeType;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* QueryParams used in **getSeasonNow** call
|
|
645
|
+
*
|
|
646
|
+
*/
|
|
647
|
+
export type SeasonNowParams = Omit<JikanSeasonsParams, "filter">;
|
|
648
|
+
export interface SeasonsListData {
|
|
649
|
+
year: number;
|
|
650
|
+
seasons: Array<keyof typeof AnimeSeason>;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* **Seasons Client**
|
|
654
|
+
*
|
|
655
|
+
* Client used to access the Seasons Endpoints
|
|
656
|
+
*
|
|
657
|
+
* See also: [JikanAPI Documentation](https://docs.api.jikan.moe/)
|
|
658
|
+
*/
|
|
659
|
+
export declare class SeasonsClient extends BaseClient {
|
|
660
|
+
/**
|
|
661
|
+
* @argument clientOptions Options for the client.
|
|
662
|
+
*/
|
|
663
|
+
constructor(clientOptions?: Partial<ClientArgs>);
|
|
664
|
+
/**
|
|
665
|
+
* Get the seasonal anime by year and season
|
|
666
|
+
* @param year Season year
|
|
667
|
+
* @param season Season value
|
|
668
|
+
* @param searchParams Filter parameters
|
|
669
|
+
* @returns JikanResponse with Anime array data
|
|
670
|
+
*/
|
|
671
|
+
getSeason(year: number, season: AnimeSeason, searchParams?: Partial<JikanSeasonsParams>): Promise<JikanResponse<Anime[]>>;
|
|
672
|
+
/**
|
|
673
|
+
* Get current seasonal anime
|
|
674
|
+
* @param searchParams Filter parameters
|
|
675
|
+
* @returns JikanResponse with Anime array data
|
|
676
|
+
*/
|
|
677
|
+
getSeasonNow(searchParams?: Partial<SeasonNowParams>): Promise<JikanResponse<Anime[]>>;
|
|
678
|
+
/**
|
|
679
|
+
* Get available list of seasons
|
|
680
|
+
* @returns JikanResponse with Seasons array data
|
|
681
|
+
*/
|
|
682
|
+
getSeasonsList(): Promise<JikanResponse<SeasonsListData[]>>;
|
|
683
|
+
/**
|
|
684
|
+
* Get upcoming season's anime
|
|
685
|
+
* @param searchParams Filter parameters
|
|
686
|
+
* @returns JikanResponse with Anime array data
|
|
687
|
+
*/
|
|
688
|
+
getSeasonUpcoming(searchParams?: Partial<JikanSeasonsParams>): Promise<JikanResponse<Anime[]>>;
|
|
689
|
+
}
|
|
634
690
|
/**
|
|
635
691
|
* **Jikan Client**
|
|
636
692
|
*
|
|
@@ -638,6 +694,7 @@ export declare class TopClient extends BaseClient {
|
|
|
638
694
|
* - [Anime](https://docs.api.jikan.moe/#tag/anime)
|
|
639
695
|
* - [Manga](https://docs.api.jikan.moe/#tag/manga)
|
|
640
696
|
* - [Top](https://docs.api.jikan.moe/#tag/top)
|
|
697
|
+
* - [Seasons](https://docs.api.jikan.moe/#tag/seasons)
|
|
641
698
|
*
|
|
642
699
|
* See also: [JikanAPI Documentation](https://docs.api.jikan.moe/)
|
|
643
700
|
*/
|
|
@@ -645,6 +702,7 @@ export declare class JikanClient {
|
|
|
645
702
|
anime: AnimeClient;
|
|
646
703
|
manga: MangaClient;
|
|
647
704
|
top: TopClient;
|
|
705
|
+
seasons: SeasonsClient;
|
|
648
706
|
constructor(clientOptions?: Partial<ClientArgs>);
|
|
649
707
|
}
|
|
650
708
|
export declare enum BaseURL {
|
|
@@ -677,5 +735,11 @@ export declare enum TopEndpoints {
|
|
|
677
735
|
TopAnime = "/top/anime",
|
|
678
736
|
TopManga = "/top/manga"
|
|
679
737
|
}
|
|
738
|
+
export declare enum SeasonsEndpoints {
|
|
739
|
+
Season = "/seasons/{year}/{season}",
|
|
740
|
+
SeasonNow = "/seasons/now",
|
|
741
|
+
SeasonsList = "/seasons",
|
|
742
|
+
SeasonUpcoming = "/seasons/upcoming"
|
|
743
|
+
}
|
|
680
744
|
|
|
681
745
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setupCache as
|
|
1
|
+
import{setupCache as $}from"axios-cache-interceptor";import v from"axios";var f=(n=>(n.REST="https://api.jikan.moe/v4",n))(f||{});var C=(m=>(m.AnimeSearch="/anime",m.AnimeFullById="/anime/{id}/full",m.AnimeById="/anime/{id}",m.AnimeCharacters="/anime/{id}/characters",m.AnimeStaff="/anime/{id}/staff",m.AnimeEpisodes="/anime/{id}/episodes",m.AnimeEpisodeById="/anime/{id}/episodes/{episode}",m.AnimeVideos="/anime/{id}/videos",m.AnimeVideosEpisodes="/anime/{id}/videos/episodes",m.AnimePictures="/anime/{id}/pictures",m.AnimeStatistics="/anime/{id}/statistics",m.AnimeRecommendations="/anime/{id}/recommendations",m))(C||{}),y=(t=>(t.MangaSearch="/manga",t.MangaFullById="/manga/{id}/full",t.MangaById="/manga/{id}",t.MangaCharacters="/manga/{id}/characters",t.MangaPictures="/manga/{id}/pictures",t.MangaStatistics="/manga/{id}/statistics",t.MangaRecommendations="/manga/{id}/recommendations",t))(y||{}),S=(i=>(i.TopAnime="/top/anime",i.TopManga="/top/manga",i))(S||{}),E=(s=>(s.Season="/seasons/{year}/{season}",s.SeasonNow="/seasons/now",s.SeasonsList="/seasons",s.SeasonUpcoming="/seasons/upcoming",s))(E||{});import{buildMemoryStorage as I,defaultHeaderInterpreter as M,defaultKeyGenerator as L}from"axios-cache-interceptor";var g={storage:I(),generateKey:L,headerInterpreter:M,debug:void 0},l=r=>({storage:r?.storage??g.storage,generateKey:r?.generateKey??g.generateKey,headerInterpreter:r?.headerInterpreter??g.headerInterpreter,debug:r?.debug??g.debug});import{Logger as w}from"tslog";var _={prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} [{{name}}] ",name:"Jikan-ts Logger"},A=(r=_)=>new w(r),k=(r,n)=>(n.info(`[Request Config] ${r.method?.toUpperCase()||""} | ${r.url||""}`),r),J=(r,n)=>{throw n.error(`[Request Error] CODE ${r.code||"UNKNOWN"} | ${r.message}`),r},x=(r,n)=>(n.info(),console.log(r.data),r),b=(r,n)=>{throw n.error(`[ Response Error ] CODE ${r.code||"UNKNOWN"} | ${r.message}`),r};var c=class{api;constructor(n={}){if(this.api=$(v.create({baseURL:n.baseURL??"https://api.jikan.moe/v4",headers:{"Content-Type":"application/json"}}),l(n.cacheOptions)),n.loggerOptions?.enabled){let i=A(n.loggerOptions.settings);this.addHttpInterceptors(i)}}addHttpInterceptors(n){this.api.interceptors.request.use(i=>k(i,n),i=>J(i,n)),this.api.interceptors.response.use(i=>x(i,n),i=>b(i,n))}};var u=class extends c{constructor(n){super(n)}async getAnimeSearch(n){return new Promise((i,a)=>{let s=`${"/anime"}`;this.api.get(s,{params:n}).then(e=>i(e.data)).catch(e=>a(e))})}async getAnimeFullById(n){return new Promise((i,a)=>{let s=`${"/anime/{id}/full".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getAnimeById(n){return new Promise((i,a)=>{let s=`${"/anime/{id}".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getAnimeCharacters(n){return new Promise((i,a)=>{let s=`${"/anime/{id}/characters".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getAnimeStaff(n){return new Promise((i,a)=>{let s=`${"/anime/{id}/staff".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getAnimeEpisodes(n,i=1){return new Promise((a,s)=>{let e=`${"/anime/{id}/episodes".replace("{id}",String(n))}`;this.api.get(e,{params:{page:i}}).then(o=>a(o.data)).catch(o=>s(o))})}async getAnimeEpisodeById(n,i){return new Promise((a,s)=>{let e=`${"/anime/{id}/episodes/{episode}".replace("{id}",String(n)).replace("{episode}",String(i))}`;this.api.get(e).then(o=>a(o.data)).catch(o=>s(o))})}async getAnimeVideos(n){return new Promise((i,a)=>{let s=`${"/anime/{id}/videos".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getAnimeEpisodeVideos(n,i=1){return new Promise((a,s)=>{let e=`${"/anime/{id}/videos/episodes".replace("{id}",String(n))}`;this.api.get(e,{params:{page:i}}).then(o=>a(o.data)).catch(o=>s(o))})}async getAnimePictures(n){return new Promise((i,a)=>{let s=`${"/anime/{id}/pictures".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getAnimeStatistics(n){return new Promise((i,a)=>{let s=`${"/anime/{id}/statistics".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getAnimeRecommendations(n){return new Promise((i,a)=>{let s=`${"/anime/{id}/recommendations".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}};var d=class extends c{constructor(n){super(n)}async getMangaSearch(n){return new Promise((i,a)=>{let s=`${"/manga"}`;this.api.get(s,{params:n}).then(e=>i(e.data)).catch(e=>a(e))})}async getMangaFullById(n){return new Promise((i,a)=>{let s=`${"/manga/{id}/full".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getMangaById(n){return new Promise((i,a)=>{let s=`${"/manga/{id}".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getMangaCharacters(n){return new Promise((i,a)=>{let s=`${"/manga/{id}/characters".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getMangaPictures(n){return new Promise((i,a)=>{let s=`${"/manga/{id}/pictures".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getMangaStatistics(n){return new Promise((i,a)=>{let s=`${"/manga/{id}/statistics".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}async getMangaRecommendations(n){return new Promise((i,a)=>{let s=`${"/manga/{id}/recommendations".replace("{id}",String(n))}`;this.api.get(s).then(e=>i(e.data)).catch(e=>a(e))})}};var R=class extends c{constructor(n){super(n)}async getTopAnime(n){return new Promise((i,a)=>{let s=`${"/top/anime"}`;this.api.get(s,{params:n}).then(e=>i(e.data)).catch(e=>a(e))})}async getTopManga(n){return new Promise((i,a)=>{let s=`${"/top/manga"}`;this.api.get(s,{params:n}).then(e=>i(e.data)).catch(e=>a(e))})}};var h=class extends c{constructor(n){super(n)}async getSeason(n,i,a){return new Promise((s,e)=>{let o=`${"/seasons/{year}/{season}".replace("{year}",String(n)).replace("{season}",i)}`;this.api.get(o,{params:a}).then(t=>s(t.data)).catch(t=>e(t))})}async getSeasonNow(n){return new Promise((i,a)=>{let s=`${"/seasons/now"}`;this.api.get(s,{params:n}).then(e=>i(e.data)).catch(e=>a(e))})}async getSeasonsList(){return new Promise((n,i)=>{let a=`${"/seasons"}`;this.api.get(a).then(s=>n(s.data)).catch(s=>i(s))})}async getSeasonUpcoming(n){return new Promise((i,a)=>{let s=`${"/seasons/upcoming"}`;this.api.get(s,{params:n}).then(e=>i(e.data)).catch(e=>a(e))})}};var P=class{anime;manga;top;seasons;constructor(n){this.anime=new u(n),this.manga=new d(n),this.top=new R(n),this.seasons=new h(n)}};var T=(o=>(o.tv="TV",o.movie="Movie",o.ova="Ova",o.special="Special",o.ona="Ona",o.music="Music",o))(T||{}),N=(s=>(s.finished="Finished Airing",s.airing="Currently Airing",s.complete="Complete",s.upcoming="Not yet aired",s))(N||{}),B=(o=>(o.g="g",o.pg="pg",o.pg13="pg13",o.r17="r17",o.r="r",o.rx="rx",o))(B||{}),V=(s=>(s.spring="spring",s.summer="summer",s.fall="fall",s.winter="winter",s))(V||{});var j=(i=>(i.main="Main",i.supporting="Supporting",i))(j||{});var O=(t=>(t.manga="Manga",t.novel="Novel",t.lightnovel="Lightnovel",t.oneshot="Oneshot",t.doujin="Doujin",t.manhwa="Manhwa",t.manhua="Manhua",t))(O||{}),D=(e=>(e.publishing="Publishing",e.complete="Complete",e.hiatus="Hiatus",e.discontinued="Discontinued",e.upcoming="Upcoming",e))(D||{});var U=(i=>(i.asc="asc",i.desc="desc",i))(U||{}),q=(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))(q||{}),K=(a=>(a.type="type",a.rating="rating",a.episodes="episodes",a))(K||{}),H=(i=>(i.chapters="chapters",i.volumes="volumes",i))(H||{});var G=(s=>(s.airing="airing",s.upcoming="upcoming",s.bypopularity="bypopularity",s.favorite="favorite",s))(G||{}),z=(s=>(s.publishing="publishing",s.upcoming="upcoming",s.bypopularity="bypopularity",s.favorite="favorite",s))(z||{});export{u as AnimeClient,C as AnimeEndpoints,B as AnimeRating,K as AnimeSearchOrder,V as AnimeSeason,N as AnimeStatus,T as AnimeType,c as BaseClient,f as BaseURL,j as CharacterRole,g as DEFAULT_CACHE_OPTIONS,_ as DEFAULT_LOGGER_SETTINGS,P as JikanClient,d as MangaClient,y as MangaEndpoints,H as MangaSearchOrder,D as MangaStatus,O as MangaType,q as SearchOrder,h as SeasonsClient,E as SeasonsEndpoints,U as SortOptions,G as TopAnimeFilter,R as TopClient,S as TopEndpoints,z as TopMangaFilter,A as createLogger,l as getCacheOptions,k as handleRequest,J as handleRequestError,x as handleResponse,b as handleResponseError};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tutkli/jikan-ts",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "Node.js wrapper for the Jikan API with build-in typings.",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,28 +37,28 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/tutkli/jikan-ts#readme",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"axios": "
|
|
41
|
-
"axios-cache-interceptor": "
|
|
40
|
+
"axios": "^0.27.2",
|
|
41
|
+
"axios-cache-interceptor": "^0.10.7",
|
|
42
42
|
"tslog": "4.7.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@swc/core": "1.3.
|
|
45
|
+
"@swc/core": "1.3.27",
|
|
46
46
|
"@swc/jest": "^0.2.23",
|
|
47
|
-
"@types/jest": "29.2.
|
|
47
|
+
"@types/jest": "29.2.6",
|
|
48
48
|
"@types/node": "18.11.18",
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
50
|
-
"@typescript-eslint/parser": "5.
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "5.49.0",
|
|
50
|
+
"@typescript-eslint/parser": "5.49.0",
|
|
51
51
|
"dts-bundle-generator": "^7.1.0",
|
|
52
|
-
"esbuild": "0.
|
|
52
|
+
"esbuild": "0.17.4",
|
|
53
53
|
"esbuild-node-externals": "^1.6.0",
|
|
54
|
-
"eslint": "8.
|
|
54
|
+
"eslint": "8.32.0",
|
|
55
55
|
"eslint-config-prettier": "8.6.0",
|
|
56
56
|
"eslint-plugin-jest": "27.2.1",
|
|
57
57
|
"eslint-plugin-node": "^11.1.0",
|
|
58
58
|
"eslint-plugin-prettier": "^4.2.1",
|
|
59
59
|
"jest": "^29.3.1",
|
|
60
|
-
"prettier": "2.8.
|
|
61
|
-
"rimraf": "
|
|
60
|
+
"prettier": "2.8.3",
|
|
61
|
+
"rimraf": "4.1.1",
|
|
62
62
|
"typescript": "4.9.4"
|
|
63
63
|
}
|
|
64
64
|
}
|