Skip to content
AniLink

Per-request options

Every operation accepts a trailing options argument that overrides the instance defaults for that single call.

AniList operations

AniList operations take options?: RequestOptions as their last parameter:

typescript
const media = await aniLink.anilist.query.media(
    { id: 1, type: "ANIME" },
    { timeout: 5_000, signal: controller.signal }
);

MAL operations

MAL operations take MalRequestOptions, which extends RequestOptions with the MAL fields selector:

typescript
const anime = await aniLink.mal.anime.get(21, {
    fields: ["id", "title", "main_picture"],
    timeout: 8_000,
});
OptionTypeDefaultDescription
fieldsstring | readonly string[]provider default fieldsComma-separated MAL field selector, or the same selector as an array. Shapes the response.
timeoutnumberinstance value (30000)Milliseconds before the request is aborted. 0 disables.
signalAbortSignalinstance valueSignal used to cancel the in-flight request.
retryboolean | Partial<RetryPolicy>instance policyRetry policy for this call. false opts out.
exposeRawAxiosErrorbooleanfalseAttach the raw Axios error for debugging.

Merge behavior

Per-request options are merged shallowly over the instance defaults. A partial override replaces the whole nested value for that key. For example, passing retry: { maxRetries: 1 } replaces the entire retry policy for that call. The other policy knobs fall back to the built-in defaults, not to your instance-level policy.

Provider scoping

Options never cross providers. A per-request timeout on an AniList call does not affect MAL calls, and fields exists only on MAL operations.

Next steps

AniLink — typed AniList & MyAnimeList client for TypeScript.