@tutkli/jikan-ts 0.6.4 → 0.6.6
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/.github/workflows/deploy.yml +33 -0
- package/README.md +14 -23
- package/dist/index.d.ts +29 -70
- package/dist/index.js +1 -1
- package/package.json +17 -14
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Deploy
|
|
2
|
+
on:
|
|
3
|
+
workflow_dispatch: {}
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
jobs:
|
|
8
|
+
deploy:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
pages: write
|
|
12
|
+
id-token: write
|
|
13
|
+
environment:
|
|
14
|
+
name: github-pages
|
|
15
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
- uses: actions/setup-node@v3
|
|
21
|
+
with:
|
|
22
|
+
node-version: 16
|
|
23
|
+
cache: yarn
|
|
24
|
+
- run: yarn install --frozen-lockfile
|
|
25
|
+
- name: Build
|
|
26
|
+
run: npm run docs:build
|
|
27
|
+
- uses: actions/configure-pages@v2
|
|
28
|
+
- uses: actions/upload-pages-artifact@v1
|
|
29
|
+
with:
|
|
30
|
+
path: docs/.vitepress/dist
|
|
31
|
+
- name: Deploy
|
|
32
|
+
id: deployment
|
|
33
|
+
uses: actions/deploy-pages@v1
|
package/README.md
CHANGED
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
|
|
16
16
|
- 💅 Fully typed
|
|
17
17
|
- ♻ Http Request Cache
|
|
18
|
-
- 📄
|
|
18
|
+
- 📄 Logging
|
|
19
19
|
- 📦 ESM with tree shaking support
|
|
20
20
|
|
|
21
|
-
#### 📖 Check out the [documentation page](https://tutkli.github.io/jikan-ts
|
|
21
|
+
#### 📖 Check out the [documentation page](https://tutkli.github.io/jikan-ts/)!
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
npm install --save @tutkli/jikan-ts
|
|
27
27
|
# or
|
|
28
|
-
yarn add @tutkli/jikan-ts
|
|
28
|
+
yarn add @tutkli/jikan-ts
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## Example
|
|
32
32
|
|
|
33
|
-
Using a specific client, like AnimeClient
|
|
33
|
+
Using a specific client, like **AnimeClient**:
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
36
|
import { AnimeClient, JikanResponse, Anime } from '@tutkli/jikan-ts';
|
|
@@ -45,7 +45,7 @@ import { AnimeClient, JikanResponse, Anime } from '@tutkli/jikan-ts';
|
|
|
45
45
|
})();
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
Or, using the JikanClient
|
|
48
|
+
Or, using the **JikanClient**:
|
|
49
49
|
|
|
50
50
|
```ts
|
|
51
51
|
import { JikanClient, JikanResponse, Anime } from '@tutkli/jikan-ts';
|
|
@@ -62,52 +62,43 @@ import { JikanClient, JikanResponse, Anime } from '@tutkli/jikan-ts';
|
|
|
62
62
|
|
|
63
63
|
## Client configuration
|
|
64
64
|
|
|
65
|
-
Jikan-ts has default cache and logging configurations. If you want to customize any configuration, you can do so by passing `cacheOptions` or `loggerOptions` arguments when instantiating a client.
|
|
66
|
-
|
|
67
65
|
### Cache Configuration
|
|
68
66
|
|
|
69
|
-
|
|
67
|
+
Jikan-ts uses `axios-cache-interceptor` to store request results.
|
|
68
|
+
To use a specific configuration, pass the `cacheOptions` argument when instantiating a client:
|
|
70
69
|
|
|
71
70
|
```ts
|
|
72
71
|
import { AnimeClient } from '@tutkli/jikan-ts';
|
|
73
72
|
|
|
74
73
|
const animeClient = new AnimeClient({
|
|
75
|
-
cacheOptions: { ... } //
|
|
74
|
+
cacheOptions: { ... } // axios-cache-interceptor options
|
|
76
75
|
}
|
|
77
76
|
);
|
|
78
77
|
```
|
|
79
78
|
|
|
80
|
-
|
|
79
|
+
For more information, check out the [axios-cache-interceptor Documentation](https://axios-cache-interceptor.js.org/).
|
|
81
80
|
|
|
82
|
-
### Logging
|
|
81
|
+
### Logging
|
|
83
82
|
|
|
84
|
-
To enable logging, pass the `
|
|
83
|
+
To enable logging, pass the `enableLogging` argument as `true`.
|
|
85
84
|
|
|
86
85
|
```ts
|
|
87
86
|
import { AnimeClient } from '@tutkli/jikan-ts';
|
|
88
87
|
|
|
89
88
|
const animeClient = new AnimeClient({
|
|
90
|
-
|
|
91
|
-
enabled: true, // enables logging
|
|
92
|
-
settings: { ... } // [Optional] your custom tslog settings
|
|
93
|
-
}
|
|
89
|
+
enableLogging: true,
|
|
94
90
|
}
|
|
95
91
|
);
|
|
96
92
|
```
|
|
97
93
|
|
|
98
|
-
See also: [tslog Settings](https://tslog.js.org/#/?id=settings).
|
|
99
|
-
|
|
100
94
|
## Available Clients
|
|
101
95
|
|
|
102
96
|
- AnimeClient
|
|
103
97
|
- MangaClient
|
|
104
98
|
- TopClient
|
|
99
|
+
- SeasonsClient
|
|
105
100
|
- JikanClient (Main client)
|
|
106
101
|
|
|
107
|
-
## Documentation
|
|
108
|
-
|
|
109
|
-
Check out the [documentation page](https://tutkli.github.io/jikan-ts-docs/)!
|
|
110
|
-
|
|
111
102
|
## Leave you feedback
|
|
112
103
|
|
|
113
104
|
- Did you find this project useful? [Leave a ⭐](https://github.com/tutkli/jikan-ts)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,20 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v7.
|
|
1
|
+
// Generated by dts-bundle-generator v7.2.0
|
|
2
2
|
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
|
|
5
5
|
import { AxiosError } from 'axios';
|
|
6
6
|
import { AxiosCacheInstance, CacheAxiosResponse, CacheOptions, CacheRequestConfig } from 'axios-cache-interceptor';
|
|
7
|
-
import { ISettingsParam, Logger } from 'tslog';
|
|
8
|
-
import { ILogObj } from 'tslog/dist/types/interfaces';
|
|
9
7
|
|
|
10
|
-
export declare const DEFAULT_CACHE_OPTIONS: {
|
|
11
|
-
storage: import("axios-cache-interceptor").MemoryStorage;
|
|
12
|
-
generateKey: import("axios-cache-interceptor").KeyGenerator<unknown, unknown>;
|
|
13
|
-
headerInterpreter: import("axios-cache-interceptor").HeadersInterpreter;
|
|
14
|
-
debug: undefined;
|
|
15
|
-
};
|
|
16
|
-
export declare const getCacheOptions: (cacheOptions: CacheOptions | undefined) => CacheOptions;
|
|
17
|
-
export interface LoggerOptions {
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
settings: ISettingsParam<ILogObj>;
|
|
20
|
-
}
|
|
21
|
-
export declare const DEFAULT_LOGGER_SETTINGS: ISettingsParam<ILogObj>;
|
|
22
|
-
export declare const createLogger: (options?: ISettingsParam<ILogObj>) => Logger<ILogObj>;
|
|
23
|
-
export declare const handleRequest: (requestConfig: CacheRequestConfig, logger: Logger<ILogObj>) => CacheRequestConfig;
|
|
24
|
-
export declare const handleRequestError: (error: AxiosError, logger: Logger<ILogObj>) => Promise<AxiosError>;
|
|
25
|
-
export declare const handleResponse: (response: CacheAxiosResponse, logger: Logger<ILogObj>) => CacheAxiosResponse;
|
|
26
|
-
export declare const handleResponseError: (error: AxiosError, logger: Logger<ILogObj>) => Promise<AxiosError>;
|
|
27
8
|
/**
|
|
28
9
|
* **Client Args**
|
|
29
10
|
* Used to pass optional configuration for logging and cache to the clients.
|
|
30
11
|
*/
|
|
31
12
|
export interface ClientArgs {
|
|
32
13
|
/**
|
|
33
|
-
* **
|
|
34
|
-
*
|
|
35
|
-
* @see https://tslog.js.org/#/?id=settings
|
|
14
|
+
* **EnableLogging**
|
|
15
|
+
* Enables logging request responses.
|
|
36
16
|
*/
|
|
37
|
-
|
|
17
|
+
enableLogging: boolean;
|
|
38
18
|
/**
|
|
39
19
|
* **Axios Cache Options**
|
|
40
20
|
* Options for cache.
|
|
@@ -53,7 +33,7 @@ export interface ClientArgs {
|
|
|
53
33
|
export declare abstract class BaseClient {
|
|
54
34
|
api: AxiosCacheInstance;
|
|
55
35
|
protected constructor(clientOptions?: Partial<ClientArgs>);
|
|
56
|
-
private
|
|
36
|
+
private addLoggingInterceptors;
|
|
57
37
|
}
|
|
58
38
|
export interface JikanResource {
|
|
59
39
|
mal_id: number;
|
|
@@ -142,6 +122,10 @@ export interface StatisticsScore {
|
|
|
142
122
|
votes: number;
|
|
143
123
|
percentage: number;
|
|
144
124
|
}
|
|
125
|
+
export interface SeasonsListData {
|
|
126
|
+
year: number;
|
|
127
|
+
seasons: Array<keyof typeof AnimeSeason>;
|
|
128
|
+
}
|
|
145
129
|
export interface AnimeVideos {
|
|
146
130
|
promo: AnimePromoVideo[];
|
|
147
131
|
episodes: AnimeEpisodeVideo[];
|
|
@@ -446,24 +430,22 @@ export interface MangaTopParams extends JikanTopParams {
|
|
|
446
430
|
type: MangaType;
|
|
447
431
|
filter: TopMangaFilter;
|
|
448
432
|
}
|
|
433
|
+
export interface JikanSeasonsParams {
|
|
434
|
+
page?: number;
|
|
435
|
+
limit?: number;
|
|
436
|
+
filter?: AnimeType;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* QueryParams used in **getSeasonNow** call
|
|
440
|
+
*
|
|
441
|
+
*/
|
|
442
|
+
export type SeasonNowParams = Omit<JikanSeasonsParams, "filter">;
|
|
449
443
|
/**
|
|
450
444
|
* **Anime Client**
|
|
451
445
|
*
|
|
452
446
|
* Client used to access the Anime Endpoints:
|
|
453
|
-
* - [AnimeSearch](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimesearch-anime)
|
|
454
|
-
* - [AnimeFullById](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimefullbyid-anime-id-full)
|
|
455
|
-
* - [AnimeById](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimebyid-anime-id)
|
|
456
|
-
* - [AnimeCharacters](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimecharacters-anime-id-characters)
|
|
457
|
-
* - [AnimeStaff](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimestaff-anime-id-staff)
|
|
458
|
-
* - [AnimeEpisodes](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimeepisodes-anime-id-episodes)
|
|
459
|
-
* - [AnimeEpisodeById](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimeepisodebyid-anime-id-episodes-episode)
|
|
460
|
-
* - [AnimeVideos](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimevideos-anime-id-videos)
|
|
461
|
-
* - [AnimeEpisodeVideos](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimeepisodevideos-anime-id-videos-episodes)
|
|
462
|
-
* - [AnimePictures](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimepictures-anime-id-pictures)
|
|
463
|
-
* - [AnimeStatistics](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimestatistics-anime-id-statistics)
|
|
464
|
-
* - [AnimeRecommendations](https://tutkli.github.io/jikan-ts-docs/clients/anime-client.html#getanimerecommendations-anime-id-recommendations)
|
|
465
447
|
*
|
|
466
|
-
* See also: [
|
|
448
|
+
* See also: [Jikan Documentation](https://docs.api.jikan.moe/)
|
|
467
449
|
*/
|
|
468
450
|
export declare class AnimeClient extends BaseClient {
|
|
469
451
|
/**
|
|
@@ -550,15 +532,8 @@ export declare class AnimeClient extends BaseClient {
|
|
|
550
532
|
* **Manga Client**
|
|
551
533
|
*
|
|
552
534
|
* Client used to access the Manga Endpoints:
|
|
553
|
-
* - [MangaSearch](https://tutkli.github.io/jikan-ts-docs/clients/manga-client.html#getmangasearch-manga)
|
|
554
|
-
* - [MangaFullById](https://tutkli.github.io/jikan-ts-docs/clients/manga-client.html#getmangafullbyid-manga-id-full)
|
|
555
|
-
* - [MangaById](https://tutkli.github.io/jikan-ts-docs/clients/manga-client.html#getmangabyid-manga-id)
|
|
556
|
-
* - [MangaCharacters](https://tutkli.github.io/jikan-ts-docs/clients/manga-client.html#getmangacharacters-manga-id-characters)
|
|
557
|
-
* - [MangaPictures](https://tutkli.github.io/jikan-ts-docs/clients/manga-client.html#getmangapictures-manga-id-pictures)
|
|
558
|
-
* - [MangaStatistics](https://tutkli.github.io/jikan-ts-docs/clients/manga-client.html#getmangastatistics-manga-id-statistics)
|
|
559
|
-
* - [MangaRecommendations](https://tutkli.github.io/jikan-ts-docs/clients/manga-client.html#getmangarecommendations-manga-id-recommendations)
|
|
560
535
|
*
|
|
561
|
-
* See also: [
|
|
536
|
+
* See also: [Jikan Documentation](https://docs.api.jikan.moe/)
|
|
562
537
|
*/
|
|
563
538
|
export declare class MangaClient extends BaseClient {
|
|
564
539
|
/**
|
|
@@ -612,10 +587,8 @@ export declare class MangaClient extends BaseClient {
|
|
|
612
587
|
* **Top Client**
|
|
613
588
|
*
|
|
614
589
|
* Client used to access the Top Endpoints:
|
|
615
|
-
* - [TopAnime](https://tutkli.github.io/jikan-ts-docs/clients/top-client.html#gettopanime-top-anime)
|
|
616
|
-
* - [TopManga](https://tutkli.github.io/jikan-ts-docs/clients/top-client.html#gettopmanga-top-manga)
|
|
617
590
|
*
|
|
618
|
-
* See also: [
|
|
591
|
+
* See also: [Jikan Documentation](https://docs.api.jikan.moe/)
|
|
619
592
|
*/
|
|
620
593
|
export declare class TopClient extends BaseClient {
|
|
621
594
|
/**
|
|
@@ -635,26 +608,12 @@ export declare class TopClient extends BaseClient {
|
|
|
635
608
|
*/
|
|
636
609
|
getTopManga(searchParams?: Partial<MangaTopParams>): Promise<JikanResponse<Manga[]>>;
|
|
637
610
|
}
|
|
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
611
|
/**
|
|
653
612
|
* **Seasons Client**
|
|
654
613
|
*
|
|
655
614
|
* Client used to access the Seasons Endpoints
|
|
656
615
|
*
|
|
657
|
-
* See also: [
|
|
616
|
+
* See also: [Jikan Documentation](https://docs.api.jikan.moe/)
|
|
658
617
|
*/
|
|
659
618
|
export declare class SeasonsClient extends BaseClient {
|
|
660
619
|
/**
|
|
@@ -690,13 +649,9 @@ export declare class SeasonsClient extends BaseClient {
|
|
|
690
649
|
/**
|
|
691
650
|
* **Jikan Client**
|
|
692
651
|
*
|
|
693
|
-
* The main client used to access all the
|
|
694
|
-
* - [Anime](https://docs.api.jikan.moe/#tag/anime)
|
|
695
|
-
* - [Manga](https://docs.api.jikan.moe/#tag/manga)
|
|
696
|
-
* - [Top](https://docs.api.jikan.moe/#tag/top)
|
|
697
|
-
* - [Seasons](https://docs.api.jikan.moe/#tag/seasons)
|
|
652
|
+
* The main client used to access all the Jikan Endpoints:
|
|
698
653
|
*
|
|
699
|
-
* See also: [
|
|
654
|
+
* See also: [Jikan Documentation](https://docs.api.jikan.moe/)
|
|
700
655
|
*/
|
|
701
656
|
export declare class JikanClient {
|
|
702
657
|
anime: AnimeClient;
|
|
@@ -705,6 +660,10 @@ export declare class JikanClient {
|
|
|
705
660
|
seasons: SeasonsClient;
|
|
706
661
|
constructor(clientOptions?: Partial<ClientArgs>);
|
|
707
662
|
}
|
|
663
|
+
export declare const handleRequest: (requestConfig: CacheRequestConfig) => CacheRequestConfig;
|
|
664
|
+
export declare const handleRequestError: (error: AxiosError) => Promise<AxiosError>;
|
|
665
|
+
export declare const handleResponse: (response: CacheAxiosResponse) => CacheAxiosResponse;
|
|
666
|
+
export declare const handleResponseError: (error: AxiosError) => Promise<AxiosError>;
|
|
708
667
|
export declare enum BaseURL {
|
|
709
668
|
REST = "https://api.jikan.moe/v4"
|
|
710
669
|
}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setupCache as
|
|
1
|
+
import{setupCache as y}from"axios-cache-interceptor";import S from"axios";var x=(n=>(n.REST="https://api.jikan.moe/v4",n))(x||{});var b=(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))(b||{}),P=(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))(P||{}),C=(i=>(i.TopAnime="/top/anime",i.TopManga="/top/manga",i))(C||{}),f=(s=>(s.Season="/seasons/{year}/{season}",s.SeasonNow="/seasons/now",s.SeasonsList="/seasons",s.SeasonUpcoming="/seasons/upcoming",s))(f||{});var h=r=>(console.info(`[Request] ${r.method?.toUpperCase()||""} | ${r.url||""}`),r),l=r=>{throw console.error(`[Request Error] CODE ${r.code||"UNKNOWN"} | ${r.message}`),r},A=r=>(console.info(`[Request Response] ${r.config.method?.toUpperCase()||""} | ${r.config.url||""}`,r.data),r),k=r=>{throw console.error(`[ Response Error ] CODE ${r.code||"UNKNOWN"} | ${r.message}`),r};var c=class{api;constructor(n={}){this.api=y(S.create({baseURL:n.baseURL??"https://api.jikan.moe/v4",headers:{"Content-Type":"application/json"}}),n.cacheOptions),n.enableLogging&&this.addLoggingInterceptors()}addLoggingInterceptors(){this.api.interceptors.request.use(n=>h(n),n=>l(n)),this.api.interceptors.response.use(n=>A(n),n=>k(n))}};var g=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 u=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 d=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 R=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 J=class{anime;manga;top;seasons;constructor(n){this.anime=new g(n),this.manga=new u(n),this.top=new d(n),this.seasons=new R(n)}};var E=(o=>(o.tv="TV",o.movie="Movie",o.ova="Ova",o.special="Special",o.ona="Ona",o.music="Music",o))(E||{}),M=(s=>(s.finished="Finished Airing",s.airing="Currently Airing",s.complete="Complete",s.upcoming="Not yet aired",s))(M||{}),w=(o=>(o.g="g",o.pg="pg",o.pg13="pg13",o.r17="r17",o.r="r",o.rx="rx",o))(w||{}),$=(s=>(s.spring="spring",s.summer="summer",s.fall="fall",s.winter="winter",s))($||{});var I=(i=>(i.main="Main",i.supporting="Supporting",i))(I||{});var v=(t=>(t.manga="Manga",t.novel="Novel",t.lightnovel="Lightnovel",t.oneshot="Oneshot",t.doujin="Doujin",t.manhwa="Manhwa",t.manhua="Manhua",t))(v||{}),_=(e=>(e.publishing="Publishing",e.complete="Complete",e.hiatus="Hiatus",e.discontinued="Discontinued",e.upcoming="Upcoming",e))(_||{});var B=(i=>(i.asc="asc",i.desc="desc",i))(B||{}),V=(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))(V||{}),N=(a=>(a.type="type",a.rating="rating",a.episodes="episodes",a))(N||{}),L=(i=>(i.chapters="chapters",i.volumes="volumes",i))(L||{});var T=(s=>(s.airing="airing",s.upcoming="upcoming",s.bypopularity="bypopularity",s.favorite="favorite",s))(T||{}),q=(s=>(s.publishing="publishing",s.upcoming="upcoming",s.bypopularity="bypopularity",s.favorite="favorite",s))(q||{});export{g as AnimeClient,b as AnimeEndpoints,w as AnimeRating,N as AnimeSearchOrder,$ as AnimeSeason,M as AnimeStatus,E as AnimeType,c as BaseClient,x as BaseURL,I as CharacterRole,J as JikanClient,u as MangaClient,P as MangaEndpoints,L as MangaSearchOrder,_ as MangaStatus,v as MangaType,V as SearchOrder,R as SeasonsClient,f as SeasonsEndpoints,B as SortOptions,T as TopAnimeFilter,d as TopClient,C as TopEndpoints,q as TopMangaFilter,h as handleRequest,l as handleRequestError,A as handleResponse,k 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.6",
|
|
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",
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"prepublish": "yarn run build",
|
|
16
16
|
"test:coverage": "jest --coverage",
|
|
17
17
|
"test:dev": "jest --verbose --colors --expand --maxWorkers=50% --detectOpenHandles --errorOnDeprecated --bail",
|
|
18
|
-
"lint:fix": "npx eslint src/** --fix"
|
|
18
|
+
"lint:fix": "npx eslint src/** --fix",
|
|
19
|
+
"docs:dev": "vitepress dev docs",
|
|
20
|
+
"docs:build": "vitepress build docs",
|
|
21
|
+
"docs:preview": "vitepress preview docs"
|
|
19
22
|
},
|
|
20
23
|
"repository": {
|
|
21
24
|
"type": "git",
|
|
@@ -38,27 +41,27 @@
|
|
|
38
41
|
"homepage": "https://github.com/tutkli/jikan-ts#readme",
|
|
39
42
|
"dependencies": {
|
|
40
43
|
"axios": "^0.27.2",
|
|
41
|
-
"axios-cache-interceptor": "^0.10.7"
|
|
42
|
-
"tslog": "4.7.1"
|
|
44
|
+
"axios-cache-interceptor": "^0.10.7"
|
|
43
45
|
},
|
|
44
46
|
"devDependencies": {
|
|
45
|
-
"@swc/core": "1.3.
|
|
47
|
+
"@swc/core": "1.3.41",
|
|
46
48
|
"@swc/jest": "^0.2.23",
|
|
47
|
-
"@types/jest": "29.
|
|
48
|
-
"@types/node": "18.
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
50
|
-
"@typescript-eslint/parser": "5.
|
|
49
|
+
"@types/jest": "29.5.0",
|
|
50
|
+
"@types/node": "18.15.3",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "5.55.0",
|
|
52
|
+
"@typescript-eslint/parser": "5.55.0",
|
|
51
53
|
"dts-bundle-generator": "^7.1.0",
|
|
52
54
|
"esbuild": "0.17.4",
|
|
53
55
|
"esbuild-node-externals": "^1.6.0",
|
|
54
|
-
"eslint": "8.
|
|
55
|
-
"eslint-config-prettier": "8.
|
|
56
|
+
"eslint": "8.36.0",
|
|
57
|
+
"eslint-config-prettier": "8.7.0",
|
|
56
58
|
"eslint-plugin-jest": "27.2.1",
|
|
57
59
|
"eslint-plugin-node": "^11.1.0",
|
|
58
60
|
"eslint-plugin-prettier": "^4.2.1",
|
|
59
61
|
"jest": "^29.3.1",
|
|
60
|
-
"prettier": "2.8.
|
|
61
|
-
"rimraf": "4.
|
|
62
|
-
"typescript": "
|
|
62
|
+
"prettier": "2.8.4",
|
|
63
|
+
"rimraf": "4.4.0",
|
|
64
|
+
"typescript": "5.0.2",
|
|
65
|
+
"vitepress": "^1.0.0-alpha.60"
|
|
63
66
|
}
|
|
64
67
|
}
|