Skip to content

Latest commit

 

History

637 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AniLink

AniLink

npm version npm downloads License: MIT CI CodeQL Documentation

A typed TypeScript wrapper for the AniList GraphQL API and the MyAnimeList REST API. One class exposes two isolated provider namespaces. Every operation with inputs takes a single typed params object plus an optional trailing options object. Normalized errors, retries, pacing, and caching work identically on both. Import the root package for both providers, or scope imports to one provider with the anilink-api-wrapper/anilist and anilink-api-wrapper/mal subpaths.

Quickstart

npm install anilink-api-wrapper

Requires Node.js 22 or later. The package is ESM-only, so use import syntax, not CommonJS require.

import { AniLink } from "anilink-api-wrapper";

// AniList (GraphQL) needs no token for public queries
const aniLink = new AniLink();
const anime = await aniLink.anilist.query.media({ id: 21, type: "ANIME" });

// MyAnimeList (REST) has its own credential slot
const client = new AniLink({ mal: { accessToken: "mal-token" } });
const malAnime = await client.mal.anime.get(
    { id: 21 },
    { fields: ["id", "title", "main_picture"] }
);

What you can do

AniList (aniLink.anilist)

  • Queries and mutations. 25 typed queries (user, media, character, staff, studio, review, thread, and more) and 29 typed mutations covering list entries, activities, replies, reviews, threads, and favourites.
  • Page queries. 18 paginated reads under query.page (medias, characters, airingSchedules, notifications, and more). Each returns its items plus PageInfo.
  • Custom documents. custom() and customPage() send your own GraphQL documents with the same validation, transport, and caching as the built-in operations.
  • Pagination. paginate, paginatePages, and paginateChunks walk multi-page results, stopping at the server-reported last page.
  • Data helpers. fuzzyDate builds FuzzyDateInput objects for list-entry mutations, fuzzyDateInt builds the YYYYMMDD integers that query filters take, flattenMediaListCollection flattens list collections, crossLink builds AniList-to-MAL id maps from idMal, and mapExternalIds maps ids in either direction through ARM.
  • Watchers. watch.notifications and watch.activity poll AniList and yield new items as async generators.

MyAnimeList (aniLink.mal)

  • Reads. anime.get, manga.get, user.me, user.get, anime.search, manga.search, seasonal, anime.ranking, manga.ranking, suggestions, user.animeList, user.mangaList, and the forum.boards, forum.topics, and forum.topic forum reads. The fields option selects the response shape.
  • Writes. updateMyListStatus and deleteFromList on both anime and manga.
  • Pagination. paginate and paginatePages walk the paginated list endpoints.

Both namespaces share one transport layer, which handles timeouts, retries, pacing, circuit breaking, hooks, automatic token refresh, and an opt-in response cache. Each provider slot has its own credentials and transport settings.

Documentation

Docs Start here
Guides Introduction · Getting started · Provider configuration · Per-request options · Error handling · Retries & resilience · Cancellation & timeouts · Observability · Recipes · TypeScript patterns · Troubleshooting · Response cache
AniList guides Authentication · Client configuration · Querying · Page queries · Pagination · Mutations · Custom queries · Field selection · Helpers · Watchers · Complete examples
MAL guides Authentication · Client configuration · Operations · Pagination · Complete examples
Operation reference Overview · AniList catalog · MAL catalog
API reference (TypeDoc) AniLink class; the full generated reference is at the docs root

Development

npm install               # install dependencies
npm run check             # typecheck, lint, tests, format, JSDoc, api-compare, build
npm run check:fast        # typecheck, lint, and tests only
npm run docs:generate     # TypeDoc + operation reference + guides site into docs/
npm run docs:dev          # serve the guides site locally

See the contributing guide for workflow details.

Resources

License

MIT

About

API wrapper for AniManga sites such as Anilist and MyAnimeList.

Topics

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages