AniLink - v2.0.0
    Preparing search index...

    Class AniLink

    AniLink is the public entry point for interacting with the AniList GraphQL and MyAnimeList REST APIs. A single instance composes an AniListApi (under anilist) and a MyAnimeListApi (under mal), each keeping its own credentials and transport settings.

    Index
    • Creates a new AniLink instance. The authToken parameter is optional and only required for authenticated queries and mutations; without it only public queries are available. Multiple instances can hold different authTokens, each exposing an AniListApi under anilist and a MyAnimeListApi under mal.

      Alternatively, pass a per-provider AniLinkCredentials object: each provider owns its own credentials shape, and credentials given under one key are never applied to another provider's requests.

      Parameters

      • OptionalauthToken: string | AniLinkCredentials

        The authentication token to use for AniList API requests, or a per-provider credentials object ({ anilist?: …, mal?: … }).

      • Optionaloptions: RequestOptions & Partial<Record<never, never>>

        Transport settings scoped to this instance: timeout, signal cancellation, automatic retries under the default policy (retry: false opts out), opt-in paceWithRateLimit pacing and circuitBreaker fast-fail, the onError/onRetry/onRequestStart/onResponse observability hooks, and exposeRawAxiosError debugging. Options never leak between instances. When the first argument is a credentials object, this parameter is unused (transport settings belong inside each provider's credentials).

      Returns AniLink

      const aniLink = new AniLink('authToken');

      const aniLink2 = new AniLink();

      // Per-instance transport settings:
      const tuned = new AniLink('authToken', {
      timeout: 10_000,
      retry: false, // opt out of the default retry policy
      onResponse: ({ url, durationMs }) => console.log(url, durationMs),
      });

      // Per-provider credentials (each provider keeps its own token):
      const multi = new AniLink({
      anilist: { authToken: 'anilist-token', timeout: 5_000 },
      mal: { accessToken: 'mal-token' },
      });
    anilist: AniListApi

    The AniList GraphQL API surface, a AniListApi composed from the query, mutation, custom, and helper groups.

    The MyAnimeList REST API methods, a MyAnimeListApi exposed under the mal namespace.