Querying data
The query methods are grouped by domain. Every method takes a typed variables object and an optional trailing RequestOptions.
Selecting fields
Every query returns the maximal selection by default. Field-aware queries are those whose signature lists a fields option. They accept it in the trailing options to select fields at any nesting depth. The return type includes the requested fields and any always-selected keys. Plain-response queries such as query.markdown and query.viewer have no fields option. They always return their fixed shape:
const slim = await aniLink.anilist.query.media(
{ id: 123 },
{ fields: ["id", "title.romaji", "averageScore"] }
);
// slim: DeepPick<MediaResponse, "id" | "title.romaji" | "averageScore" | "idMal">See Field selection for the nested path rules, the always-selected id, page and mutation support, and when to use aniLink.anilist.custom() instead.
Media
| Operation | Purpose |
|---|---|
query.media | One anime or manga by id or idMal |
query.mediaTrend | Popularity/progression trends for a media |
query.airingSchedule | Airing schedule for a media |
const anime = await aniLink.anilist.query.media({ id: 21, type: "ANIME" });Characters & staff
| Operation | Purpose |
|---|---|
query.character | One character with their media |
query.staff | One staff member with their media and characters |
Studios
| Operation | Purpose |
|---|---|
query.studio | One studio with its productions |
Users
| Operation | Purpose |
|---|---|
query.user | One user by id or name |
query.viewer | The authenticated user, token required |
query.following | Users a user follows |
query.follower | Users following a user |
Lists
| Operation | Purpose |
|---|---|
query.mediaList | One list entry for a user and media |
query.mediaListCollection | A user's whole list collection, chunked |
mediaListCollection returns lists nested by status and custom list. Flatten it with flattenMediaListCollection, and walk large collections with paginateChunks.
Taxonomy
| Operation | Purpose |
|---|---|
query.genreCollection | All genres |
query.mediaTagCollection | All tags |
query.externalLinkSourceCollection | External link sources |
Activity
| Operation | Purpose |
|---|---|
query.activity | One activity |
query.activityReply | One activity reply |
query.notification | Notifications for the viewer, token required |
Community
| Operation | Purpose |
|---|---|
query.thread | One forum thread |
query.threadComment | One thread comment |
Reviews & recommendations
| Operation | Purpose |
|---|---|
query.review | One review |
query.recommendation | One recommendation |
Misc
| Operation | Purpose |
|---|---|
query.markdown | Render AniList markdown to HTML |
query.aniChartUser | AniChart settings for the viewer |
query.siteStatistics | Site-wide statistics |
Example with variables
const character = await aniLink.anilist.query.character({
id: 1,
asHtml: true,
mediaSort: ["POPULARITY_DESC"],
mediaPage: 1,
mediaPerPage: 10,
});Next steps
- Page queries, fetching a single known page.
- Pagination, collecting many pages automatically.
- Query operation reference, variables and response shapes per operation.