Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@tutkli/jikan-ts

tutkli628MIT2.1.0TypeScript support: included

Node.js wrapper for the Jikan API with built-in typings.

jikan, jikan-api, jikanAPI, MyAnimeList

readme

jikan-ts

jikan-ts-890w

Language Shield GitHub License Code Style Shield NPM Downloads npm bundle size

Jikan API wrapper for Typescript and Node.js with built-in typings.

Features

  • 💅 Fully typed
  • ♻ Http Request Cache
  • 📄 Logging
  • 📦 ESM with tree shaking support

Installation

npm install --save @tutkli/jikan-ts axios axios-cache-interceptor
# or
yarn add @tutkli/jikan-ts axios axios-cache-interceptor

Example

Using a specific client, like AnimeClient:

import { AnimeClient, JikanResponse, Anime } from '@tutkli/jikan-ts';

const animeClient = new AnimeClient();

animeClient
  .getAnimeById(1)
  .then((response: JikanResponse<Anime>) => {
    /* ... */
  })

Or, using the JikanClient:

import { JikanClient, JikanResponse, Anime } from '@tutkli/jikan-ts';

const jikanClient = new JikanClient();

jikanClient.anime
  .getAnimeById(1)
  .then((response: JikanResponse<Anime>) => {
    /* ... */
  })

Client configuration

Cache Configuration

Jikan-ts uses axios-cache-interceptor to store request results. To use a specific configuration, pass the cacheOptions argument when instantiating a client:

import { AnimeClient } from '@tutkli/jikan-ts';

const animeClient = new AnimeClient({
    cacheOptions: { ... } // axios-cache-interceptor options
  }
);

Custom Axios instance

Jikan uses axios as an http client and if you are not satisfied with the default client settings, then you can build your instance by passing it to the optional axiosInstance argument

import { AnimeClient } from '@tutkli/jikan-ts';
import Axios from 'axios';

const animeClient = new AnimeClient({
    axiosInstance: Axios.create({ ... })
  }
);

For more information, check out the axios-cache-interceptor Documentation.

Logging

To enable logging, pass the enableLogging argument as true.

import { AnimeClient } from '@tutkli/jikan-ts';

const animeClient = new AnimeClient({
  enableLogging: true,
});

Available Clients

  • AnimeClient
  • CharactersClient
  • GenresClient
  • MangaClient
  • TopClient
  • SchedulesClient
  • SeasonsClient
  • RandomClient
  • JikanClient (Main client)

Leave you feedback

changelog

Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by auto-changelog.

v2.0.2

v2.0.2

13 July 2024

  • fix: animeSearch endpoint #9
  • style: update biome config 3308c4f
  • fix: remove banner from build output ba11de2
  • perf: remove boilerplate 6a60194
  • fix: simplify types 2fba166
  • perf: replace enum endpoints with consts f268a9a
  • refactor: replace params enums with types a1a0be8
  • perf: remove type boilerplate f5fd9d3
  • chore: bump to v2.0.0 8289575
  • feat: add some missing anime and manga endpoints b98dcb8
  • refactor: replace enums with types 697432d
  • feat: add random client 2e034d1
  • fix: character model 4f9f76a
  • feat: add getTopCharacters to topClient 258c928
  • test: update tests 4b62c5c
  • docs: update README.md 7f93a95
  • perf: rename identifiers to pathParams 932fac1
  • fix: title_english for anime and manga models 8480f97
  • chore: bump to v2.0.2 a40c297
  • chore: bump to v2.0.1 4ef5a25
  • chore: release 2.0.0 10cd9fe
  • feat: add random to jikan client 5a4a03d
  • perf: remove unnecesary type assertion db2bfb0
  • chore: add bun.lockb to npmignore 0fa01be

v1.2.2

6 May 2024

  • fix: interface JikanResourcePeriod #7
  • lint: run biome linter e9f2a64
  • docs: update README.md 2f0d5b7
  • chore: bump to v1.2.2 b692f5a
  • fix: lintstaged biome command d97e0d1

v1.2.1

7 February 2024

  • build: replace jest with vitest b4344b4
  • build: replace esbuild and dts bundle generator with tsup 3e751f5
  • chore: remove eslint and prettier 56aaf46
  • chore: run biome formatter 8089432
  • test: add missing anime client tests, fix errors 2588723
  • chore: add biomejs f98c0b1
  • chore: bump to v1.2.1 68bb105
  • fix: remove jest config 80d031c
  • fix: replaceIdentifiers match function abaf4a1
  • docs: update README.md 6728967
  • fix: linting errors d61544c
  • fix: tsconfig 9a9183d
  • fix: add vitest.config.ts to .npmignore 64d2b8f

1.2.0

6 February 2024

  • fix: manga status typo #5
  • chore: update dependencies c48326a
  • chore: update prettier config 65e14c7
  • chore: update dependencies 7040506
  • chore: remove documentation page 1c761a8
  • build: update vitepress cc017c7
  • chore: add auto-changelog a385a50
  • refactor: anime client a291094
  • chore: add lint-staged pre commit hook 00c7218
  • feat: add some missing anime endpoints 4bb9f73
  • refactor: manga client 010deb4
  • refactor: characters client 8ac9fba
  • build: bumb to v1.2.0 ebd0965
  • chore: update axios and axios-cache-interceptor dfc7070
  • refactor: seasons client b7c63b7
  • refactor: genres client d081cb0
  • refactor: top client e7cccce
  • fix: status params for anime and manga search b734159
  • refactor: schedules client e9ede87
  • build: bump v1.0.1 5e9a1c3
  • fix: base client arguments visibility bec2944
  • docs: update README.md dc70591
  • fix: anime search params 9b0a6ba
  • fix: add prepare script to setup githooks 57c9c95

v1.0.0

10 June 2023

  • deps: updated dependencies 469bd3b
  • feat: add characters client 2d8a7c4
  • feat: add genres client f4f3f94
  • fix: move endpoint constants to their own file 153d8c3
  • refactor: remove innecessary constructors 40bea3e
  • feat: add schedules client e87ccb4
  • build: bump to v1.0.0 7f89c7b
  • docs: improve docs for genres and jikan client 19c9d27
  • fix: move genre model to it's own directory dc5c4cf
  • chore: add characters to jikan client b24e560
  • fix: add unapproved to anime and manga search params 9c11268

v0.6.62

6 May 2023

  • chore: update dependencies 23c76b8
  • fix: change search params fields to optional 2157f80
  • feat: add function to replace path parameters 71fba70
  • docs: fix README.md code 5ea2bdc
  • tests: add missing tests and fix errors a5e3a5d
  • chore: bump to v0.6.62 4fb54f0
  • build: remove README.md from package build c30981c

v0.6.61

20 March 2023

v0.6.5

28 January 2023

  • fix: added missing exports from models/Common/index & models/Params/index, fixing imports for seasons-client #4
  • build: bump v0.6.5 e4d890d

v0.6.4

24 January 2023

v0.6.3

12 January 2023

  • Add missing page query parameter #1
  • Fix Anime interface #2
  • build: update dependencies 42e660d
  • build: update dependencies a1d5bf0
  • build: refactor BaseClient 371e4bd
  • Pass page to params 2405e5c
  • build: bump v0.6.2 24c898d
  • build: bump v0.6.3 44e3222
  • fix: typo in Manhwa type 5065db4
  • build: make package sideEffects free f683e5d

v0.6.1

28 December 2022

  • build: update dependencies a0cc893
  • build: don't add external dependencies in built package f93d33a
  • Revert "build: update axios and axios-cache-interceptor" 89d592b
  • build: update axios and axios-cache-interceptor 049beb7
  • build: bump v0.6.1 b3d6139
  • build: update license ed8ded8
  • docs: update README.md ae14b90
  • build: remove changelog from build 44ef50c

v0.6.0

21 December 2022

  • docs: Generate docs with typedocs 7d0fd2b
  • refactor: Remove JikanUniqueResponse in favor of JikanResponse dee1f5c
  • docs: remove typedoc 6f2738d
  • build: update dependencies 166ae87
  • build: update dependencies faead30
  • tests: cover all anime client endpoints 9d85d62
  • tests: cover all client endpoints 1e88034
  • docs: redirect links to documentation page 42080e0
  • refactor: rename JikanUniqueResource to JikanResource 12e9e50
  • build: bump v0.6 91a7e10
  • docs: update README.md 96d1d11
  • fix: add license url 64e557e
  • fix: jest config as js file 46a3121
  • docs: update README.md 992f093
  • refactor: Remove JikanUniqueResponse in favor of JikanResponse 65647b6
  • Update README.md 5d2f5b6
  • build: bump v0.6.0 cc8e173
  • build: update .npmignore 9a79f5c

v0.5.52

26 November 2022

v0.5.5

26 November 2022

  • build: use yarn as package manager 6c4371a
  • build: Add parcel builder 57d3d33
  • chore: Add project structure and config 73596b3
  • build: use esbuild and dts-bundle-generator as package builders 52492ef
  • refactor(log): Replace Pino with tslog 408608c
  • feat: Add Axios and Pino configuration. Add API Clients. ebbd567
  • chore: Add more endpoints to the AnimeClient 878d890
  • feat: Add Anime and Manga Models 2a72c8a
  • test: Add Client test and fix found errors ed286b0
  • chore: Add more endpoints to MangaClient 25b5278
  • Initial commit dc108f8
  • chore: Add endpoints queryParams 9fb3147
  • refactor: logger configuration 09b8e2a
  • docs: update README.md 2f32fde
  • feat: Add TopClient 0435df6
  • docs: Update README.md 09359b6
  • docs: Improve docs in models 70b543b
  • build: add .npmignore f698c05
  • fix: pino imports 78ae50b
  • fix: pino imports 9c930cf
  • docs: update README.md 345c9dc
  • fix: pino imports 4339d62
  • tests: update imports 959c691
  • fix: update .gitignore 7262d66
  • build: bump v0.5.5 c9a9a9f
  • Update CHANGELOG.md 5f1ad99
  • build: bump v0.5.2 8c81a8c
  • build: bump v0.5.1 fd9f549
  • docs: Improve MangaClient docs 78de203
  • fix: Add missing index files 048acae
  • fix: optional search params in MangaClient and TopClient 09b27f1
  • build: bump0.5.42 2433c07
  • build: bump v0.5.3 c9b4a39
  • build: bump v0.5.0 329e4d0
  • build: bump typescript to v4.9.3 244f55d
  • docs: update README.md 78d90b5
  • chore: Bump v0.1.1 a793614
  • build: add builders to .npmignore c4cfbd0
  • fix: pino imports a2d53d5
  • docs: Add CHANGELOG.md 416efb7
  • Revert "build: update ts moduleResolution config" 0e52108
  • build: update ts moduleResolution config ccaa4f5
  • build: update packagae.json files 197d5f4
  • fix: tsconfig declaration 6dd43a6
  • fix: treat jest as CommonJS module ddf97e7
  • build: add .idea to npmignore 37c1ddf
  • build: add lint script c458c8d
  • docs: update README.md 53b2f1c
  • fix: esbuild configuration b42b47a
  • fix: typo in anime model ef6c8ab
  • fix: optional search params in MangaClient and TopClient 3e24a37
  • build: change ts module config 97868a4
  • fix: pino logger imports b0633bb
  • docs: update README.md 694b858
  • build: bump v0.4.0 a533194
  • build: update package name 12736d7
  • fix: missing comma a39e31b
  • fix: export TopClient 376d51b
  • fix: exporting params module 78455d4
  • docs: update README.md e265e34