Skip to content
AniLink

AniList custom operations

The flexible custom AniList GraphQL operation, including its request and response contract.

Custom

anilist.custom

AniListCustom.custom runs an arbitrary GraphQL query or mutation against AniList, returning the raw response. Use it as an escape hatch when no typed operation fits: the query string is sent verbatim and the variables argument is forwarded as-is.

Signature

TypeScript
custom<T>(query: string, variables?: Record<string, unknown>, options?: RequestOptions): Promise<T>

Auth: Not required — public data. Pass a token for viewer-scoped fields.

No parameters.

See the TypeDoc page for the full any shape.

  • AniLinkApiError — non-success AniList HTTP response
  • AniLinkGraphQLError — HTTP 200 response carrying GraphQL errors
  • AniLinkNetworkError — timeout, cancellation, or transport failure

Example

TypeScript
const viewer = await aniLink.anilist.custom('query {Viewer {id}}');
const mutation = 'mutation ($about: String) {UpdateUser (about: $about) {id}}';
const variables = { about: "New about text" };
const response = await aniLink.anilist.custom(mutation, variables);

AniLink — typed AniList & MyAnimeList client for TypeScript.