Constructs a new BaseOperation instance.
OptionalauthToken: RequestAuthInput
The authentication material used for API requests. A string is treated as a bearer token for backwards compatibility.
Optionaloptions: RequestOptions
Transport settings scoped to this instance (timeout, cancellation, retry policy, lifecycle hooks).
custom is a method that sends a custom query or mutation by the user.
The response follows the same unwrapping rule as every other operation:
a document with a single root field resolves to the bare field value,
while a document with multiple root fields resolves to the full
{ data } envelope. Annotate T with the shape you expect — the bare
value for single-root-field documents, or the envelope type itself when
the document selects several root fields:
const viewer = await aniLink.anilist.custom<{ id: number }>("query { Viewer { id } }");
// Multi-root-field document: T is the full envelope.
const both = await aniLink.anilist.custom<{ data: { Media: { id: number }; User: { id: number } } }>(
"query { Media (id: 1) { id } User (id: 1) { id } }"
);
The GraphQL document to execute. It must declare a query or mutation operation.
The variables for the document. This parameter is optional.
Optionaloptions: RequestOptions
Optional per-request transport settings merged over the instance-level ones for this call only.
A promise that resolves to the unwrapped response data for single-root-field documents, or the full { data } envelope otherwise.
An AniLinkValidationError when the query is empty or does not declare a query or mutation operation.
CustomRequest is a class representing a custom query or mutation by the user.
See