Jikan API wrapper for Typescript and NodeJS with build in typings.
- ๐ Fully typed
- โป Http Request Cache
- ๐ Configurable Logging
- ๐ฆ ESM with tree shaking support
๐ Check out the documentation page!
npm install --save @tutkli/jikan-ts
# or
yarn add @tutkli/jikan-ts # recommended
Using a specific client, like AnimeClient:
import { AnimeClient, JikanResponse, Anime } from '@tutkli/jikan-ts';
(async () => {
const animeClient = new AnimeClient();
await animeClient
.getAnimeById(1)
.then((jikanResponse: JikanResponse<Anime>) => { /* ... */ })
.catch((error) => console.error(error));
})();
Or, using the JikanClient:
import { JikanClient, JikanResponse, Anime } from '@tutkli/jikan-ts';
(async () => {
const jikanClient = new JikanClient();
await jikanClient.anime
.getAnimeById(1)
.then((jikanResponse: JikanResponse<Anime>) => { /* ... */ })
.catch((error) => console.error(error));
})();
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.
To use a specific configuration, pass the cacheOptions argument when instantiating a client:
import { AnimeClient } from '@tutkli/jikan-ts';
const animeClient = new AnimeClient({
cacheOptions: { ... } // your custom axios-cache-interceptor options
}
);
See also: axios-cache-interceptor Configuration.
To enable logging, pass the loggerOptions
argument with enabled: true
. You can also customize the styling of the logger with your custom tslog settings.
import { AnimeClient } from '@tutkli/jikan-ts';
const animeClient = new AnimeClient({
loggerOptions: {
enabled: true, // enables logging
settings: { ... } // [Optional] your custom tslog settings
}
}
);
See also: tslog Settings.
- AnimeClient
- MangaClient
- TopClient
- JikanClient (Main client)
Check out the documentation page!
- Did you find this project useful? Leave a โญ
- Found a problem? Create an issue ๐
- Want to contribute? Submit a PR ๐