AniLink - v2.0.0
    Preparing search index...

    Interface MalCredentials

    MyAnimeList-specific credentials consumed by the REST provider.

    MAL authenticates with an OAuth2 access token obtained through its PKCE flow; accessToken and clientId are translated into the provider-neutral request-auth value without leaking either field into other providers' requests.

    interface MalCredentials {
        accessToken?: string;
        circuitBreaker?: { cooldownMs: number; threshold: number };
        clientId?: string;
        clientSecret?: string;
        exposeRawAxiosError?: boolean;
        onError?: OnErrorHandler;
        onRequestStart?: OnRequestStartHandler;
        onResponse?: OnResponseHandler;
        onRetry?: OnErrorHandler;
        paceWithRateLimit?: boolean;
        rateLimitFloor?: number;
        refreshToken?: string;
        retry?: boolean | Partial<RetryPolicy>;
        signal?: AbortSignal;
        timeout?: number;
        readonly [credential: string]: unknown;
    }

    Hierarchy (View Summary)

    Indexable

    • readonly [credential: string]: unknown

      Provider-specific credentials are defined by the provider implementation.

    Index
    accessToken?: string

    The MAL OAuth2 access token, kept in this provider's credential slot.

    circuitBreaker?: { cooldownMs: number; threshold: number }

    Opt into a per-client circuit breaker for sustained upstream outages: after threshold consecutive failed attempts, further requests fail fast with a CIRCUIT_OPEN_ERROR network error until cooldownMs has elapsed since the last failure, after which the next request is allowed through as a probe. Off by default; when unset, no failure accounting happens across requests.

    clientId?: string

    The MAL application client ID used by OAuth helpers.

    clientSecret?: string

    The MAL application secret, when the application requires one.

    exposeRawAxiosError?: boolean

    Attach the original Axios error to thrown errors as rawAxiosError (and cause) for local debugging. Defaults to false because raw errors can contain request configuration and bearer-token headers.

    onError?: OnErrorHandler

    Invoked when an attempt fails, and once more when retries are exhausted.

    onRequestStart?: OnRequestStartHandler

    Invoked just before each attempt is sent.

    onResponse?: OnResponseHandler

    Invoked after each attempt completes with the elapsed durationMs.

    onRetry?: OnErrorHandler

    Invoked before each retry wait with the scheduled delay in nextDelayMs. Falls back to per-attempt onError calls when unset.

    paceWithRateLimit?: boolean

    Opt into proactive request pacing driven by the x-ratelimit-* headers of every successful response: when the reported remaining quota drops below rateLimitFloor (default 1), the next attempt waits until the window resets instead of discovering the limit via a 429. Off by default.

    rateLimitFloor?: number

    Remaining-quota threshold below which RequestOptions.paceWithRateLimit delays the next request until the window resets. Defaults to 1.

    refreshToken?: string

    The MAL OAuth2 refresh token used to obtain a new access token.

    retry?: boolean | Partial<RetryPolicy>

    Automatic retries for transient failures. Defaults to the built-in policy (maxRetries: 3, jittered exponential backoff over HTTP 429 and 5xx responses plus network and timeout errors). Pass false to opt out and send every request exactly once, or pass a partial policy to tune individual knobs on top of the defaults.

    signal?: AbortSignal

    Signal used to cancel in-flight requests.

    timeout?: number

    Milliseconds before a request is aborted. 0 disables the Axios timeout. Defaults to DEFAULT_REQUEST_TIMEOUT; timeout errors carry the effective duration as AniLinkNetworkError.timeoutMs.