anilink-api-wrapper 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -484
- package/dist/AniLink.d.ts +1656 -724
- package/dist/AniLink.mjs +1005 -371
- package/dist/mal.d.ts +1 -0
- package/dist/mal.mjs +5 -0
- package/package.json +28 -18
package/dist/AniLink.mjs
CHANGED
|
@@ -15,6 +15,7 @@ const AniLinkErrorCodes = {
|
|
|
15
15
|
UNKNOWN: "UNKNOWN_ERROR"
|
|
16
16
|
};
|
|
17
17
|
class AniLinkError extends Error {
|
|
18
|
+
/** Stable code used to classify the failure. */
|
|
18
19
|
code;
|
|
19
20
|
/**
|
|
20
21
|
* Creates a sanitized AniLink error.
|
|
@@ -34,7 +35,9 @@ class AniLinkError extends Error {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
class AniLinkApiError extends AniLinkError {
|
|
38
|
+
/** HTTP status returned by the upstream API. For GraphQL failures this is the upstream GraphQL error status when available, and the HTTP envelope status (`200`) otherwise. */
|
|
37
39
|
status;
|
|
40
|
+
/** Response body returned by the upstream API, preserved verbatim. */
|
|
38
41
|
data;
|
|
39
42
|
/**
|
|
40
43
|
* Creates an API error while preserving the upstream response body.
|
|
@@ -54,6 +57,15 @@ class AniLinkApiError extends AniLinkError {
|
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
}
|
|
60
|
+
const extractUpstreamStatus = (errors) => {
|
|
61
|
+
for (const entry of errors) {
|
|
62
|
+
const status = entry.status;
|
|
63
|
+
if (typeof status === "number" && Number.isFinite(status)) {
|
|
64
|
+
return status;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return void 0;
|
|
68
|
+
};
|
|
57
69
|
class AniLinkGraphQLError extends AniLinkApiError {
|
|
58
70
|
/**
|
|
59
71
|
* The upstream GraphQL `errors` array carried by the envelope, preserved
|
|
@@ -70,7 +82,7 @@ class AniLinkGraphQLError extends AniLinkApiError {
|
|
|
70
82
|
* @param rawAxiosError - The original Axios error when raw diagnostics are enabled.
|
|
71
83
|
*/
|
|
72
84
|
constructor(errors, data, rawAxiosError) {
|
|
73
|
-
super(200, data, rawAxiosError);
|
|
85
|
+
super(extractUpstreamStatus(errors) ?? 200, data, rawAxiosError);
|
|
74
86
|
this.name = "AniLinkGraphQLError";
|
|
75
87
|
this.code = AniLinkErrorCodes.GRAPHQL;
|
|
76
88
|
this.message = `The request failed with GraphQL errors: ${errors.map((graphqlError) => graphqlError.message).join("; ")}`;
|
|
@@ -95,7 +107,7 @@ class AniLinkAuthError extends AniLinkError {
|
|
|
95
107
|
}
|
|
96
108
|
}
|
|
97
109
|
class AniLinkValidationError extends AniLinkError {
|
|
98
|
-
/**
|
|
110
|
+
/** Individual validation problems, one per entry. */
|
|
99
111
|
details;
|
|
100
112
|
/**
|
|
101
113
|
* Creates a validation error for invalid operation variables.
|
|
@@ -113,6 +125,18 @@ ${details.join("\n")}`,
|
|
|
113
125
|
}
|
|
114
126
|
}
|
|
115
127
|
class AniLinkRestError extends AniLinkApiError {
|
|
128
|
+
/**
|
|
129
|
+
* Creates a REST error carrying the upstream HTTP status and body.
|
|
130
|
+
*
|
|
131
|
+
* @param status - The HTTP status returned by the upstream REST API.
|
|
132
|
+
* @param data - The response body returned by the upstream REST API.
|
|
133
|
+
* @param rawAxiosError - The original Axios error when raw diagnostics are enabled.
|
|
134
|
+
* @param options - Additional error metadata such as rate-limit headers.
|
|
135
|
+
*/
|
|
136
|
+
constructor(status, data, rawAxiosError, options) {
|
|
137
|
+
super(status, data, rawAxiosError, options);
|
|
138
|
+
this.name = "AniLinkRestError";
|
|
139
|
+
}
|
|
116
140
|
}
|
|
117
141
|
class AniLinkNetworkError extends AniLinkError {
|
|
118
142
|
/**
|
|
@@ -144,20 +168,22 @@ const DEFAULT_RETRY_POLICY = {
|
|
|
144
168
|
retryOnNetworkError: true,
|
|
145
169
|
jitter: true
|
|
146
170
|
};
|
|
171
|
+
const defaultHttpAgent = new http.Agent({
|
|
172
|
+
keepAlive: true,
|
|
173
|
+
maxSockets: MAX_SOCKETS,
|
|
174
|
+
maxFreeSockets: MAX_FREE_SOCKETS,
|
|
175
|
+
scheduling: "lifo"
|
|
176
|
+
});
|
|
177
|
+
const defaultHttpsAgent = new https.Agent({
|
|
178
|
+
keepAlive: true,
|
|
179
|
+
maxSockets: MAX_SOCKETS,
|
|
180
|
+
maxFreeSockets: MAX_FREE_SOCKETS,
|
|
181
|
+
scheduling: "lifo"
|
|
182
|
+
});
|
|
147
183
|
const axiosClient = axios.create({
|
|
148
184
|
timeout: DEFAULT_REQUEST_TIMEOUT,
|
|
149
|
-
httpAgent:
|
|
150
|
-
|
|
151
|
-
maxSockets: MAX_SOCKETS,
|
|
152
|
-
maxFreeSockets: MAX_FREE_SOCKETS,
|
|
153
|
-
scheduling: "lifo"
|
|
154
|
-
}),
|
|
155
|
-
httpsAgent: new https.Agent({
|
|
156
|
-
keepAlive: true,
|
|
157
|
-
maxSockets: MAX_SOCKETS,
|
|
158
|
-
maxFreeSockets: MAX_FREE_SOCKETS,
|
|
159
|
-
scheduling: "lifo"
|
|
160
|
-
})
|
|
185
|
+
httpAgent: defaultHttpAgent,
|
|
186
|
+
httpsAgent: defaultHttpsAgent
|
|
161
187
|
});
|
|
162
188
|
const resolveRetryPolicy = (retry) => {
|
|
163
189
|
if (retry === false) {
|
|
@@ -168,19 +194,40 @@ const resolveRetryPolicy = (retry) => {
|
|
|
168
194
|
}
|
|
169
195
|
return { ...DEFAULT_RETRY_POLICY, ...retry };
|
|
170
196
|
};
|
|
197
|
+
const resolveAgents = (maxSockets, maxFreeSockets) => {
|
|
198
|
+
if (maxSockets === void 0 && maxFreeSockets === void 0) {
|
|
199
|
+
return { httpAgent: defaultHttpAgent, httpsAgent: defaultHttpsAgent };
|
|
200
|
+
}
|
|
201
|
+
const sockets = Math.max(1, maxSockets ?? MAX_SOCKETS);
|
|
202
|
+
const freeSockets = Math.max(0, maxFreeSockets ?? MAX_FREE_SOCKETS);
|
|
203
|
+
const agentOptions = {
|
|
204
|
+
keepAlive: true,
|
|
205
|
+
maxSockets: sockets,
|
|
206
|
+
maxFreeSockets: freeSockets,
|
|
207
|
+
scheduling: "lifo"
|
|
208
|
+
};
|
|
209
|
+
return {
|
|
210
|
+
httpAgent: new http.Agent(agentOptions),
|
|
211
|
+
httpsAgent: new https.Agent(agentOptions)
|
|
212
|
+
};
|
|
213
|
+
};
|
|
171
214
|
const resolveRequestOptions = (options = {}) => {
|
|
172
215
|
const timeout = options.timeout ?? DEFAULT_REQUEST_TIMEOUT;
|
|
173
216
|
if (!Number.isFinite(timeout) || timeout < 0) {
|
|
174
217
|
throw new TypeError("timeout must be a finite number greater than or equal to 0");
|
|
175
218
|
}
|
|
219
|
+
const agents = resolveAgents(options.maxSockets, options.maxFreeSockets);
|
|
176
220
|
return {
|
|
177
221
|
timeout,
|
|
178
222
|
signal: options.signal,
|
|
179
223
|
exposeRawAxiosError: options.exposeRawAxiosError ?? false,
|
|
180
224
|
retry: resolveRetryPolicy(options.retry),
|
|
181
|
-
paceWithRateLimit: options.paceWithRateLimit ??
|
|
225
|
+
paceWithRateLimit: options.paceWithRateLimit ?? true,
|
|
182
226
|
rateLimitFloor: Math.max(1, options.rateLimitFloor ?? 1),
|
|
183
227
|
circuitBreaker: options.circuitBreaker,
|
|
228
|
+
retryBudget: options.retryBudget,
|
|
229
|
+
httpAgent: agents.httpAgent,
|
|
230
|
+
httpsAgent: agents.httpsAgent,
|
|
184
231
|
onError: options.onError,
|
|
185
232
|
onRetry: options.onRetry,
|
|
186
233
|
onRequestStart: options.onRequestStart,
|
|
@@ -219,7 +266,7 @@ const getRateLimitInfo = (headers) => {
|
|
|
219
266
|
}
|
|
220
267
|
return { limit, remaining, reset };
|
|
221
268
|
};
|
|
222
|
-
const normalizeAxiosError = (resolved, error) => {
|
|
269
|
+
const normalizeAxiosError = (resolved, error, isRestCall = false) => {
|
|
223
270
|
if (axios.isCancel(error)) {
|
|
224
271
|
return new AniLinkNetworkError(
|
|
225
272
|
AniLinkErrorCodes.ABORTED,
|
|
@@ -228,12 +275,11 @@ const normalizeAxiosError = (resolved, error) => {
|
|
|
228
275
|
);
|
|
229
276
|
}
|
|
230
277
|
if (error.response?.status !== void 0) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
);
|
|
278
|
+
const status = error.response.status;
|
|
279
|
+
const data = error.response.data;
|
|
280
|
+
const rawAxiosError = getRawAxiosError(resolved, error);
|
|
281
|
+
const options = { rateLimit: getRateLimitInfo(error.response.headers) };
|
|
282
|
+
return isRestCall ? new AniLinkRestError(status, data, rawAxiosError, options) : new AniLinkApiError(status, data, rawAxiosError, options);
|
|
237
283
|
}
|
|
238
284
|
if (error.code === "ECONNABORTED" || error.code === "ETIMEDOUT") {
|
|
239
285
|
return new AniLinkNetworkError(
|
|
@@ -249,12 +295,12 @@ const normalizeAxiosError = (resolved, error) => {
|
|
|
249
295
|
getRawAxiosError(resolved, error)
|
|
250
296
|
);
|
|
251
297
|
};
|
|
252
|
-
const normalizeRequestError = (resolved, error) => {
|
|
298
|
+
const normalizeRequestError = (resolved, error, isRestCall = false) => {
|
|
253
299
|
if (error instanceof AniLinkError) {
|
|
254
300
|
return error;
|
|
255
301
|
}
|
|
256
302
|
if (axios.isAxiosError(error)) {
|
|
257
|
-
return normalizeAxiosError(resolved, error);
|
|
303
|
+
return normalizeAxiosError(resolved, error, isRestCall);
|
|
258
304
|
}
|
|
259
305
|
return new AniLinkError(
|
|
260
306
|
"The request failed.",
|
|
@@ -341,6 +387,22 @@ const safeInvoke = (hook, name, ...args) => {
|
|
|
341
387
|
}
|
|
342
388
|
};
|
|
343
389
|
const circuitStates = /* @__PURE__ */ new WeakMap();
|
|
390
|
+
const retryBudgetStates = /* @__PURE__ */ new WeakMap();
|
|
391
|
+
const getRetryBudgetState = (owner, budget) => {
|
|
392
|
+
if (owner === void 0 || budget === void 0) {
|
|
393
|
+
return void 0;
|
|
394
|
+
}
|
|
395
|
+
let state = retryBudgetStates.get(owner);
|
|
396
|
+
if (state === void 0) {
|
|
397
|
+
state = { retriesUsed: 0, windowEndsAt: 0 };
|
|
398
|
+
retryBudgetStates.set(owner, state);
|
|
399
|
+
}
|
|
400
|
+
if (Date.now() >= state.windowEndsAt) {
|
|
401
|
+
state.retriesUsed = 0;
|
|
402
|
+
state.windowEndsAt = Date.now() + budget.windowMs;
|
|
403
|
+
}
|
|
404
|
+
return state;
|
|
405
|
+
};
|
|
344
406
|
const circuitScopeOf = (url) => {
|
|
345
407
|
try {
|
|
346
408
|
return new URL(url).host;
|
|
@@ -427,6 +489,7 @@ const executeWithRetry = async (options, resolved, stateKey, rawPassthrough = fa
|
|
|
427
489
|
const { url, method, data, headers } = options;
|
|
428
490
|
const policy = resolved.retry;
|
|
429
491
|
const circuit = resolved.circuitBreaker !== void 0 && stateKey !== void 0 ? getCircuitState(stateKey, circuitScopeOf(url)) : void 0;
|
|
492
|
+
const budgetState = getRetryBudgetState(stateKey, resolved.retryBudget);
|
|
430
493
|
let attempt = 0;
|
|
431
494
|
for (; ; ) {
|
|
432
495
|
throwIfCircuitOpen(circuit, resolved.circuitBreaker);
|
|
@@ -440,7 +503,9 @@ const executeWithRetry = async (options, resolved, stateKey, rawPassthrough = fa
|
|
|
440
503
|
data,
|
|
441
504
|
headers,
|
|
442
505
|
timeout: resolved.timeout,
|
|
443
|
-
signal: resolved.signal
|
|
506
|
+
signal: resolved.signal,
|
|
507
|
+
httpAgent: resolved.httpAgent,
|
|
508
|
+
httpsAgent: resolved.httpsAgent
|
|
444
509
|
});
|
|
445
510
|
safeInvoke(resolved.onResponse, "onResponse", {
|
|
446
511
|
...hookContext,
|
|
@@ -455,9 +520,12 @@ const executeWithRetry = async (options, resolved, stateKey, rawPassthrough = fa
|
|
|
455
520
|
...hookContext,
|
|
456
521
|
durationMs: Date.now() - startedAt
|
|
457
522
|
});
|
|
458
|
-
const normalized = normalizeRequestError(resolved, error);
|
|
523
|
+
const normalized = normalizeRequestError(resolved, error, rawPassthrough);
|
|
459
524
|
recordCircuitFailure(circuit, resolved.circuitBreaker);
|
|
460
|
-
const delay = policy === null ? null : getRetryDelay(normalized, error, attempt, policy);
|
|
525
|
+
const delay = policy === null || budgetState === void 0 ? policy === null ? null : getRetryDelay(normalized, error, attempt, policy) : budgetState.retriesUsed >= resolved.retryBudget.maxRetriesPerWindow ? null : getRetryDelay(normalized, error, attempt, policy);
|
|
526
|
+
if (delay !== null && budgetState !== void 0) {
|
|
527
|
+
budgetState.retriesUsed += 1;
|
|
528
|
+
}
|
|
461
529
|
reportFailure(url, method, attempt + 1, normalized, resolved, delay ?? void 0);
|
|
462
530
|
if (delay === null) {
|
|
463
531
|
throw normalized;
|
|
@@ -467,16 +535,24 @@ const executeWithRetry = async (options, resolved, stateKey, rawPassthrough = fa
|
|
|
467
535
|
}
|
|
468
536
|
}
|
|
469
537
|
};
|
|
470
|
-
const sendRequest = async (url, method, data,
|
|
471
|
-
|
|
538
|
+
const sendRequest = async (url, method, data, auth, ...requestOptions) => {
|
|
539
|
+
const [requiresAuth = false, options, operation, contentType] = requestOptions;
|
|
540
|
+
const resolvedAuth = typeof auth === "string" ? { token: auth } : auth;
|
|
541
|
+
const hasBearerToken = resolvedAuth?.token !== void 0 && resolvedAuth.token !== "";
|
|
542
|
+
const hasAuthorizationHeader = Object.entries(resolvedAuth?.headers ?? {}).some(
|
|
543
|
+
([key, value]) => key.toLowerCase() === "authorization" && value !== ""
|
|
544
|
+
);
|
|
545
|
+
const hasAuthMaterial = hasBearerToken || hasAuthorizationHeader;
|
|
546
|
+
if (requiresAuth && !hasAuthMaterial) {
|
|
472
547
|
throw new AniLinkAuthError(operation);
|
|
473
548
|
}
|
|
474
549
|
const headers = contentType === void 0 ? {
|
|
475
550
|
"Content-Type": "application/json",
|
|
476
551
|
Accept: "application/json"
|
|
477
552
|
} : { "Content-Type": contentType };
|
|
478
|
-
|
|
479
|
-
|
|
553
|
+
Object.assign(headers, resolvedAuth?.headers);
|
|
554
|
+
if (hasBearerToken && !hasAuthorizationHeader) {
|
|
555
|
+
headers.Authorization = `Bearer ${resolvedAuth.token}`;
|
|
480
556
|
}
|
|
481
557
|
const result = await executeWithRetry(
|
|
482
558
|
{ url, method, data, headers },
|
|
@@ -500,7 +576,7 @@ class BaseOperation {
|
|
|
500
576
|
/**
|
|
501
577
|
* The authentication token shared by all operations of an instance.
|
|
502
578
|
*/
|
|
503
|
-
|
|
579
|
+
requestAuth;
|
|
504
580
|
/**
|
|
505
581
|
* The transport settings resolved at construction time.
|
|
506
582
|
*/
|
|
@@ -508,21 +584,33 @@ class BaseOperation {
|
|
|
508
584
|
/**
|
|
509
585
|
* Constructs a new `BaseOperation` instance.
|
|
510
586
|
*
|
|
511
|
-
* @param authToken - The authentication
|
|
587
|
+
* @param authToken - The authentication material used for API requests. A string is treated as a bearer token for backwards compatibility.
|
|
512
588
|
* @param options - Transport settings scoped to this instance (timeout, cancellation, retry policy, lifecycle hooks).
|
|
513
589
|
*/
|
|
514
590
|
constructor(authToken, options) {
|
|
515
|
-
this.
|
|
591
|
+
this.requestAuth = authToken;
|
|
516
592
|
this.resolvedOptions = options;
|
|
517
593
|
}
|
|
518
594
|
/**
|
|
519
595
|
* The instance authentication token, readable by protocol subclasses.
|
|
596
|
+
*
|
|
597
|
+
* @returns The bearer token from {@link RequestAuthInput}, or `undefined`.
|
|
520
598
|
*/
|
|
521
599
|
get token() {
|
|
522
|
-
return this.
|
|
600
|
+
return typeof this.requestAuth === "string" ? this.requestAuth : this.requestAuth?.token;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* The provider-specific authentication material, readable by protocol subclasses.
|
|
604
|
+
*
|
|
605
|
+
* @returns The configured {@link RequestAuthInput}, or `undefined`.
|
|
606
|
+
*/
|
|
607
|
+
get auth() {
|
|
608
|
+
return this.requestAuth;
|
|
523
609
|
}
|
|
524
610
|
/**
|
|
525
611
|
* The instance transport settings, readable by protocol subclasses.
|
|
612
|
+
*
|
|
613
|
+
* @returns The configured {@link RequestOptions}, or `undefined`.
|
|
526
614
|
*/
|
|
527
615
|
get instanceOptions() {
|
|
528
616
|
return this.resolvedOptions;
|
|
@@ -544,14 +632,14 @@ class BaseOperation {
|
|
|
544
632
|
* @param transportOptions - Optional per-request transport settings merged over the instance-level ones. A field set here wins; unset fields keep the instance value.
|
|
545
633
|
* @param contentType - Optional `Content-Type` override. When provided, the response body is returned verbatim instead of being unwrapped as a GraphQL envelope.
|
|
546
634
|
* @returns Whatever the shared pipeline resolves for the call.
|
|
547
|
-
* @throws An
|
|
635
|
+
* @throws An {@link AniLinkAuthError} when `requiresAuth` is true and no token is set, or a normalized {@link AniLinkError} when the request fails.
|
|
548
636
|
*/
|
|
549
637
|
async dispatch(url, method, data, requiresAuth = false, operation, transportOptions, contentType) {
|
|
550
638
|
return await sendRequest(
|
|
551
639
|
url,
|
|
552
640
|
method,
|
|
553
641
|
data,
|
|
554
|
-
this.
|
|
642
|
+
this.requestAuth,
|
|
555
643
|
requiresAuth || void 0,
|
|
556
644
|
mergeOptions(this.resolvedOptions, transportOptions),
|
|
557
645
|
operation ?? resolveOperationLabel(this),
|
|
@@ -690,7 +778,7 @@ class GraphQLOperation extends BaseOperation {
|
|
|
690
778
|
* @param operation - Optional human-readable operation name included in missing-token auth errors. Defaults to the concrete operation class name.
|
|
691
779
|
* @param transportOptions - Optional per-request transport settings merged over the instance-level ones. A field set here wins; unset fields keep the instance value.
|
|
692
780
|
* @returns The unwrapped response data. For documents with a single root field this is the bare field value; otherwise it is the full `{ data }` envelope.
|
|
693
|
-
* @throws An
|
|
781
|
+
* @throws An {@link AniLinkAuthError} when `requiresAuth` is true and no token is set, or a normalized {@link AniLinkError} when the request fails.
|
|
694
782
|
*/
|
|
695
783
|
async request(query, variables, requiresAuth = false, operation, transportOptions) {
|
|
696
784
|
const data = variables === void 0 ? { query } : { query, variables };
|
|
@@ -717,7 +805,7 @@ class GraphQLOperation extends BaseOperation {
|
|
|
717
805
|
* @param options - The declarative validation and auth contract.
|
|
718
806
|
* @returns The unwrapped response data, as described by {@link GraphQLOperation.request}.
|
|
719
807
|
* @throws An {@link AniLinkValidationError} when a requirement or type check
|
|
720
|
-
* fails, or a normalized
|
|
808
|
+
* fails, or a normalized {@link AniLinkError} when the request fails.
|
|
721
809
|
*/
|
|
722
810
|
async execute(query, variables, options) {
|
|
723
811
|
const { requirements, mappings, requiresAuth, transportOptions } = options;
|
|
@@ -766,8 +854,8 @@ class CustomRequest extends AniListOperation {
|
|
|
766
854
|
* @param variables - The variables for the document. This parameter is optional.
|
|
767
855
|
* @param options - Optional per-request transport settings merged over the instance-level ones for this call only.
|
|
768
856
|
* @returns A promise that resolves to the unwrapped response data for single-root-field documents, or the full `{ data }` envelope otherwise.
|
|
769
|
-
* @throws An
|
|
770
|
-
* @throws An `AniLinkError` when the request fails.
|
|
857
|
+
* @throws An {@link AniLinkValidationError} when the query is empty or does not declare a `query` or `mutation` operation.
|
|
858
|
+
* @throws An `AniLinkError` when the request fails. When AniList returns partial success (some fields resolve while others fail inside an HTTP 200 envelope), the thrown {@link AniLinkGraphQLError} exposes the resolved portion via its `partialData` field, so the fields that did resolve remain recoverable from the error.
|
|
771
859
|
* @see https://docs.anilist.co/reference/query
|
|
772
860
|
* @see https://docs.anilist.co/reference/mutation
|
|
773
861
|
*/
|
|
@@ -1635,12 +1723,16 @@ const ActivityMappings = {
|
|
|
1635
1723
|
};
|
|
1636
1724
|
class ActivityQuery extends AniListOperation {
|
|
1637
1725
|
/**
|
|
1638
|
-
*
|
|
1726
|
+
* {@link ActivityQuery.activity} sends a query request to get activities.
|
|
1639
1727
|
*
|
|
1640
|
-
* @param variables -
|
|
1641
|
-
* @returns The
|
|
1728
|
+
* @param variables - Values from {@link ActivityVariables} for the query.
|
|
1729
|
+
* @returns The {@link Activity} returned by the query.
|
|
1642
1730
|
* @see https://docs.anilist.co/reference/union/activityunion
|
|
1643
|
-
* @param options - Optional
|
|
1731
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
1732
|
+
* @example
|
|
1733
|
+
* ```typescript
|
|
1734
|
+
* const result = await new ActivityQuery().activity({ userId: 1 });
|
|
1735
|
+
* ```
|
|
1644
1736
|
*/
|
|
1645
1737
|
async activity(variables, options) {
|
|
1646
1738
|
const query = `
|
|
@@ -1671,12 +1763,16 @@ const ActivityReplyMappings = {
|
|
|
1671
1763
|
};
|
|
1672
1764
|
class ActivityReplyQuery extends AniListOperation {
|
|
1673
1765
|
/**
|
|
1674
|
-
*
|
|
1766
|
+
* {@link ActivityReplyQuery.activityReply} sends a query request to get activity replies.
|
|
1675
1767
|
*
|
|
1676
|
-
* @param variables -
|
|
1677
|
-
* @returns The
|
|
1768
|
+
* @param variables - Values from {@link ActivityReplyVariables} for the query.
|
|
1769
|
+
* @returns The {@link ActivityReply} returned by the query.
|
|
1678
1770
|
* @see https://docs.anilist.co/reference/object/activityreply
|
|
1679
|
-
* @param options - Optional
|
|
1771
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
1772
|
+
* @example
|
|
1773
|
+
* ```typescript
|
|
1774
|
+
* const result = await new ActivityReplyQuery().activityReply({ activityId: 1 });
|
|
1775
|
+
* ```
|
|
1680
1776
|
*/
|
|
1681
1777
|
async activityReply(variables, options) {
|
|
1682
1778
|
const query = `
|
|
@@ -1711,10 +1807,14 @@ class ActivityRepliesQuery extends AniListOperation {
|
|
|
1711
1807
|
/**
|
|
1712
1808
|
* `activityReplies` is a method that sends a query request to get activity replies.
|
|
1713
1809
|
*
|
|
1714
|
-
* @param variables -
|
|
1715
|
-
* @returns The
|
|
1810
|
+
* @param variables - Values from {@link ActivityRepliesVariables} for the query.
|
|
1811
|
+
* @returns The {@link ActivityRepliesPageResponse} for the requested page, with pagination metadata.
|
|
1716
1812
|
* @see https://docs.anilist.co/reference/object/activityreply
|
|
1717
|
-
* @param options - Optional
|
|
1813
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
1814
|
+
* @example
|
|
1815
|
+
* ```typescript
|
|
1816
|
+
* const result = await new ActivityRepliesQuery().activityReplies({ page: 1, perPage: 10 });
|
|
1817
|
+
* ```
|
|
1718
1818
|
*/
|
|
1719
1819
|
async activityReplies(variables, options) {
|
|
1720
1820
|
const query = `
|
|
@@ -1775,10 +1875,14 @@ class ActivitiesQuery extends AniListOperation {
|
|
|
1775
1875
|
/**
|
|
1776
1876
|
* `activities` is a method that sends a query request to get activities.
|
|
1777
1877
|
*
|
|
1778
|
-
* @param variables -
|
|
1779
|
-
* @returns The
|
|
1878
|
+
* @param variables - Values from {@link ActivitiesVariables} for the query.
|
|
1879
|
+
* @returns The {@link ActivitiesPageResponse} for the requested page, with pagination metadata.
|
|
1780
1880
|
* @see https://docs.anilist.co/reference/union/activityunion
|
|
1781
|
-
* @param options - Optional
|
|
1881
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
1882
|
+
* @example
|
|
1883
|
+
* ```typescript
|
|
1884
|
+
* const result = await new ActivitiesQuery().activities({ page: 1, perPage: 10 });
|
|
1885
|
+
* ```
|
|
1782
1886
|
*/
|
|
1783
1887
|
async activities(variables, options) {
|
|
1784
1888
|
const query = `
|
|
@@ -2142,12 +2246,16 @@ const AiringScheduleMappings = {
|
|
|
2142
2246
|
};
|
|
2143
2247
|
class AiringScheduleQuery extends AniListOperation {
|
|
2144
2248
|
/**
|
|
2145
|
-
*
|
|
2249
|
+
* {@link AiringScheduleQuery.airingSchedule} sends a query request to get airing schedules.
|
|
2146
2250
|
*
|
|
2147
|
-
* @param variables -
|
|
2148
|
-
* @returns The
|
|
2251
|
+
* @param variables - Values from {@link AiringScheduleVariables} for the query.
|
|
2252
|
+
* @returns The {@link AiringScheduleResponse} returned by the query.
|
|
2149
2253
|
* @see https://docs.anilist.co/reference/object/airingschedule
|
|
2150
|
-
* @param options - Optional
|
|
2254
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
2255
|
+
* @example
|
|
2256
|
+
* ```typescript
|
|
2257
|
+
* const result = await new AiringScheduleQuery().airingSchedule({ mediaId: 1 });
|
|
2258
|
+
* ```
|
|
2151
2259
|
*/
|
|
2152
2260
|
async airingSchedule(variables, options) {
|
|
2153
2261
|
const query = `
|
|
@@ -2199,10 +2307,14 @@ class AiringSchedulesQuery extends AniListOperation {
|
|
|
2199
2307
|
/**
|
|
2200
2308
|
* `airingSchedules` is a method that sends a query request to get airing schedules.
|
|
2201
2309
|
*
|
|
2202
|
-
* @param variables -
|
|
2203
|
-
* @returns The
|
|
2310
|
+
* @param variables - Values from {@link AiringSchedulesVariables} for the query.
|
|
2311
|
+
* @returns The {@link AiringSchedulesPageResponse} returned by the query.
|
|
2204
2312
|
* @see https://docs.anilist.co/reference/object/airingschedule
|
|
2205
|
-
* @param options - Optional
|
|
2313
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
2314
|
+
* @example
|
|
2315
|
+
* ```typescript
|
|
2316
|
+
* const result = await new AiringSchedulesQuery().airingSchedules({ page: 1, perPage: 10 });
|
|
2317
|
+
* ```
|
|
2206
2318
|
*/
|
|
2207
2319
|
async airingSchedules(variables, options) {
|
|
2208
2320
|
const query = `
|
|
@@ -2230,11 +2342,15 @@ class AiringSchedulesQuery extends AniListOperation {
|
|
|
2230
2342
|
|
|
2231
2343
|
class AniChartUserQuery extends AniListOperation {
|
|
2232
2344
|
/**
|
|
2233
|
-
*
|
|
2345
|
+
* {@link AniChartUserQuery.aniChartUser} sends a query request to get AniChart users.
|
|
2234
2346
|
*
|
|
2235
|
-
* @returns The
|
|
2347
|
+
* @returns The {@link AniChartUserResponse} returned by the query.
|
|
2236
2348
|
* @see https://docs.anilist.co/reference/object/anichartuser
|
|
2237
|
-
* @param options - Optional
|
|
2349
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
2350
|
+
* @example
|
|
2351
|
+
* ```typescript
|
|
2352
|
+
* const result = await new AniChartUserQuery("authToken").aniChartUser();
|
|
2353
|
+
* ```
|
|
2238
2354
|
*/
|
|
2239
2355
|
async aniChartUser(options) {
|
|
2240
2356
|
const query = `
|
|
@@ -2295,12 +2411,16 @@ const CharacterMappings = {
|
|
|
2295
2411
|
};
|
|
2296
2412
|
class CharacterQuery extends AniListOperation {
|
|
2297
2413
|
/**
|
|
2298
|
-
*
|
|
2414
|
+
* {@link CharacterQuery.character} sends a query request to get characters.
|
|
2299
2415
|
*
|
|
2300
|
-
* @param variables -
|
|
2301
|
-
* @returns The
|
|
2416
|
+
* @param variables - Values from {@link CharacterVariables} for the query.
|
|
2417
|
+
* @returns The {@link CharacterResponse} returned by the query.
|
|
2302
2418
|
* @see https://docs.anilist.co/reference/object/character
|
|
2303
|
-
* @param options - Optional
|
|
2419
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
2420
|
+
* @example
|
|
2421
|
+
* ```typescript
|
|
2422
|
+
* const result = await new CharacterQuery().character({ id: 1 });
|
|
2423
|
+
* ```
|
|
2304
2424
|
*/
|
|
2305
2425
|
async character(variables, options) {
|
|
2306
2426
|
const query = `
|
|
@@ -2337,10 +2457,14 @@ class CharactersQuery extends AniListOperation {
|
|
|
2337
2457
|
/**
|
|
2338
2458
|
* `characters` is a method that sends a query request to get characters.
|
|
2339
2459
|
*
|
|
2340
|
-
* @param variables -
|
|
2341
|
-
* @returns The
|
|
2460
|
+
* @param variables - Values from {@link CharactersVariables} for the query.
|
|
2461
|
+
* @returns The {@link CharactersPageResponse} returned by the query.
|
|
2342
2462
|
* @see https://docs.anilist.co/reference/object/character
|
|
2343
|
-
* @param options - Optional
|
|
2463
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
2464
|
+
* @example
|
|
2465
|
+
* ```typescript
|
|
2466
|
+
* const result = await new CharactersQuery().characters({ page: 1, perPage: 10 });
|
|
2467
|
+
* ```
|
|
2344
2468
|
*/
|
|
2345
2469
|
async characters(variables, options) {
|
|
2346
2470
|
const query = `
|
|
@@ -2400,12 +2524,16 @@ const ExternalLinkSourceCollectionMappings = {
|
|
|
2400
2524
|
};
|
|
2401
2525
|
class ExternalLinkSourceCollectionQuery extends AniListOperation {
|
|
2402
2526
|
/**
|
|
2403
|
-
*
|
|
2527
|
+
* {@link ExternalLinkSourceCollectionQuery.externalLinkSourceCollection} sends a query request to get external link source collections.
|
|
2404
2528
|
*
|
|
2405
|
-
* @param variables -
|
|
2406
|
-
* @returns The
|
|
2529
|
+
* @param variables - Optional values from {@link ExternalLinkSourceCollectionVariables}; defaults to an empty object.
|
|
2530
|
+
* @returns The {@link ExternalLinkSourceCollectionResponse} returned by the query.
|
|
2407
2531
|
* @see https://docs.anilist.co/reference/query
|
|
2408
|
-
* @param options - Optional
|
|
2532
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
2533
|
+
* @example
|
|
2534
|
+
* ```typescript
|
|
2535
|
+
* const result = await new ExternalLinkSourceCollectionQuery().externalLinkSourceCollection({});
|
|
2536
|
+
* ```
|
|
2409
2537
|
*/
|
|
2410
2538
|
async externalLinkSourceCollection(variables = {}, options) {
|
|
2411
2539
|
const query = `
|
|
@@ -2818,12 +2946,16 @@ const FollowerMappings = {
|
|
|
2818
2946
|
};
|
|
2819
2947
|
class FollowerQuery extends AniListOperation {
|
|
2820
2948
|
/**
|
|
2821
|
-
*
|
|
2949
|
+
* {@link FollowerQuery.follower} sends a query request to get followers.
|
|
2822
2950
|
*
|
|
2823
|
-
* @param variables -
|
|
2824
|
-
* @returns The
|
|
2951
|
+
* @param variables - Values from {@link FollowerVariables} for the query.
|
|
2952
|
+
* @returns The {@link UserResponse} returned by the query.
|
|
2825
2953
|
* @see https://docs.anilist.co/reference/object/user
|
|
2826
|
-
* @param options - Optional
|
|
2954
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
2955
|
+
* @example
|
|
2956
|
+
* ```typescript
|
|
2957
|
+
* const result = await new FollowerQuery().follower({ userId: 1 });
|
|
2958
|
+
* ```
|
|
2827
2959
|
*/
|
|
2828
2960
|
async follower(variables, options) {
|
|
2829
2961
|
const query = `
|
|
@@ -2862,10 +2994,14 @@ class FollowersQuery extends AniListOperation {
|
|
|
2862
2994
|
/**
|
|
2863
2995
|
* `followers` is a method that sends a query request to get followers.
|
|
2864
2996
|
*
|
|
2865
|
-
* @param variables -
|
|
2866
|
-
* @returns The
|
|
2997
|
+
* @param variables - Values from {@link FollowersVariables} for the query.
|
|
2998
|
+
* @returns The {@link FollowersPageResponse} returned by the query.
|
|
2867
2999
|
* @see https://docs.anilist.co/reference/object/user
|
|
2868
|
-
* @param options - Optional
|
|
3000
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3001
|
+
* @example
|
|
3002
|
+
* ```typescript
|
|
3003
|
+
* const result = await new FollowersQuery().followers({ userId: 1, page: 1, perPage: 10 });
|
|
3004
|
+
* ```
|
|
2869
3005
|
*/
|
|
2870
3006
|
async followers(variables, options) {
|
|
2871
3007
|
const query = `
|
|
@@ -2909,12 +3045,16 @@ const FollowingMappings = {
|
|
|
2909
3045
|
};
|
|
2910
3046
|
class FollowingQuery extends AniListOperation {
|
|
2911
3047
|
/**
|
|
2912
|
-
*
|
|
3048
|
+
* {@link FollowingQuery.following} sends a query request to get following users.
|
|
2913
3049
|
*
|
|
2914
|
-
* @param variables -
|
|
2915
|
-
* @returns The
|
|
3050
|
+
* @param variables - Values from {@link FollowingVariables} for the query.
|
|
3051
|
+
* @returns The {@link UserResponse} returned by the query.
|
|
2916
3052
|
* @see https://docs.anilist.co/reference/object/user
|
|
2917
|
-
* @param options - Optional
|
|
3053
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3054
|
+
* @example
|
|
3055
|
+
* ```typescript
|
|
3056
|
+
* const result = await new FollowingQuery().following({ userId: 1 });
|
|
3057
|
+
* ```
|
|
2918
3058
|
*/
|
|
2919
3059
|
async following(variables, options) {
|
|
2920
3060
|
const query = `
|
|
@@ -2953,10 +3093,14 @@ class FollowingsQuery extends AniListOperation {
|
|
|
2953
3093
|
/**
|
|
2954
3094
|
* `followings` is a method that sends a query request to get followings.
|
|
2955
3095
|
*
|
|
2956
|
-
* @param variables -
|
|
2957
|
-
* @returns The
|
|
3096
|
+
* @param variables - Values from {@link FollowingsVariables} for the query.
|
|
3097
|
+
* @returns The {@link FollowingsPageResponse} returned by the query.
|
|
2958
3098
|
* @see https://docs.anilist.co/reference/object/user
|
|
2959
|
-
* @param options - Optional
|
|
3099
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3100
|
+
* @example
|
|
3101
|
+
* ```typescript
|
|
3102
|
+
* const result = await new FollowingsQuery().followings({ userId: 1, page: 1, perPage: 10 });
|
|
3103
|
+
* ```
|
|
2960
3104
|
*/
|
|
2961
3105
|
async followings(variables, options) {
|
|
2962
3106
|
const query = `
|
|
@@ -2991,11 +3135,15 @@ class FollowingsQuery extends AniListOperation {
|
|
|
2991
3135
|
|
|
2992
3136
|
class GenreCollectionQuery extends AniListOperation {
|
|
2993
3137
|
/**
|
|
2994
|
-
*
|
|
3138
|
+
* {@link GenreCollectionQuery.genreCollection} sends a query request to get genre collections.
|
|
2995
3139
|
*
|
|
2996
|
-
* @returns The
|
|
3140
|
+
* @returns The genre strings returned by AniList.
|
|
2997
3141
|
* @see https://docs.anilist.co/reference/query
|
|
2998
|
-
* @param options - Optional
|
|
3142
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3143
|
+
* @example
|
|
3144
|
+
* ```typescript
|
|
3145
|
+
* const genres = await new GenreCollectionQuery().genreCollection();
|
|
3146
|
+
* ```
|
|
2999
3147
|
*/
|
|
3000
3148
|
async genreCollection(options) {
|
|
3001
3149
|
const query = `
|
|
@@ -3017,10 +3165,14 @@ class LikesQuery extends AniListOperation {
|
|
|
3017
3165
|
/**
|
|
3018
3166
|
* `likes` is a method that sends a query request to get likes.
|
|
3019
3167
|
*
|
|
3020
|
-
* @param variables -
|
|
3021
|
-
* @returns The
|
|
3168
|
+
* @param variables - Values from {@link LikesVariables} for the query.
|
|
3169
|
+
* @returns The {@link LikesPageResponse} for the requested page, with pagination metadata.
|
|
3022
3170
|
* @see https://docs.anilist.co/reference/union/likeableunion
|
|
3023
|
-
* @param options - Optional
|
|
3171
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3172
|
+
* @example
|
|
3173
|
+
* ```typescript
|
|
3174
|
+
* const result = await new LikesQuery().likes({ likeableId: 1, type: "ACTIVITY" });
|
|
3175
|
+
* ```
|
|
3024
3176
|
*/
|
|
3025
3177
|
async likes(variables, options) {
|
|
3026
3178
|
const query = `
|
|
@@ -3055,12 +3207,16 @@ class LikesQuery extends AniListOperation {
|
|
|
3055
3207
|
|
|
3056
3208
|
class MarkdownQuery extends AniListOperation {
|
|
3057
3209
|
/**
|
|
3058
|
-
*
|
|
3210
|
+
* {@link MarkdownQuery.markdown} sends a query request to convert Markdown text to HTML.
|
|
3059
3211
|
*
|
|
3060
|
-
* @param variables -
|
|
3061
|
-
* @returns The
|
|
3212
|
+
* @param variables - Values from {@link MarkdownVariables} for the query.
|
|
3213
|
+
* @returns The converted HTML string returned by AniList.
|
|
3062
3214
|
* @see https://docs.anilist.co/reference/object/parsedmarkdown
|
|
3063
|
-
* @param options - Optional
|
|
3215
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3216
|
+
* @example
|
|
3217
|
+
* ```typescript
|
|
3218
|
+
* const html = await new MarkdownQuery().markdown({ markdown: "# AniList" });
|
|
3219
|
+
* ```
|
|
3064
3220
|
*/
|
|
3065
3221
|
async markdown(variables, options) {
|
|
3066
3222
|
const query = `
|
|
@@ -3194,7 +3350,7 @@ const MediaListCollectionMappings = {
|
|
|
3194
3350
|
};
|
|
3195
3351
|
class MediaListCollectionQuery extends AniListOperation {
|
|
3196
3352
|
/**
|
|
3197
|
-
*
|
|
3353
|
+
* {@link MediaListCollectionQuery.mediaListCollection} sends a query request to get media list collection data.
|
|
3198
3354
|
*
|
|
3199
3355
|
* Chunk semantics: AniList returns large user lists in chunks. Set `chunk` (1-based) and
|
|
3200
3356
|
* `perChunk` (entries per chunk) to fetch a single chunk; the response's `hasNextChunk` flag
|
|
@@ -3212,10 +3368,17 @@ class MediaListCollectionQuery extends AniListOperation {
|
|
|
3212
3368
|
* );
|
|
3213
3369
|
* ```
|
|
3214
3370
|
*
|
|
3215
|
-
* @param variables -
|
|
3216
|
-
* @returns The
|
|
3371
|
+
* @param variables - Values from {@link MediaListCollectionVariables} for the query.
|
|
3372
|
+
* @returns The {@link MediaListCollectionResponse} from the query request, including `lists` and `hasNextChunk`.
|
|
3217
3373
|
* @see https://docs.anilist.co/reference/object/medialistcollection
|
|
3218
|
-
* @param options - Optional
|
|
3374
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3375
|
+
* @example
|
|
3376
|
+
* ```typescript
|
|
3377
|
+
* const result = await new MediaListCollectionQuery().mediaListCollection({
|
|
3378
|
+
* type: "ANIME",
|
|
3379
|
+
* userId: 1,
|
|
3380
|
+
* });
|
|
3381
|
+
* ```
|
|
3219
3382
|
*/
|
|
3220
3383
|
async mediaListCollection(variables, options) {
|
|
3221
3384
|
const query = MediaListCollectionQuerySchema;
|
|
@@ -3298,12 +3461,16 @@ const MediaListMappings = {
|
|
|
3298
3461
|
};
|
|
3299
3462
|
class MediaListQuery extends AniListOperation {
|
|
3300
3463
|
/**
|
|
3301
|
-
*
|
|
3464
|
+
* {@link MediaListQuery.mediaList} sends a query request to get media list data.
|
|
3302
3465
|
*
|
|
3303
|
-
* @param variables -
|
|
3304
|
-
* @returns The
|
|
3466
|
+
* @param variables - Values from {@link MediaListVariables} for the query.
|
|
3467
|
+
* @returns The {@link MediaListResponse} returned by the query.
|
|
3305
3468
|
* @see https://docs.anilist.co/reference/object/medialist
|
|
3306
|
-
* @param options - Optional
|
|
3469
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3470
|
+
* @example
|
|
3471
|
+
* ```typescript
|
|
3472
|
+
* const result = await new MediaListQuery().mediaList({ id: 1 });
|
|
3473
|
+
* ```
|
|
3307
3474
|
*/
|
|
3308
3475
|
async mediaList(variables, options) {
|
|
3309
3476
|
const query = `
|
|
@@ -3356,10 +3523,14 @@ class MediaListsQuery extends AniListOperation {
|
|
|
3356
3523
|
/**
|
|
3357
3524
|
* `mediaLists` is a method that sends a query request to get media lists.
|
|
3358
3525
|
*
|
|
3359
|
-
* @param variables -
|
|
3360
|
-
* @returns The
|
|
3526
|
+
* @param variables - Values from {@link MediaListsVariables} for the query.
|
|
3527
|
+
* @returns The {@link MediaListsPageResponse} returned by the query.
|
|
3361
3528
|
* @see https://docs.anilist.co/reference/object/medialist
|
|
3362
|
-
* @param options - Optional
|
|
3529
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3530
|
+
* @example
|
|
3531
|
+
* ```typescript
|
|
3532
|
+
* const result = await new MediaListsQuery().mediaLists({ userId: 1, page: 1, perPage: 10 });
|
|
3533
|
+
* ```
|
|
3363
3534
|
*/
|
|
3364
3535
|
async mediaLists(variables, options) {
|
|
3365
3536
|
const query = `
|
|
@@ -3487,12 +3658,16 @@ const MediaMappings = {
|
|
|
3487
3658
|
};
|
|
3488
3659
|
class MediaQuery extends AniListOperation {
|
|
3489
3660
|
/**
|
|
3490
|
-
*
|
|
3661
|
+
* {@link MediaQuery.media} sends a query request to get media data.
|
|
3491
3662
|
*
|
|
3492
|
-
* @param variables -
|
|
3493
|
-
* @returns The
|
|
3663
|
+
* @param variables - Values from {@link MediaVariables} for the query.
|
|
3664
|
+
* @returns The {@link MediaResponse} returned by the query.
|
|
3494
3665
|
* @see https://docs.anilist.co/reference/object/media
|
|
3495
|
-
* @param options - Optional
|
|
3666
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3667
|
+
* @example
|
|
3668
|
+
* ```typescript
|
|
3669
|
+
* const result = await new MediaQuery().media({ id: 1 });
|
|
3670
|
+
* ```
|
|
3496
3671
|
*/
|
|
3497
3672
|
async media(variables, options) {
|
|
3498
3673
|
const query = `
|
|
@@ -3521,12 +3696,16 @@ const MediaTagCollectionMappings = {
|
|
|
3521
3696
|
};
|
|
3522
3697
|
class MediaTagCollectionQuery extends AniListOperation {
|
|
3523
3698
|
/**
|
|
3524
|
-
*
|
|
3699
|
+
* {@link MediaTagCollectionQuery.mediaTagCollection} sends a query request to get media tag collection data.
|
|
3525
3700
|
*
|
|
3526
|
-
* @param variables -
|
|
3527
|
-
* @returns The
|
|
3701
|
+
* @param variables - Optional values from {@link MediaTagCollectionVariables}; defaults to an empty object.
|
|
3702
|
+
* @returns The {@link MediaTagCollectionResponse} returned by the query.
|
|
3528
3703
|
* @see https://docs.anilist.co/reference/object/mediatag
|
|
3529
|
-
* @param options - Optional
|
|
3704
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3705
|
+
* @example
|
|
3706
|
+
* ```typescript
|
|
3707
|
+
* const result = await new MediaTagCollectionQuery().mediaTagCollection({});
|
|
3708
|
+
* ```
|
|
3530
3709
|
*/
|
|
3531
3710
|
async mediaTagCollection(variables = {}, options) {
|
|
3532
3711
|
const query = `
|
|
@@ -3587,12 +3766,16 @@ const MediaTrendMappings = {
|
|
|
3587
3766
|
};
|
|
3588
3767
|
class MediaTrendQuery extends AniListOperation {
|
|
3589
3768
|
/**
|
|
3590
|
-
*
|
|
3769
|
+
* {@link MediaTrendQuery.mediaTrend} sends a query request to get media trend data.
|
|
3591
3770
|
*
|
|
3592
|
-
* @param variables -
|
|
3593
|
-
* @returns The
|
|
3771
|
+
* @param variables - Values from {@link MediaTrendVariables} for the query.
|
|
3772
|
+
* @returns The {@link MediaTrendResponse} returned by the query.
|
|
3594
3773
|
* @see https://docs.anilist.co/reference/object/mediatrend
|
|
3595
|
-
* @param options - Optional
|
|
3774
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3775
|
+
* @example
|
|
3776
|
+
* ```typescript
|
|
3777
|
+
* const result = await new MediaTrendQuery().mediaTrend({ mediaId: 1 });
|
|
3778
|
+
* ```
|
|
3596
3779
|
*/
|
|
3597
3780
|
async mediaTrend(variables, options) {
|
|
3598
3781
|
const query = `
|
|
@@ -3650,10 +3833,14 @@ class MediaTrendsQuery extends AniListOperation {
|
|
|
3650
3833
|
/**
|
|
3651
3834
|
* `mediaTrends` is a method that sends a query request to get media trends.
|
|
3652
3835
|
*
|
|
3653
|
-
* @param variables -
|
|
3654
|
-
* @returns The
|
|
3836
|
+
* @param variables - Values from {@link MediaTrendsVariables} for the query.
|
|
3837
|
+
* @returns The {@link MediaTrendsPageResponse} returned by the query.
|
|
3655
3838
|
* @see https://docs.anilist.co/reference/object/mediatrend
|
|
3656
|
-
* @param options - Optional
|
|
3839
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3840
|
+
* @example
|
|
3841
|
+
* ```typescript
|
|
3842
|
+
* const result = await new MediaTrendsQuery().mediaTrends({ mediaId: 1, page: 1, perPage: 10 });
|
|
3843
|
+
* ```
|
|
3657
3844
|
*/
|
|
3658
3845
|
async mediaTrends(variables, options) {
|
|
3659
3846
|
const query = `
|
|
@@ -3755,11 +3942,15 @@ const MediasMappings = {
|
|
|
3755
3942
|
};
|
|
3756
3943
|
class MediasQuery extends AniListOperation {
|
|
3757
3944
|
/**
|
|
3758
|
-
* Returns a
|
|
3759
|
-
* @param variables -
|
|
3760
|
-
* @returns
|
|
3945
|
+
* Returns a {@link MediasPageResponse} object.
|
|
3946
|
+
* @param variables - Values from {@link MediasVariables} for the query.
|
|
3947
|
+
* @returns The {@link MediasPageResponse} returned by the query.
|
|
3761
3948
|
* @see https://docs.anilist.co/reference/object/media
|
|
3762
|
-
* @param options - Optional
|
|
3949
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
3950
|
+
* @example
|
|
3951
|
+
* ```typescript
|
|
3952
|
+
* const result = await new MediasQuery().medias({ search: "Cowboy Bebop", page: 1 });
|
|
3953
|
+
* ```
|
|
3763
3954
|
*/
|
|
3764
3955
|
async medias(variables, options) {
|
|
3765
3956
|
const query = `
|
|
@@ -3967,12 +4158,16 @@ const NotificationMappings = {
|
|
|
3967
4158
|
};
|
|
3968
4159
|
class NotificationQuery extends AniListOperation {
|
|
3969
4160
|
/**
|
|
3970
|
-
*
|
|
4161
|
+
* {@link NotificationQuery.notification} sends a query request to get notification data.
|
|
3971
4162
|
*
|
|
3972
|
-
* @param variables -
|
|
3973
|
-
* @returns The
|
|
4163
|
+
* @param variables - Values from {@link NotificationVariables} for the query.
|
|
4164
|
+
* @returns The {@link NotificationResponse} returned by the query.
|
|
3974
4165
|
* @see https://docs.anilist.co/reference/union/notificationunion
|
|
3975
|
-
* @param options - Optional
|
|
4166
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4167
|
+
* @example
|
|
4168
|
+
* ```typescript
|
|
4169
|
+
* const result = await new NotificationQuery("authToken").notification({});
|
|
4170
|
+
* ```
|
|
3976
4171
|
*/
|
|
3977
4172
|
async notification(variables, options) {
|
|
3978
4173
|
const query = `
|
|
@@ -4002,10 +4197,14 @@ class NotificationsQuery extends AniListOperation {
|
|
|
4002
4197
|
/**
|
|
4003
4198
|
* `notifications` is a method that sends a query request to get notifications.
|
|
4004
4199
|
*
|
|
4005
|
-
* @param variables -
|
|
4006
|
-
* @returns The
|
|
4200
|
+
* @param variables - Values from {@link NotificationsVariables} for the query.
|
|
4201
|
+
* @returns The {@link NotificationsPageResponse} returned by the query.
|
|
4007
4202
|
* @see https://docs.anilist.co/reference/union/notificationunion
|
|
4008
|
-
* @param options - Optional
|
|
4203
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4204
|
+
* @example
|
|
4205
|
+
* ```typescript
|
|
4206
|
+
* const result = await new NotificationsQuery().notifications({ page: 1, perPage: 10 });
|
|
4207
|
+
* ```
|
|
4009
4208
|
*/
|
|
4010
4209
|
async notifications(variables, options) {
|
|
4011
4210
|
const query = `
|
|
@@ -4060,12 +4259,16 @@ const RecommendationMappings = {
|
|
|
4060
4259
|
};
|
|
4061
4260
|
class RecommendationQuery extends AniListOperation {
|
|
4062
4261
|
/**
|
|
4063
|
-
*
|
|
4262
|
+
* {@link RecommendationQuery.recommendation} sends a query request to get recommendation data.
|
|
4064
4263
|
*
|
|
4065
|
-
* @param variables -
|
|
4066
|
-
* @returns The
|
|
4264
|
+
* @param variables - Values from {@link RecommendationVariables} for the query.
|
|
4265
|
+
* @returns The {@link RecommendationResponse} returned by the query.
|
|
4067
4266
|
* @see https://docs.anilist.co/reference/object/recommendation
|
|
4068
|
-
* @param options - Optional
|
|
4267
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4268
|
+
* @example
|
|
4269
|
+
* ```typescript
|
|
4270
|
+
* const result = await new RecommendationQuery().recommendation({ mediaId: 1 });
|
|
4271
|
+
* ```
|
|
4069
4272
|
*/
|
|
4070
4273
|
async recommendation(variables, options) {
|
|
4071
4274
|
const query = `
|
|
@@ -4107,10 +4310,14 @@ class RecommendationsQuery extends AniListOperation {
|
|
|
4107
4310
|
/**
|
|
4108
4311
|
* `recommendations` is a method that sends a query request to get recommendations.
|
|
4109
4312
|
*
|
|
4110
|
-
* @param variables -
|
|
4111
|
-
* @returns The
|
|
4313
|
+
* @param variables - Values from {@link RecommendationsVariables} for the query.
|
|
4314
|
+
* @returns The {@link RecommendationsPageResponse} returned by the query.
|
|
4112
4315
|
* @see https://docs.anilist.co/reference/object/recommendation
|
|
4113
|
-
* @param options - Optional
|
|
4316
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4317
|
+
* @example
|
|
4318
|
+
* ```typescript
|
|
4319
|
+
* const result = await new RecommendationsQuery().recommendations({ mediaId: 1, page: 1 });
|
|
4320
|
+
* ```
|
|
4114
4321
|
*/
|
|
4115
4322
|
async recommendations(variables, options) {
|
|
4116
4323
|
const query = `
|
|
@@ -4168,12 +4375,16 @@ const ReviewMappings = {
|
|
|
4168
4375
|
};
|
|
4169
4376
|
class ReviewQuery extends AniListOperation {
|
|
4170
4377
|
/**
|
|
4171
|
-
*
|
|
4378
|
+
* {@link ReviewQuery.review} sends a query request to get review data.
|
|
4172
4379
|
*
|
|
4173
|
-
* @param variables -
|
|
4174
|
-
* @returns The
|
|
4380
|
+
* @param variables - Values from {@link ReviewVariables} for the query.
|
|
4381
|
+
* @returns The {@link ReviewResponse} returned by the query.
|
|
4175
4382
|
* @see https://docs.anilist.co/reference/object/review
|
|
4176
|
-
* @param options - Optional
|
|
4383
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4384
|
+
* @example
|
|
4385
|
+
* ```typescript
|
|
4386
|
+
* const result = await new ReviewQuery().review({ mediaId: 1 });
|
|
4387
|
+
* ```
|
|
4177
4388
|
*/
|
|
4178
4389
|
async review(variables, options) {
|
|
4179
4390
|
const query = `
|
|
@@ -4211,10 +4422,14 @@ class ReviewsQuery extends AniListOperation {
|
|
|
4211
4422
|
/**
|
|
4212
4423
|
* `reviews` is a method that sends a query request to get reviews.
|
|
4213
4424
|
*
|
|
4214
|
-
* @param variables -
|
|
4215
|
-
* @returns The
|
|
4425
|
+
* @param variables - Values from {@link ReviewsVariables} for the query.
|
|
4426
|
+
* @returns The {@link ReviewsPageResponse} returned by the query.
|
|
4216
4427
|
* @see https://docs.anilist.co/reference/object/review
|
|
4217
|
-
* @param options - Optional
|
|
4428
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4429
|
+
* @example
|
|
4430
|
+
* ```typescript
|
|
4431
|
+
* const result = await new ReviewsQuery().reviews({ mediaId: 1, page: 1 });
|
|
4432
|
+
* ```
|
|
4218
4433
|
*/
|
|
4219
4434
|
async reviews(variables, options) {
|
|
4220
4435
|
const query = `
|
|
@@ -4312,12 +4527,16 @@ const SiteStatisticsMappings = {
|
|
|
4312
4527
|
};
|
|
4313
4528
|
class SiteStatisticsQuery extends AniListOperation {
|
|
4314
4529
|
/**
|
|
4315
|
-
*
|
|
4530
|
+
* {@link SiteStatisticsQuery.siteStatistics} sends a query request to get site statistics data.
|
|
4316
4531
|
*
|
|
4317
|
-
* @param variables -
|
|
4318
|
-
* @returns The
|
|
4532
|
+
* @param variables - Optional values from {@link SiteStatisticsVariables}; defaults to an empty object.
|
|
4533
|
+
* @returns The {@link SiteStatisticsResponse} returned by the query.
|
|
4319
4534
|
* @see https://docs.anilist.co/reference/object/sitestatistics
|
|
4320
|
-
* @param options - Optional
|
|
4535
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4536
|
+
* @example
|
|
4537
|
+
* ```typescript
|
|
4538
|
+
* const result = await new SiteStatisticsQuery().siteStatistics({});
|
|
4539
|
+
* ```
|
|
4321
4540
|
*/
|
|
4322
4541
|
async siteStatistics(variables = {}, options) {
|
|
4323
4542
|
const query = `
|
|
@@ -4407,12 +4626,16 @@ const StaffMappings = {
|
|
|
4407
4626
|
};
|
|
4408
4627
|
class StaffQuery extends AniListOperation {
|
|
4409
4628
|
/**
|
|
4410
|
-
*
|
|
4629
|
+
* {@link StaffQuery.staff} sends a query request to get staff data.
|
|
4411
4630
|
*
|
|
4412
|
-
* @param variables -
|
|
4413
|
-
* @returns The
|
|
4631
|
+
* @param variables - Values from {@link StaffVariables} for the query.
|
|
4632
|
+
* @returns The {@link StaffResponse} returned by the query.
|
|
4414
4633
|
* @see https://docs.anilist.co/reference/object/staff
|
|
4415
|
-
* @param options - Optional
|
|
4634
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4635
|
+
* @example
|
|
4636
|
+
* ```typescript
|
|
4637
|
+
* const result = await new StaffQuery().staff({ id: 1 });
|
|
4638
|
+
* ```
|
|
4416
4639
|
*/
|
|
4417
4640
|
async staff(variables, options) {
|
|
4418
4641
|
const query = `
|
|
@@ -4457,10 +4680,14 @@ class StaffsQuery extends AniListOperation {
|
|
|
4457
4680
|
/**
|
|
4458
4681
|
* `staffs` is a method that sends a query request to get staffs.
|
|
4459
4682
|
*
|
|
4460
|
-
* @param variables -
|
|
4461
|
-
* @returns The
|
|
4683
|
+
* @param variables - Values from {@link StaffsVariables} for the query.
|
|
4684
|
+
* @returns The {@link StaffsPageResponse} returned by the query.
|
|
4462
4685
|
* @see https://docs.anilist.co/reference/object/staff
|
|
4463
|
-
* @param options - Optional
|
|
4686
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4687
|
+
* @example
|
|
4688
|
+
* ```typescript
|
|
4689
|
+
* const result = await new StaffsQuery().staffs({ search: "Hayao Miyazaki", page: 1 });
|
|
4690
|
+
* ```
|
|
4464
4691
|
*/
|
|
4465
4692
|
async staffs(variables, options) {
|
|
4466
4693
|
const query = `
|
|
@@ -4563,12 +4790,16 @@ const StudioMappings = {
|
|
|
4563
4790
|
};
|
|
4564
4791
|
class StudioQuery extends AniListOperation {
|
|
4565
4792
|
/**
|
|
4566
|
-
*
|
|
4793
|
+
* {@link StudioQuery.studio} sends a query request to get studio data.
|
|
4567
4794
|
*
|
|
4568
|
-
* @param variables -
|
|
4569
|
-
* @returns The
|
|
4795
|
+
* @param variables - Values from {@link StudioVariables} for the query.
|
|
4796
|
+
* @returns The {@link StudioResponse} returned by the query.
|
|
4570
4797
|
* @see https://docs.anilist.co/reference/object/studio
|
|
4571
|
-
* @param options - Optional
|
|
4798
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4799
|
+
* @example
|
|
4800
|
+
* ```typescript
|
|
4801
|
+
* const result = await new StudioQuery().studio({ id: 1 });
|
|
4802
|
+
* ```
|
|
4572
4803
|
*/
|
|
4573
4804
|
async studio(variables, options) {
|
|
4574
4805
|
const query = `
|
|
@@ -4617,10 +4848,14 @@ class StudiosQuery extends AniListOperation {
|
|
|
4617
4848
|
/**
|
|
4618
4849
|
* `studios` is a method that sends a query request to get studios.
|
|
4619
4850
|
*
|
|
4620
|
-
* @param variables -
|
|
4621
|
-
* @returns The
|
|
4851
|
+
* @param variables - Values from {@link StudiosVariables} for the query.
|
|
4852
|
+
* @returns The {@link StudiosPageResponse} returned by the query.
|
|
4622
4853
|
* @see https://docs.anilist.co/reference/object/studio
|
|
4623
|
-
* @param options - Optional
|
|
4854
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4855
|
+
* @example
|
|
4856
|
+
* ```typescript
|
|
4857
|
+
* const result = await new StudiosQuery().studios({ search: "Bones", page: 1 });
|
|
4858
|
+
* ```
|
|
4624
4859
|
*/
|
|
4625
4860
|
async studios(variables, options) {
|
|
4626
4861
|
const query = `
|
|
@@ -4714,12 +4949,16 @@ const ThreadCommentMappings = {
|
|
|
4714
4949
|
};
|
|
4715
4950
|
class ThreadCommentQuery extends AniListOperation {
|
|
4716
4951
|
/**
|
|
4717
|
-
*
|
|
4952
|
+
* {@link ThreadCommentQuery.threadComment} sends a query request to get thread comment data.
|
|
4718
4953
|
*
|
|
4719
|
-
* @param variables -
|
|
4720
|
-
* @returns The
|
|
4954
|
+
* @param variables - Values from {@link ThreadCommentVariables} for the query.
|
|
4955
|
+
* @returns The {@link ThreadCommentResponse} returned by the query.
|
|
4721
4956
|
* @see https://docs.anilist.co/reference/object/threadcomment
|
|
4722
|
-
* @param options - Optional
|
|
4957
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
4958
|
+
* @example
|
|
4959
|
+
* ```typescript
|
|
4960
|
+
* const result = await new ThreadCommentQuery().threadComment({ threadId: 1 });
|
|
4961
|
+
* ```
|
|
4723
4962
|
*/
|
|
4724
4963
|
async threadComment(variables, options) {
|
|
4725
4964
|
const query = `
|
|
@@ -4756,10 +4995,14 @@ class ThreadCommentsQuery extends AniListOperation {
|
|
|
4756
4995
|
/**
|
|
4757
4996
|
* `threadComments` is a method that sends a query request to get thread comments.
|
|
4758
4997
|
*
|
|
4759
|
-
* @param variables -
|
|
4760
|
-
* @returns The
|
|
4998
|
+
* @param variables - Values from {@link ThreadCommentsVariables} for the query.
|
|
4999
|
+
* @returns The {@link ThreadCommentsPageResponse} returned by the query.
|
|
4761
5000
|
* @see https://docs.anilist.co/reference/object/threadcomment
|
|
4762
|
-
* @param options - Optional
|
|
5001
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5002
|
+
* @example
|
|
5003
|
+
* ```typescript
|
|
5004
|
+
* const result = await new ThreadCommentsQuery().threadComments({ threadId: 1, page: 1 });
|
|
5005
|
+
* ```
|
|
4763
5006
|
*/
|
|
4764
5007
|
async threadComments(variables, options) {
|
|
4765
5008
|
const query = `
|
|
@@ -4806,12 +5049,16 @@ const ThreadMappings = {
|
|
|
4806
5049
|
};
|
|
4807
5050
|
class ThreadQuery extends AniListOperation {
|
|
4808
5051
|
/**
|
|
4809
|
-
*
|
|
5052
|
+
* {@link ThreadQuery.thread} sends a query request to get thread data.
|
|
4810
5053
|
*
|
|
4811
|
-
* @param variables -
|
|
4812
|
-
* @returns The
|
|
5054
|
+
* @param variables - Values from {@link ThreadVariables} for the query.
|
|
5055
|
+
* @returns The {@link ThreadResponse} returned by the query.
|
|
4813
5056
|
* @see https://docs.anilist.co/reference/object/thread
|
|
4814
|
-
* @param options - Optional
|
|
5057
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5058
|
+
* @example
|
|
5059
|
+
* ```typescript
|
|
5060
|
+
* const result = await new ThreadQuery().thread({ id: 1 });
|
|
5061
|
+
* ```
|
|
4815
5062
|
*/
|
|
4816
5063
|
async thread(variables, options) {
|
|
4817
5064
|
const query = `
|
|
@@ -4853,10 +5100,14 @@ class ThreadsQuery extends AniListOperation {
|
|
|
4853
5100
|
/**
|
|
4854
5101
|
* `threads` is a method that sends a query request to get threads.
|
|
4855
5102
|
*
|
|
4856
|
-
* @param variables -
|
|
4857
|
-
* @returns The
|
|
5103
|
+
* @param variables - Values from {@link ThreadsVariables} for the query.
|
|
5104
|
+
* @returns The {@link ThreadsPageResponse} returned by the query.
|
|
4858
5105
|
* @see https://docs.anilist.co/reference/object/thread
|
|
4859
|
-
* @param options - Optional
|
|
5106
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5107
|
+
* @example
|
|
5108
|
+
* ```typescript
|
|
5109
|
+
* const result = await new ThreadsQuery().threads({ page: 1, perPage: 10 });
|
|
5110
|
+
* ```
|
|
4860
5111
|
*/
|
|
4861
5112
|
async threads(variables, options) {
|
|
4862
5113
|
const query = `
|
|
@@ -4896,12 +5147,16 @@ const UserMappings = {
|
|
|
4896
5147
|
};
|
|
4897
5148
|
class UserQuery extends AniListOperation {
|
|
4898
5149
|
/**
|
|
4899
|
-
*
|
|
5150
|
+
* {@link UserQuery.user} sends a query request to get user data.
|
|
4900
5151
|
*
|
|
4901
|
-
* @param variables -
|
|
4902
|
-
* @returns The
|
|
5152
|
+
* @param variables - Values from {@link UserVariables} for the query.
|
|
5153
|
+
* @returns The {@link UserResponse} returned by the query.
|
|
4903
5154
|
* @see https://docs.anilist.co/reference/object/user
|
|
4904
|
-
* @param options - Optional
|
|
5155
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5156
|
+
* @example
|
|
5157
|
+
* ```typescript
|
|
5158
|
+
* const result = await new UserQuery().user({ id: 1 });
|
|
5159
|
+
* ```
|
|
4905
5160
|
*/
|
|
4906
5161
|
async user(variables, options) {
|
|
4907
5162
|
const query = `
|
|
@@ -4936,10 +5191,14 @@ class UsersQuery extends AniListOperation {
|
|
|
4936
5191
|
/**
|
|
4937
5192
|
* `users` is a method that sends a query request to get users.
|
|
4938
5193
|
*
|
|
4939
|
-
* @param variables -
|
|
4940
|
-
* @returns The
|
|
5194
|
+
* @param variables - Values from {@link UsersVariables} for the query.
|
|
5195
|
+
* @returns The {@link UsersPageResponse} returned by the query.
|
|
4941
5196
|
* @see https://docs.anilist.co/reference/object/user
|
|
4942
|
-
* @param options - Optional
|
|
5197
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5198
|
+
* @example
|
|
5199
|
+
* ```typescript
|
|
5200
|
+
* const result = await new UsersQuery().users({ search: "AniList", page: 1 });
|
|
5201
|
+
* ```
|
|
4943
5202
|
*/
|
|
4944
5203
|
async users(variables, options) {
|
|
4945
5204
|
const query = `
|
|
@@ -4974,12 +5233,16 @@ const ViewerMappings = {
|
|
|
4974
5233
|
};
|
|
4975
5234
|
class ViewerQuery extends AniListOperation {
|
|
4976
5235
|
/**
|
|
4977
|
-
*
|
|
5236
|
+
* {@link ViewerQuery.viewer} sends a query request to get viewer data.
|
|
4978
5237
|
*
|
|
4979
|
-
* @param variables -
|
|
4980
|
-
* @returns The
|
|
5238
|
+
* @param variables - Optional values from {@link ViewerVariables}; defaults to an empty object.
|
|
5239
|
+
* @returns The {@link UserResponse} returned by the query.
|
|
4981
5240
|
* @see https://docs.anilist.co/reference/object/user
|
|
4982
|
-
* @param options - Optional
|
|
5241
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5242
|
+
* @example
|
|
5243
|
+
* ```typescript
|
|
5244
|
+
* const result = await new ViewerQuery("authToken").viewer({});
|
|
5245
|
+
* ```
|
|
4983
5246
|
*/
|
|
4984
5247
|
async viewer(variables = {}, options) {
|
|
4985
5248
|
const query = `
|
|
@@ -5002,18 +5265,22 @@ const DeleteMediaListEntryMappings = {
|
|
|
5002
5265
|
};
|
|
5003
5266
|
class DeleteMediaListEntryMutation extends AniListOperation {
|
|
5004
5267
|
/**
|
|
5005
|
-
*
|
|
5268
|
+
* {@link DeleteMediaListEntryMutation.deleteMediaListEntry} sends a mutation request to delete a media list entry.
|
|
5006
5269
|
*
|
|
5007
5270
|
* The response is `{ deleted: boolean }`. A `true` value means the entry was deleted by this
|
|
5008
5271
|
* call; a `false` value means the entry was not present (already deleted or never existed).
|
|
5009
5272
|
* The mutation is therefore safe to retry after a partial failure: a `false` result confirms
|
|
5010
5273
|
* the target is gone rather than reporting an error.
|
|
5011
5274
|
*
|
|
5012
|
-
* @param variables -
|
|
5013
|
-
* @returns
|
|
5014
|
-
* @throws
|
|
5275
|
+
* @param variables - Values from {@link DeleteMediaListEntryVariables} for the mutation.
|
|
5276
|
+
* @returns The {@link DeleteMediaListEntryResponse} returned by the mutation.
|
|
5277
|
+
* @throws Throws if no authentication token is configured, `id` is missing or invalid, or the mutation request fails.
|
|
5015
5278
|
* @see https://docs.anilist.co/reference/object/deleted
|
|
5016
|
-
* @param options - Optional
|
|
5279
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5280
|
+
* @example
|
|
5281
|
+
* ```typescript
|
|
5282
|
+
* const result = await new DeleteMediaListEntryMutation("your-token").deleteMediaListEntry({ id: 1 });
|
|
5283
|
+
* ```
|
|
5017
5284
|
*/
|
|
5018
5285
|
async deleteMediaListEntry(variables, options) {
|
|
5019
5286
|
const mutation = `
|
|
@@ -5044,18 +5311,22 @@ const DeleteCustomListMappings = {
|
|
|
5044
5311
|
};
|
|
5045
5312
|
class DeleteCustomListMutation extends AniListOperation {
|
|
5046
5313
|
/**
|
|
5047
|
-
*
|
|
5314
|
+
* {@link DeleteCustomListMutation.deleteCustomList} sends a mutation request to delete a custom list.
|
|
5048
5315
|
*
|
|
5049
5316
|
* The response is `{ deleted: boolean }`. A `true` value means the custom list was deleted by
|
|
5050
5317
|
* this call; a `false` value means the list was not present (already deleted or never existed).
|
|
5051
5318
|
* The mutation is therefore safe to retry after a partial failure: a `false` result confirms
|
|
5052
5319
|
* the target is gone rather than reporting an error.
|
|
5053
5320
|
*
|
|
5054
|
-
* @param variables -
|
|
5055
|
-
* @returns
|
|
5056
|
-
* @throws
|
|
5321
|
+
* @param variables - Values from {@link DeleteCustomListVariables} for the mutation.
|
|
5322
|
+
* @returns The {@link DeleteResult} returned by the mutation.
|
|
5323
|
+
* @throws Throws if no authentication token is configured, `customList` or `type` is missing or invalid, or the mutation request fails.
|
|
5057
5324
|
* @see https://docs.anilist.co/reference/object/deleted
|
|
5058
|
-
* @param options - Optional
|
|
5325
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5326
|
+
* @example
|
|
5327
|
+
* ```typescript
|
|
5328
|
+
* const result = await new DeleteCustomListMutation("your-token").deleteCustomList({ customList: "watching", type: "ANIME" });
|
|
5329
|
+
* ```
|
|
5059
5330
|
*/
|
|
5060
5331
|
async deleteCustomList(variables, options) {
|
|
5061
5332
|
const mutation = `
|
|
@@ -5088,13 +5359,17 @@ const SaveTextActivityMappings = {
|
|
|
5088
5359
|
};
|
|
5089
5360
|
class SaveTextActivityMutation extends AniListOperation {
|
|
5090
5361
|
/**
|
|
5091
|
-
*
|
|
5362
|
+
* {@link SaveTextActivityMutation.saveTextActivity} sends a mutation request to save a text activity.
|
|
5092
5363
|
*
|
|
5093
|
-
* @param variables -
|
|
5094
|
-
* @returns
|
|
5095
|
-
* @throws
|
|
5096
|
-
*
|
|
5097
|
-
* @param options - Optional
|
|
5364
|
+
* @param variables - Values from {@link SaveTextActivityVariables} for the mutation.
|
|
5365
|
+
* @returns The {@link Activity} returned by the mutation.
|
|
5366
|
+
* @throws Throws if no authentication token is configured, `id` or `text` is missing or invalid, or the mutation request fails.
|
|
5367
|
+
* @see https://docs.anilist.co/reference/union/activityunion
|
|
5368
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5369
|
+
* @example
|
|
5370
|
+
* ```typescript
|
|
5371
|
+
* const result = await new SaveTextActivityMutation("your-token").saveTextActivity({ id: 1, text: "Hello, world!" });
|
|
5372
|
+
* ```
|
|
5098
5373
|
*/
|
|
5099
5374
|
async saveTextActivity(variables, options) {
|
|
5100
5375
|
const mutation = `
|
|
@@ -5130,13 +5405,17 @@ const SaveMessageActivityMappings = {
|
|
|
5130
5405
|
};
|
|
5131
5406
|
class SaveMessageActivityMutation extends AniListOperation {
|
|
5132
5407
|
/**
|
|
5133
|
-
*
|
|
5408
|
+
* {@link SaveMessageActivityMutation.saveMessageActivity} sends a mutation request to save a message activity.
|
|
5134
5409
|
*
|
|
5135
|
-
* @param variables -
|
|
5136
|
-
* @returns
|
|
5137
|
-
* @throws
|
|
5138
|
-
*
|
|
5139
|
-
* @param options - Optional
|
|
5410
|
+
* @param variables - Values from {@link SaveMessageActivityVariables} for the mutation.
|
|
5411
|
+
* @returns The {@link Activity} returned by the mutation.
|
|
5412
|
+
* @throws Throws if no authentication token is configured, `id` or `message` is missing or invalid, or the mutation request fails.
|
|
5413
|
+
* @see https://docs.anilist.co/reference/union/activityunion
|
|
5414
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5415
|
+
* @example
|
|
5416
|
+
* ```typescript
|
|
5417
|
+
* const result = await new SaveMessageActivityMutation("your-token").saveMessageActivity({ id: 1, message: "Hello, world!" });
|
|
5418
|
+
* ```
|
|
5140
5419
|
*/
|
|
5141
5420
|
async saveMessageActivity(variables, options) {
|
|
5142
5421
|
const mutation = `
|
|
@@ -5168,13 +5447,17 @@ const SaveListActivityMappings = {
|
|
|
5168
5447
|
};
|
|
5169
5448
|
class SaveListActivityMutation extends AniListOperation {
|
|
5170
5449
|
/**
|
|
5171
|
-
*
|
|
5450
|
+
* {@link SaveListActivityMutation.saveListActivity} sends a mutation request to save a list activity.
|
|
5172
5451
|
*
|
|
5173
|
-
* @param variables -
|
|
5174
|
-
* @returns
|
|
5175
|
-
* @throws
|
|
5176
|
-
*
|
|
5177
|
-
* @param options - Optional
|
|
5452
|
+
* @param variables - Values from {@link SaveListActivityVariables} for the mutation.
|
|
5453
|
+
* @returns The {@link Activity} returned by the mutation.
|
|
5454
|
+
* @throws Throws if no authentication token is configured, `id` is missing or invalid, or the mutation request fails.
|
|
5455
|
+
* @see https://docs.anilist.co/reference/union/activityunion
|
|
5456
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5457
|
+
* @example
|
|
5458
|
+
* ```typescript
|
|
5459
|
+
* const result = await new SaveListActivityMutation("your-token").saveListActivity({ id: 1 });
|
|
5460
|
+
* ```
|
|
5178
5461
|
*/
|
|
5179
5462
|
async saveListActivity(variables, options) {
|
|
5180
5463
|
const mutation = `
|
|
@@ -5203,18 +5486,22 @@ const DeleteActivityMappings = {
|
|
|
5203
5486
|
};
|
|
5204
5487
|
class DeleteActivityMutation extends AniListOperation {
|
|
5205
5488
|
/**
|
|
5206
|
-
*
|
|
5489
|
+
* {@link DeleteActivityMutation.deleteActivity} sends a mutation request to delete an activity.
|
|
5207
5490
|
*
|
|
5208
5491
|
* The response is `{ deleted: boolean }`. A `true` value means the activity was deleted by
|
|
5209
5492
|
* this call; a `false` value means the activity was not present (already deleted or never
|
|
5210
5493
|
* existed). The mutation is therefore safe to retry after a partial failure: a `false` result
|
|
5211
5494
|
* confirms the target is gone rather than reporting an error.
|
|
5212
5495
|
*
|
|
5213
|
-
* @param variables -
|
|
5214
|
-
* @returns
|
|
5215
|
-
* @throws
|
|
5496
|
+
* @param variables - Values from {@link DeleteActivityVariables} for the mutation.
|
|
5497
|
+
* @returns The {@link DeleteResult} returned by the mutation.
|
|
5498
|
+
* @throws Throws if no authentication token is configured, `id` is missing or invalid, or the mutation request fails.
|
|
5216
5499
|
* @see https://docs.anilist.co/reference/object/deleted
|
|
5217
|
-
* @param options - Optional
|
|
5500
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5501
|
+
* @example
|
|
5502
|
+
* ```typescript
|
|
5503
|
+
* const result = await new DeleteActivityMutation("your-token").deleteActivity({ id: 1 });
|
|
5504
|
+
* ```
|
|
5218
5505
|
*/
|
|
5219
5506
|
async deleteActivity(variables, options) {
|
|
5220
5507
|
const mutation = `
|
|
@@ -5246,13 +5533,17 @@ const ToggleActivitySubscriptionMappings = {
|
|
|
5246
5533
|
};
|
|
5247
5534
|
class ToggleActivitySubscriptionMutation extends AniListOperation {
|
|
5248
5535
|
/**
|
|
5249
|
-
*
|
|
5536
|
+
* {@link ToggleActivitySubscriptionMutation.toggleActivitySubscription} sends a mutation request to subscribe to an activity.
|
|
5250
5537
|
*
|
|
5251
|
-
* @param variables -
|
|
5252
|
-
* @returns
|
|
5253
|
-
* @throws
|
|
5254
|
-
*
|
|
5255
|
-
* @param options - Optional
|
|
5538
|
+
* @param variables - Values from {@link ToggleActivitySubscriptionVariables} for the mutation.
|
|
5539
|
+
* @returns The {@link Activity} returned by the mutation.
|
|
5540
|
+
* @throws Throws if no authentication token is configured, `activityId` or `subscribe` is missing or invalid, or the mutation request fails.
|
|
5541
|
+
* @see https://docs.anilist.co/reference/union/activityunion
|
|
5542
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5543
|
+
* @example
|
|
5544
|
+
* ```typescript
|
|
5545
|
+
* const result = await new ToggleActivitySubscriptionMutation("your-token").toggleActivitySubscription({ activityId: 1, subscribe: true });
|
|
5546
|
+
* ```
|
|
5256
5547
|
*/
|
|
5257
5548
|
async toggleActivitySubscription(variables, options) {
|
|
5258
5549
|
const mutation = `
|
|
@@ -5284,13 +5575,17 @@ const ToggleActivityPinMappings = {
|
|
|
5284
5575
|
};
|
|
5285
5576
|
class ToggleActivityPinMutation extends AniListOperation {
|
|
5286
5577
|
/**
|
|
5287
|
-
*
|
|
5578
|
+
* {@link ToggleActivityPinMutation.toggleActivityPin} sends a mutation request to pin an activity.
|
|
5288
5579
|
*
|
|
5289
|
-
* @param variables -
|
|
5290
|
-
* @returns
|
|
5291
|
-
* @throws
|
|
5292
|
-
*
|
|
5293
|
-
* @param options - Optional
|
|
5580
|
+
* @param variables - Values from {@link ToggleActivityPinVariables} for the mutation.
|
|
5581
|
+
* @returns The {@link Activity} returned by the mutation.
|
|
5582
|
+
* @throws Throws if no authentication token is configured, `id` or `pinned` is missing or invalid, or the mutation request fails.
|
|
5583
|
+
* @see https://docs.anilist.co/reference/union/activityunion
|
|
5584
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5585
|
+
* @example
|
|
5586
|
+
* ```typescript
|
|
5587
|
+
* const result = await new ToggleActivityPinMutation("your-token").toggleActivityPin({ id: 1, pinned: true });
|
|
5588
|
+
* ```
|
|
5294
5589
|
*/
|
|
5295
5590
|
async toggleActivityPin(variables, options) {
|
|
5296
5591
|
const mutation = `
|
|
@@ -5324,13 +5619,17 @@ const SaveActivityReplyMappings = {
|
|
|
5324
5619
|
};
|
|
5325
5620
|
class SaveActivityReplyMutation extends AniListOperation {
|
|
5326
5621
|
/**
|
|
5327
|
-
*
|
|
5622
|
+
* {@link SaveActivityReplyMutation.saveActivityReply} sends a mutation request to save an activity reply.
|
|
5328
5623
|
*
|
|
5329
|
-
* @param variables -
|
|
5330
|
-
* @returns
|
|
5331
|
-
* @throws
|
|
5332
|
-
*
|
|
5333
|
-
* @param options - Optional
|
|
5624
|
+
* @param variables - Values from {@link SaveActivityReplyVariables} for the mutation.
|
|
5625
|
+
* @returns The {@link ActivityReply} returned by the mutation.
|
|
5626
|
+
* @throws Throws if no authentication token is configured, `id` or `text` is missing or invalid, or the mutation request fails.
|
|
5627
|
+
* @see https://docs.anilist.co/reference/object/activityreply
|
|
5628
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5629
|
+
* @example
|
|
5630
|
+
* ```typescript
|
|
5631
|
+
* const result = await new SaveActivityReplyMutation("your-token").saveActivityReply({ id: 1, text: "Hello, world!" });
|
|
5632
|
+
* ```
|
|
5334
5633
|
*/
|
|
5335
5634
|
async saveActivityReply(variables, options) {
|
|
5336
5635
|
const mutation = `
|
|
@@ -5360,18 +5659,22 @@ const DeleteActivityReplyMappings = {
|
|
|
5360
5659
|
};
|
|
5361
5660
|
class DeleteActivityReplyMutation extends AniListOperation {
|
|
5362
5661
|
/**
|
|
5363
|
-
*
|
|
5662
|
+
* {@link DeleteActivityReplyMutation.deleteActivityReply} sends a mutation request to delete an activity reply.
|
|
5364
5663
|
*
|
|
5365
5664
|
* The response is `{ deleted: boolean }`. A `true` value means the reply was deleted by this
|
|
5366
5665
|
* call; a `false` value means the reply was not present (already deleted or never existed).
|
|
5367
5666
|
* The mutation is therefore safe to retry after a partial failure: a `false` result confirms
|
|
5368
5667
|
* the target is gone rather than reporting an error.
|
|
5369
5668
|
*
|
|
5370
|
-
* @param variables -
|
|
5371
|
-
* @returns
|
|
5372
|
-
* @throws
|
|
5669
|
+
* @param variables - Values from {@link DeleteActivityReplyVariables} for the mutation.
|
|
5670
|
+
* @returns The {@link DeleteResult} returned by the mutation.
|
|
5671
|
+
* @throws Throws if no authentication token is configured, `id` is missing or invalid, or the mutation request fails.
|
|
5373
5672
|
* @see https://docs.anilist.co/reference/object/deleted
|
|
5374
|
-
* @param options - Optional
|
|
5673
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5674
|
+
* @example
|
|
5675
|
+
* ```typescript
|
|
5676
|
+
* const result = await new DeleteActivityReplyMutation("your-token").deleteActivityReply({ id: 1 });
|
|
5677
|
+
* ```
|
|
5375
5678
|
*/
|
|
5376
5679
|
async deleteActivityReply(variables, options) {
|
|
5377
5680
|
const mutation = `
|
|
@@ -5402,13 +5705,18 @@ const ToggleLikeMappings = {
|
|
|
5402
5705
|
};
|
|
5403
5706
|
class ToggleLikeMutation extends AniListOperation {
|
|
5404
5707
|
/**
|
|
5405
|
-
*
|
|
5708
|
+
* {@link ToggleLikeMutation.toggleLike} sends a mutation request to toggle a like.
|
|
5406
5709
|
*
|
|
5407
|
-
* @
|
|
5408
|
-
* @
|
|
5409
|
-
* @
|
|
5410
|
-
*
|
|
5411
|
-
* @
|
|
5710
|
+
* @deprecated Prefer {@link ToggleLikeV2Mutation.toggleLikeV2}, which returns the richer {@link Likeable} union (activity, activity reply, thread, or thread comment) instead of a bare user.
|
|
5711
|
+
* @param variables - Values from {@link ToggleLikeVariables} for the mutation.
|
|
5712
|
+
* @returns The {@link BasicUser} returned by the mutation.
|
|
5713
|
+
* @throws Throws if no authentication token is configured, `id` or `type` is missing or invalid, or the mutation request fails.
|
|
5714
|
+
* @see https://docs.anilist.co/reference/object/user
|
|
5715
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5716
|
+
* @example
|
|
5717
|
+
* ```typescript
|
|
5718
|
+
* const result = await new ToggleLikeMutation("your-token").toggleLike({ id: 1, type: "ACTIVITY" });
|
|
5719
|
+
* ```
|
|
5412
5720
|
*/
|
|
5413
5721
|
async toggleLike(variables, options) {
|
|
5414
5722
|
const mutation = `
|
|
@@ -5440,14 +5748,17 @@ const ToggleLikeV2Mappings = {
|
|
|
5440
5748
|
};
|
|
5441
5749
|
class ToggleLikeV2Mutation extends AniListOperation {
|
|
5442
5750
|
/**
|
|
5443
|
-
*
|
|
5751
|
+
* {@link ToggleLikeV2Mutation.toggleLikeV2} sends a mutation request to toggle a like.
|
|
5444
5752
|
*
|
|
5445
|
-
* @param variables -
|
|
5446
|
-
* @returns
|
|
5447
|
-
*
|
|
5448
|
-
* @
|
|
5449
|
-
*
|
|
5450
|
-
* @
|
|
5753
|
+
* @param variables - Values from {@link ToggleLikeV2Variables} for the mutation.
|
|
5754
|
+
* @returns The {@link Likeable} returned by the mutation: an activity, activity reply, thread, or thread comment.
|
|
5755
|
+
* @throws Throws if no authentication token is configured, `id` or `type` is missing or invalid, or the mutation request fails.
|
|
5756
|
+
* @see https://docs.anilist.co/reference/union/likeableunion
|
|
5757
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5758
|
+
* @example
|
|
5759
|
+
* ```typescript
|
|
5760
|
+
* const result = await new ToggleLikeV2Mutation("your-token").toggleLikeV2({ id: 1, type: "ACTIVITY" });
|
|
5761
|
+
* ```
|
|
5451
5762
|
*/
|
|
5452
5763
|
async toggleLikeV2(variables, options) {
|
|
5453
5764
|
const mutation = `
|
|
@@ -5477,13 +5788,17 @@ const ToggleFollowMappings = {
|
|
|
5477
5788
|
};
|
|
5478
5789
|
class ToggleFollowMutation extends AniListOperation {
|
|
5479
5790
|
/**
|
|
5480
|
-
*
|
|
5791
|
+
* {@link ToggleFollowMutation.toggleFollow} sends a mutation request to toggle a follow.
|
|
5481
5792
|
*
|
|
5482
|
-
* @param variables -
|
|
5483
|
-
* @returns
|
|
5484
|
-
* @throws
|
|
5485
|
-
*
|
|
5486
|
-
* @param options - Optional
|
|
5793
|
+
* @param variables - Values from {@link ToggleFollowVariables} for the mutation.
|
|
5794
|
+
* @returns The {@link UserResponse} returned by the mutation.
|
|
5795
|
+
* @throws Throws if no authentication token is configured, `userId` is missing or invalid, or the mutation request fails.
|
|
5796
|
+
* @see https://docs.anilist.co/reference/object/user
|
|
5797
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5798
|
+
* @example
|
|
5799
|
+
* ```typescript
|
|
5800
|
+
* const result = await new ToggleFollowMutation("your-token").toggleFollow({ userId: 1 });
|
|
5801
|
+
* ```
|
|
5487
5802
|
*/
|
|
5488
5803
|
async toggleFollow(variables, options) {
|
|
5489
5804
|
const mutation = `
|
|
@@ -5593,13 +5908,17 @@ const ToggleFavouriteMappings = {
|
|
|
5593
5908
|
};
|
|
5594
5909
|
class ToggleFavouriteMutation extends AniListOperation {
|
|
5595
5910
|
/**
|
|
5596
|
-
*
|
|
5911
|
+
* {@link ToggleFavouriteMutation.toggleFavourite} sends a mutation request to toggle a favourite.
|
|
5597
5912
|
*
|
|
5598
|
-
* @param variables -
|
|
5599
|
-
* @returns
|
|
5600
|
-
* @throws
|
|
5913
|
+
* @param variables - Values from {@link ToggleFavouriteVariables} for the mutation.
|
|
5914
|
+
* @returns The {@link Favourites} returned by the mutation.
|
|
5915
|
+
* @throws Throws if no authentication token is configured, at least one favourite ID is missing or invalid, or the mutation request fails.
|
|
5601
5916
|
* @see https://docs.anilist.co/reference/object/favourites
|
|
5602
|
-
* @param options - Optional
|
|
5917
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5918
|
+
* @example
|
|
5919
|
+
* ```typescript
|
|
5920
|
+
* const result = await new ToggleFavouriteMutation("your-token").toggleFavourite({ animeId: 1, mangaId: 1, characterId: 1, staffId: 1, studioId: 1 });
|
|
5921
|
+
* ```
|
|
5603
5922
|
*/
|
|
5604
5923
|
async toggleFavourite(variables, options) {
|
|
5605
5924
|
const mutation = `
|
|
@@ -5638,13 +5957,17 @@ const UpdateFavouriteOrderMappings = {
|
|
|
5638
5957
|
};
|
|
5639
5958
|
class UpdateFavouriteOrderMutation extends AniListOperation {
|
|
5640
5959
|
/**
|
|
5641
|
-
*
|
|
5960
|
+
* {@link UpdateFavouriteOrderMutation.updateFavouriteOrder} sends a mutation request to update the order of favourites.
|
|
5642
5961
|
*
|
|
5643
|
-
* @param variables -
|
|
5644
|
-
* @returns
|
|
5645
|
-
* @throws
|
|
5962
|
+
* @param variables - Values from {@link UpdateFavouriteOrderVariables} for the mutation.
|
|
5963
|
+
* @returns The {@link Favourites} returned by the mutation.
|
|
5964
|
+
* @throws Throws if no authentication token is configured, an order array lacks its corresponding ID array, a variable has an invalid type, or the mutation request fails.
|
|
5646
5965
|
* @see https://docs.anilist.co/reference/object/favourites
|
|
5647
|
-
* @param options - Optional
|
|
5966
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
5967
|
+
* @example
|
|
5968
|
+
* ```typescript
|
|
5969
|
+
* const result = await new UpdateFavouriteOrderMutation("your-token").updateFavouriteOrder({ animeIds: [1], mangaIds: [], characterIds: [], staffIds: [], studioIds: [], animeOrder: [1], mangaOrder: [], characterOrder: [], staffOrder: [], studioOrder: [] });
|
|
5970
|
+
* ```
|
|
5648
5971
|
*/
|
|
5649
5972
|
async updateFavouriteOrder(variables, options) {
|
|
5650
5973
|
if (!variables.animeIds && variables.animeOrder || !variables.mangaIds && variables.mangaOrder || !variables.characterIds && variables.characterOrder || !variables.staffIds && variables.staffOrder || !variables.studioIds && variables.studioOrder) {
|
|
@@ -5678,13 +6001,17 @@ const SaveReviewMappings = {
|
|
|
5678
6001
|
};
|
|
5679
6002
|
class SaveReviewMutation extends AniListOperation {
|
|
5680
6003
|
/**
|
|
5681
|
-
*
|
|
6004
|
+
* {@link SaveReviewMutation.saveReview} sends a mutation request to save a review.
|
|
5682
6005
|
*
|
|
5683
|
-
* @param variables -
|
|
5684
|
-
* @returns
|
|
5685
|
-
* @throws
|
|
6006
|
+
* @param variables - Values from {@link SaveReviewVariables} for the mutation.
|
|
6007
|
+
* @returns The {@link ReviewResponse} returned by the mutation.
|
|
6008
|
+
* @throws Throws if no authentication token is configured, `id` or `mediaId` is missing, a variable has an invalid type, or the mutation request fails.
|
|
5686
6009
|
* @see https://docs.anilist.co/reference/object/review
|
|
5687
|
-
* @param options - Optional
|
|
6010
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6011
|
+
* @example
|
|
6012
|
+
* ```typescript
|
|
6013
|
+
* const result = await new SaveReviewMutation("your-token").saveReview({ id: 1, mediaId: 1, body: "Example review", summary: "Example", score: 8, private: false });
|
|
6014
|
+
* ```
|
|
5688
6015
|
*/
|
|
5689
6016
|
async saveReview(variables, options) {
|
|
5690
6017
|
const mutation = `
|
|
@@ -5717,13 +6044,17 @@ const RateReviewMappings = {
|
|
|
5717
6044
|
};
|
|
5718
6045
|
class RateReviewMutation extends AniListOperation {
|
|
5719
6046
|
/**
|
|
5720
|
-
*
|
|
6047
|
+
* {@link RateReviewMutation.rateReview} sends a mutation request to rate a review.
|
|
5721
6048
|
*
|
|
5722
|
-
* @param variables -
|
|
5723
|
-
* @returns
|
|
5724
|
-
* @throws
|
|
6049
|
+
* @param variables - Values from {@link RateReviewVariables} for the mutation.
|
|
6050
|
+
* @returns The {@link ReviewResponse} returned by the mutation.
|
|
6051
|
+
* @throws Throws if no authentication token is configured, `reviewId` or `rating` is missing or invalid, or the mutation request fails.
|
|
5725
6052
|
* @see https://docs.anilist.co/reference/object/review
|
|
5726
|
-
* @param options - Optional
|
|
6053
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6054
|
+
* @example
|
|
6055
|
+
* ```typescript
|
|
6056
|
+
* const result = await new RateReviewMutation("your-token").rateReview({ reviewId: 1, rating: "UP_VOTE" });
|
|
6057
|
+
* ```
|
|
5727
6058
|
*/
|
|
5728
6059
|
async rateReview(variables, options) {
|
|
5729
6060
|
const mutation = `
|
|
@@ -5753,18 +6084,22 @@ const DeleteReviewMappings = {
|
|
|
5753
6084
|
};
|
|
5754
6085
|
class DeleteReviewMutation extends AniListOperation {
|
|
5755
6086
|
/**
|
|
5756
|
-
*
|
|
6087
|
+
* {@link DeleteReviewMutation.deleteReview} sends a mutation request to delete a review.
|
|
5757
6088
|
*
|
|
5758
6089
|
* The response is `{ deleted: boolean }`. A `true` value means the review was deleted by this
|
|
5759
6090
|
* call; a `false` value means the review was not present (already deleted or never existed).
|
|
5760
6091
|
* The mutation is therefore safe to retry after a partial failure: a `false` result confirms
|
|
5761
6092
|
* the target is gone rather than reporting an error.
|
|
5762
6093
|
*
|
|
5763
|
-
* @param variables -
|
|
5764
|
-
* @returns
|
|
5765
|
-
* @throws
|
|
6094
|
+
* @param variables - Values from {@link DeleteReviewVariables} for the mutation.
|
|
6095
|
+
* @returns The {@link DeleteResult} returned by the mutation.
|
|
6096
|
+
* @throws Throws if no authentication token is configured, `id` is missing or invalid, or the mutation request fails.
|
|
5766
6097
|
* @see https://docs.anilist.co/reference/object/deleted
|
|
5767
|
-
* @param options - Optional
|
|
6098
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6099
|
+
* @example
|
|
6100
|
+
* ```typescript
|
|
6101
|
+
* const result = await new DeleteReviewMutation("your-token").deleteReview({ id: 1 });
|
|
6102
|
+
* ```
|
|
5768
6103
|
*/
|
|
5769
6104
|
async deleteReview(variables, options) {
|
|
5770
6105
|
const mutation = `
|
|
@@ -5803,13 +6138,17 @@ const SaveRecommendationMappings = {
|
|
|
5803
6138
|
};
|
|
5804
6139
|
class SaveRecommendationMutation extends AniListOperation {
|
|
5805
6140
|
/**
|
|
5806
|
-
*
|
|
6141
|
+
* {@link SaveRecommendationMutation.saveRecommendation} sends a mutation request to save a recommendation.
|
|
5807
6142
|
*
|
|
5808
|
-
* @param variables -
|
|
5809
|
-
* @returns
|
|
5810
|
-
* @throws
|
|
6143
|
+
* @param variables - Values from {@link SaveRecommendationVariables} for the mutation.
|
|
6144
|
+
* @returns The {@link RecommendationResponse} returned by the mutation.
|
|
6145
|
+
* @throws Throws if no authentication token is configured, `mediaId`, `mediaRecommendationId`, or `rating` is missing or invalid, or the mutation request fails.
|
|
5811
6146
|
* @see https://docs.anilist.co/reference/object/recommendation
|
|
5812
|
-
* @param options - Optional
|
|
6147
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6148
|
+
* @example
|
|
6149
|
+
* ```typescript
|
|
6150
|
+
* const result = await new SaveRecommendationMutation("your-token").saveRecommendation({ mediaId: 1, mediaRecommendationId: 2, rating: "RATE_UP" });
|
|
6151
|
+
* ```
|
|
5813
6152
|
*/
|
|
5814
6153
|
async saveRecommendation(variables, options) {
|
|
5815
6154
|
const mutation = `
|
|
@@ -5846,13 +6185,17 @@ const SaveThreadMappings = {
|
|
|
5846
6185
|
};
|
|
5847
6186
|
class SaveThreadMutation extends AniListOperation {
|
|
5848
6187
|
/**
|
|
5849
|
-
*
|
|
6188
|
+
* {@link SaveThreadMutation.saveThread} sends a mutation request to save a thread.
|
|
5850
6189
|
*
|
|
5851
|
-
* @param variables -
|
|
5852
|
-
* @returns
|
|
5853
|
-
* @throws
|
|
5854
|
-
*
|
|
5855
|
-
* @param options - Optional
|
|
6190
|
+
* @param variables - Values from {@link SaveThreadVariables} for the mutation.
|
|
6191
|
+
* @returns The {@link ThreadResponse} returned by the mutation.
|
|
6192
|
+
* @throws Throws if no authentication token is configured, `id` or `title` is missing, a variable has an invalid type, or the mutation request fails.
|
|
6193
|
+
* @see https://docs.anilist.co/reference/object/thread
|
|
6194
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6195
|
+
* @example
|
|
6196
|
+
* ```typescript
|
|
6197
|
+
* const result = await new SaveThreadMutation("your-token").saveThread({ id: 1, title: "Example thread", body: "Hello, world!", categories: [], mediaCategories: [], sticky: false, locked: false, asHtml: true });
|
|
6198
|
+
* ```
|
|
5856
6199
|
*/
|
|
5857
6200
|
async saveThread(variables, options) {
|
|
5858
6201
|
const mutation = `
|
|
@@ -5882,18 +6225,22 @@ const DeleteThreadMappings = {
|
|
|
5882
6225
|
};
|
|
5883
6226
|
class DeleteThreadMutation extends AniListOperation {
|
|
5884
6227
|
/**
|
|
5885
|
-
*
|
|
6228
|
+
* {@link DeleteThreadMutation.deleteThread} sends a mutation request to delete a thread.
|
|
5886
6229
|
*
|
|
5887
6230
|
* The response is `{ deleted: boolean }`. A `true` value means the thread was deleted by this
|
|
5888
6231
|
* call; a `false` value means the thread was not present (already deleted or never existed).
|
|
5889
6232
|
* The mutation is therefore safe to retry after a partial failure: a `false` result confirms
|
|
5890
6233
|
* the target is gone rather than reporting an error.
|
|
5891
6234
|
*
|
|
5892
|
-
* @param variables -
|
|
5893
|
-
* @returns
|
|
5894
|
-
* @throws
|
|
6235
|
+
* @param variables - Values from {@link DeleteThreadVariables} for the mutation.
|
|
6236
|
+
* @returns The {@link DeleteResult} returned by the mutation.
|
|
6237
|
+
* @throws Throws if no authentication token is configured, `id` is missing or invalid, or the mutation request fails.
|
|
5895
6238
|
* @see https://docs.anilist.co/reference/object/deleted
|
|
5896
|
-
* @param options - Optional
|
|
6239
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6240
|
+
* @example
|
|
6241
|
+
* ```typescript
|
|
6242
|
+
* const result = await new DeleteThreadMutation("your-token").deleteThread({ id: 1 });
|
|
6243
|
+
* ```
|
|
5897
6244
|
*/
|
|
5898
6245
|
async deleteThread(variables, options) {
|
|
5899
6246
|
const mutation = `
|
|
@@ -5925,13 +6272,17 @@ const ToggleThreadSubscriptionMappings = {
|
|
|
5925
6272
|
};
|
|
5926
6273
|
class ToggleThreadSubscriptionMutation extends AniListOperation {
|
|
5927
6274
|
/**
|
|
5928
|
-
*
|
|
6275
|
+
* {@link ToggleThreadSubscriptionMutation.toggleThreadSubscription} sends a mutation request to subscribe to a thread.
|
|
5929
6276
|
*
|
|
5930
|
-
* @param variables -
|
|
5931
|
-
* @returns
|
|
5932
|
-
* @throws
|
|
5933
|
-
*
|
|
5934
|
-
* @param options - Optional
|
|
6277
|
+
* @param variables - Values from {@link ToggleThreadSubscriptionVariables} for the mutation.
|
|
6278
|
+
* @returns The {@link ThreadResponse} returned by the mutation.
|
|
6279
|
+
* @throws Throws if no authentication token is configured, `threadId` or `subscribe` is missing or invalid, or the mutation request fails.
|
|
6280
|
+
* @see https://docs.anilist.co/reference/object/thread
|
|
6281
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6282
|
+
* @example
|
|
6283
|
+
* ```typescript
|
|
6284
|
+
* const result = await new ToggleThreadSubscriptionMutation("your-token").toggleThreadSubscription({ threadId: 1, subscribe: true });
|
|
6285
|
+
* ```
|
|
5935
6286
|
*/
|
|
5936
6287
|
async toggleThreadSubscription(variables, options) {
|
|
5937
6288
|
const mutation = `
|
|
@@ -5966,13 +6317,17 @@ const SaveThreadCommentMappings = {
|
|
|
5966
6317
|
};
|
|
5967
6318
|
class SaveThreadCommentMutation extends AniListOperation {
|
|
5968
6319
|
/**
|
|
5969
|
-
*
|
|
6320
|
+
* {@link SaveThreadCommentMutation.saveThreadComment} sends a mutation request to save a thread comment.
|
|
5970
6321
|
*
|
|
5971
|
-
* @param variables -
|
|
5972
|
-
* @returns
|
|
5973
|
-
* @throws
|
|
5974
|
-
*
|
|
5975
|
-
* @param options - Optional
|
|
6322
|
+
* @param variables - Values from {@link SaveThreadCommentVariables} for the mutation.
|
|
6323
|
+
* @returns The {@link ThreadCommentResponse} returned by the mutation.
|
|
6324
|
+
* @throws Throws if no authentication token is configured, `id` or `threadId` is missing, a variable has an invalid type, or the mutation request fails.
|
|
6325
|
+
* @see https://docs.anilist.co/reference/object/threadcomment
|
|
6326
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6327
|
+
* @example
|
|
6328
|
+
* ```typescript
|
|
6329
|
+
* const result = await new SaveThreadCommentMutation("your-token").saveThreadComment({ id: 1, threadId: 1, parentCommentId: 0, comment: "Hello, world!", locked: false, asHtml: true });
|
|
6330
|
+
* ```
|
|
5976
6331
|
*/
|
|
5977
6332
|
async saveThreadComment(variables, options) {
|
|
5978
6333
|
const mutation = `
|
|
@@ -6002,18 +6357,22 @@ const DeleteThreadCommentMappings = {
|
|
|
6002
6357
|
};
|
|
6003
6358
|
class DeleteThreadCommentMutation extends AniListOperation {
|
|
6004
6359
|
/**
|
|
6005
|
-
*
|
|
6360
|
+
* {@link DeleteThreadCommentMutation.deleteThreadComment} sends a mutation request to delete a thread comment.
|
|
6006
6361
|
*
|
|
6007
6362
|
* The response is `{ deleted: boolean }`. A `true` value means the comment was deleted by this
|
|
6008
6363
|
* call; a `false` value means the comment was not present (already deleted or never existed).
|
|
6009
6364
|
* The mutation is therefore safe to retry after a partial failure: a `false` result confirms
|
|
6010
6365
|
* the target is gone rather than reporting an error.
|
|
6011
6366
|
*
|
|
6012
|
-
* @param variables -
|
|
6013
|
-
* @returns
|
|
6014
|
-
* @throws
|
|
6367
|
+
* @param variables - Values from {@link DeleteThreadCommentVariables} for the mutation.
|
|
6368
|
+
* @returns The {@link DeleteResult} returned by the mutation.
|
|
6369
|
+
* @throws Throws if no authentication token is configured, `id` is missing or invalid, or the mutation request fails.
|
|
6015
6370
|
* @see https://docs.anilist.co/reference/object/deleted
|
|
6016
|
-
* @param options - Optional
|
|
6371
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6372
|
+
* @example
|
|
6373
|
+
* ```typescript
|
|
6374
|
+
* const result = await new DeleteThreadCommentMutation("your-token").deleteThreadComment({ id: 1 });
|
|
6375
|
+
* ```
|
|
6017
6376
|
*/
|
|
6018
6377
|
async deleteThreadComment(variables, options) {
|
|
6019
6378
|
const mutation = `
|
|
@@ -6046,13 +6405,17 @@ const UpdateAniChartSettingsMappings = {
|
|
|
6046
6405
|
};
|
|
6047
6406
|
class UpdateAniChartSettingsMutation extends AniListOperation {
|
|
6048
6407
|
/**
|
|
6049
|
-
*
|
|
6408
|
+
* {@link UpdateAniChartSettingsMutation.updateAniChartSettings} sends a mutation request to update the AniChart settings.
|
|
6050
6409
|
*
|
|
6051
|
-
* @param variables -
|
|
6052
|
-
* @returns
|
|
6053
|
-
* @throws
|
|
6410
|
+
* @param variables - Values from {@link UpdateAniChartSettingsVariables} for the mutation.
|
|
6411
|
+
* @returns The updated AniChart settings string returned by the mutation.
|
|
6412
|
+
* @throws Throws if no authentication token is configured, a setting has an invalid type, or the mutation request fails.
|
|
6054
6413
|
* @see https://docs.anilist.co/reference/object/anichartuser
|
|
6055
|
-
* @param options - Optional
|
|
6414
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6415
|
+
* @example
|
|
6416
|
+
* ```typescript
|
|
6417
|
+
* const result = await new UpdateAniChartSettingsMutation("your-token").updateAniChartSettings({ titleLanguage: "romaji", outgoingLinkProvider: "ANILIST", theme: "dark", sort: "POPULARITY" });
|
|
6418
|
+
* ```
|
|
6056
6419
|
*/
|
|
6057
6420
|
async updateAniChartSettings(variables, options) {
|
|
6058
6421
|
const mutation = `
|
|
@@ -6076,13 +6439,17 @@ const UpdateAniChartHighlightsMappings = {
|
|
|
6076
6439
|
};
|
|
6077
6440
|
class UpdateAniChartHighlightsMutation extends AniListOperation {
|
|
6078
6441
|
/**
|
|
6079
|
-
*
|
|
6442
|
+
* {@link UpdateAniChartHighlightsMutation.updateAniChartHighlights} sends a mutation request to update the AniChart highlights.
|
|
6080
6443
|
*
|
|
6081
|
-
* @param variables -
|
|
6082
|
-
* @returns
|
|
6083
|
-
* @throws
|
|
6444
|
+
* @param variables - Values from {@link UpdateAniChartHighlightsVariables} for the mutation.
|
|
6445
|
+
* @returns The updated AniChart highlights string returned by the mutation.
|
|
6446
|
+
* @throws Throws if no authentication token is configured, `highlights` is missing or invalid, or the mutation request fails.
|
|
6084
6447
|
* @see https://docs.anilist.co/reference/object/anichartuser
|
|
6085
|
-
* @param options - Optional
|
|
6448
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6449
|
+
* @example
|
|
6450
|
+
* ```typescript
|
|
6451
|
+
* const result = await new UpdateAniChartHighlightsMutation("your-token").updateAniChartHighlights({ highlights: { mediaId: 1, highlight: true } });
|
|
6452
|
+
* ```
|
|
6086
6453
|
*/
|
|
6087
6454
|
async updateAniChartHighlights(variables, options) {
|
|
6088
6455
|
const mutation = `
|
|
@@ -6123,13 +6490,17 @@ const UpdateMediaListEntriesMappings = {
|
|
|
6123
6490
|
};
|
|
6124
6491
|
class UpdateMediaListEntriesMutation extends AniListOperation {
|
|
6125
6492
|
/**
|
|
6126
|
-
*
|
|
6493
|
+
* {@link UpdateMediaListEntriesMutation.updateMediaListEntries} sends a mutation request to update media list entries.
|
|
6127
6494
|
*
|
|
6128
|
-
* @param variables -
|
|
6129
|
-
* @returns
|
|
6130
|
-
* @throws
|
|
6131
|
-
*
|
|
6132
|
-
* @param options - Optional
|
|
6495
|
+
* @param variables - Values from {@link UpdateMediaListEntriesVariables} for the mutation.
|
|
6496
|
+
* @returns The updated {@link MediaListResponse} entries returned by the mutation.
|
|
6497
|
+
* @throws Throws if no authentication token is configured, `ids` is missing or invalid, or the mutation request fails.
|
|
6498
|
+
* @see https://docs.anilist.co/reference/object/medialist
|
|
6499
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6500
|
+
* @example
|
|
6501
|
+
* ```typescript
|
|
6502
|
+
* const result = await new UpdateMediaListEntriesMutation("your-token").updateMediaListEntries({ ids: [1], status: "CURRENT", progress: 1 });
|
|
6503
|
+
* ```
|
|
6133
6504
|
*/
|
|
6134
6505
|
async updateMediaListEntries(variables, options) {
|
|
6135
6506
|
const mutation = `
|
|
@@ -6245,13 +6616,17 @@ const UpdateUserMappings = {
|
|
|
6245
6616
|
};
|
|
6246
6617
|
class UpdateUserMutation extends AniListOperation {
|
|
6247
6618
|
/**
|
|
6248
|
-
*
|
|
6619
|
+
* {@link UpdateUserMutation.updateUser} sends a mutation request to update a user.
|
|
6249
6620
|
*
|
|
6250
|
-
* @param variables -
|
|
6251
|
-
* @returns
|
|
6252
|
-
* @throws
|
|
6621
|
+
* @param variables - Values from {@link UpdateUserVariables} for the mutation.
|
|
6622
|
+
* @returns The {@link UpdateUserResponse} returned by the mutation.
|
|
6623
|
+
* @throws Throws if no authentication token is configured, a variable has an invalid type, or the mutation request fails.
|
|
6253
6624
|
* @see https://docs.anilist.co/reference/object/user
|
|
6254
|
-
* @param options - Optional
|
|
6625
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6626
|
+
* @example
|
|
6627
|
+
* ```typescript
|
|
6628
|
+
* const result = await new UpdateUserMutation("your-token").updateUser({ about: "Updated profile" });
|
|
6629
|
+
* ```
|
|
6255
6630
|
*/
|
|
6256
6631
|
async updateUser(variables, options) {
|
|
6257
6632
|
const mutation = `
|
|
@@ -6337,13 +6712,17 @@ const SaveMediaListEntryMappings = {
|
|
|
6337
6712
|
};
|
|
6338
6713
|
class SaveMediaListEntryMutation extends AniListOperation {
|
|
6339
6714
|
/**
|
|
6340
|
-
*
|
|
6715
|
+
* {@link SaveMediaListEntryMutation.saveMediaListEntry} sends a mutation request to save a media list entry.
|
|
6341
6716
|
*
|
|
6342
|
-
* @param variables -
|
|
6343
|
-
* @returns
|
|
6344
|
-
* @throws
|
|
6717
|
+
* @param variables - Values from {@link SaveMediaListEntryVariables} for the mutation.
|
|
6718
|
+
* @returns The {@link MediaListResponse} returned by the mutation.
|
|
6719
|
+
* @throws Throws if no authentication token is configured, `mediaId` is missing or invalid, or the mutation request fails.
|
|
6345
6720
|
* @see https://docs.anilist.co/reference/object/medialist
|
|
6346
|
-
* @param options - Optional
|
|
6721
|
+
* @param options - Optional {@link RequestOptions} merged over the instance-level settings for this call only.
|
|
6722
|
+
* @example
|
|
6723
|
+
* ```typescript
|
|
6724
|
+
* const result = await new SaveMediaListEntryMutation("your-token").saveMediaListEntry({ mediaId: 1, status: "COMPLETED" });
|
|
6725
|
+
* ```
|
|
6347
6726
|
*/
|
|
6348
6727
|
async saveMediaListEntry(variables, options) {
|
|
6349
6728
|
const mutation = `
|
|
@@ -6515,10 +6894,178 @@ function buildAniListApi(authToken, options) {
|
|
|
6515
6894
|
return buildAniListWiring(authToken, options);
|
|
6516
6895
|
}
|
|
6517
6896
|
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6897
|
+
const resolveTransportOptions = (credentials, providerFields) => {
|
|
6898
|
+
const options = Object.fromEntries(
|
|
6899
|
+
Object.entries(credentials).filter(([key]) => !providerFields.includes(key))
|
|
6900
|
+
);
|
|
6901
|
+
return Object.keys(options).length === 0 ? void 0 : options;
|
|
6902
|
+
};
|
|
6903
|
+
function resolveAniListCredentials(credentials) {
|
|
6904
|
+
if (credentials === void 0) return {};
|
|
6905
|
+
return {
|
|
6906
|
+
auth: credentials.authToken,
|
|
6907
|
+
options: resolveTransportOptions(credentials, ["authToken"])
|
|
6908
|
+
};
|
|
6909
|
+
}
|
|
6910
|
+
function resolveMalCredentials(credentials) {
|
|
6911
|
+
if (credentials === void 0) return {};
|
|
6912
|
+
const headers = credentials.clientId === void 0 ? void 0 : { "X-MAL-CLIENT-ID": credentials.clientId };
|
|
6913
|
+
return {
|
|
6914
|
+
auth: credentials.accessToken === void 0 && headers === void 0 ? void 0 : { token: credentials.accessToken, headers },
|
|
6915
|
+
options: resolveTransportOptions(credentials, [
|
|
6916
|
+
"accessToken",
|
|
6917
|
+
"refreshToken",
|
|
6918
|
+
"clientId",
|
|
6919
|
+
"clientSecret"
|
|
6920
|
+
])
|
|
6921
|
+
};
|
|
6922
|
+
}
|
|
6923
|
+
|
|
6924
|
+
const buildQueryString = (params) => {
|
|
6925
|
+
const segments = [];
|
|
6926
|
+
for (const [key, value] of Object.entries(params)) {
|
|
6927
|
+
if (value === void 0 || value === null) {
|
|
6928
|
+
continue;
|
|
6929
|
+
}
|
|
6930
|
+
const encodedKey = encodeURIComponent(key);
|
|
6931
|
+
if (Array.isArray(value)) {
|
|
6932
|
+
for (const item of value) {
|
|
6933
|
+
if (item !== void 0 && item !== null) {
|
|
6934
|
+
segments.push(`${encodedKey}=${encodeURIComponent(String(item))}`);
|
|
6935
|
+
}
|
|
6936
|
+
}
|
|
6937
|
+
} else {
|
|
6938
|
+
segments.push(`${encodedKey}=${encodeURIComponent(String(value))}`);
|
|
6939
|
+
}
|
|
6940
|
+
}
|
|
6941
|
+
return segments.length > 0 ? `?${segments.join("&")}` : "";
|
|
6942
|
+
};
|
|
6943
|
+
class RestOperation extends BaseOperation {
|
|
6944
|
+
/**
|
|
6945
|
+
* Sends one REST call through the shared transport pipeline.
|
|
6946
|
+
*
|
|
6947
|
+
* GET and DELETE calls pass their parameters as a query string; POST and
|
|
6948
|
+
* PUT calls send them as a JSON body. Responses are returned verbatim —
|
|
6949
|
+
* REST providers have no GraphQL-style envelope, so no unwrapping happens.
|
|
6950
|
+
*
|
|
6951
|
+
* @typeParam T - The expected parsed response body.
|
|
6952
|
+
* @param path - The endpoint path beginning with `/` (for example `/anime/{id}`); placeholders are substituted from `pathParams` before interpolation into the URL.
|
|
6953
|
+
* @param options - The declarative request contract: method, auth requirement, content type, and per-request transport settings.
|
|
6954
|
+
* @param query - Query parameters appended to the URL (GET/DELETE), when provided.
|
|
6955
|
+
* @param body - The JSON request body (POST/PUT), when provided.
|
|
6956
|
+
* @param pathParams - Values substituted into `{placeholder}` segments of `path`. Defaults to an empty map so paths without placeholders need none.
|
|
6957
|
+
* @returns The parsed response body as-is.
|
|
6958
|
+
* @throws An {@link AniLinkAuthError} when `requiresAuth` is true and no token is set, or a normalized {@link AniLinkError} (typically `AniLinkRestError`) when the request fails.
|
|
6959
|
+
*/
|
|
6960
|
+
async execute(path, options = {}, query, body, pathParams = {}) {
|
|
6961
|
+
const { method = "GET", requiresAuth = false, contentType, transportOptions } = options;
|
|
6962
|
+
const interpolatedPath = path.replace(/\{(\w+)\}/g, (match, name) => {
|
|
6963
|
+
const value = pathParams[name];
|
|
6964
|
+
return value === void 0 ? match : encodeURIComponent(String(value));
|
|
6965
|
+
});
|
|
6966
|
+
const url = `${this.baseUrl}${interpolatedPath}${buildQueryString(query ?? {})}`;
|
|
6967
|
+
const carriesBody = method === "POST" || method === "PUT";
|
|
6968
|
+
const effectiveContentType = contentType ?? "application/json";
|
|
6969
|
+
return await this.dispatch(
|
|
6970
|
+
url,
|
|
6971
|
+
method,
|
|
6972
|
+
carriesBody ? body : void 0,
|
|
6973
|
+
requiresAuth,
|
|
6974
|
+
void 0,
|
|
6975
|
+
transportOptions,
|
|
6976
|
+
effectiveContentType
|
|
6977
|
+
);
|
|
6978
|
+
}
|
|
6979
|
+
}
|
|
6980
|
+
|
|
6981
|
+
const MAL_API_BASE_URL = "https://api.myanimelist.net/v2";
|
|
6982
|
+
const MAL_AUTHORIZE_URL = "https://myanimelist.net/v1/oauth2/authorize";
|
|
6983
|
+
const MAL_TOKEN_URL = "https://myanimelist.net/v1/oauth2/token";
|
|
6984
|
+
const MAL_API_REFERENCE = "https://myanimelist.net/apiconfig/references/api/v2";
|
|
6985
|
+
|
|
6986
|
+
class MalAnimeOperation extends RestOperation {
|
|
6987
|
+
/** The base URL for MyAnimeList API v2, from {@link MAL_API_BASE_URL}. */
|
|
6988
|
+
baseUrl = MAL_API_BASE_URL;
|
|
6989
|
+
/**
|
|
6990
|
+
* {@link MalAnimeOperation.get} gets one anime by its MyAnimeList ID.
|
|
6991
|
+
*
|
|
6992
|
+
* It calls `GET /anime/{id}` through `RestOperation.execute` and returns a {@link MalAnime} shaped by {@link MalRequestOptions.fields}. The facade alias is `MyAnimeListAnimeApi.get`.
|
|
6993
|
+
*
|
|
6994
|
+
* @param id - The MyAnimeList anime ID.
|
|
6995
|
+
* @param options - Optional field selection and transport settings; a {@link MalRequestOptions} merged over the instance defaults.
|
|
6996
|
+
* @returns The requested {@link MalAnime}.
|
|
6997
|
+
* @throws A normalized `AniLinkError` when the request fails.
|
|
6998
|
+
* @example
|
|
6999
|
+
* ```typescript
|
|
7000
|
+
* const api = new AniLink({ mal: { accessToken: "mal-token" } }).mal;
|
|
7001
|
+
* const anime = await api.anime.get(21, { fields: ["id", "title"] });
|
|
7002
|
+
* ```
|
|
7003
|
+
* @see https://myanimelist.net/apiconfig/references/api/v2#tag/anime/operation/anime_anime_id_get
|
|
7004
|
+
*/
|
|
7005
|
+
async get(id, options = {}) {
|
|
7006
|
+
const { fields, ...transportOptions } = options;
|
|
7007
|
+
return await this.execute(
|
|
7008
|
+
"/anime/{id}",
|
|
7009
|
+
{ transportOptions },
|
|
7010
|
+
fields === void 0 ? void 0 : { fields: Array.isArray(fields) ? fields.join(",") : fields },
|
|
7011
|
+
void 0,
|
|
7012
|
+
{ id }
|
|
7013
|
+
);
|
|
7014
|
+
}
|
|
7015
|
+
}
|
|
7016
|
+
|
|
7017
|
+
class MalUserOperation extends RestOperation {
|
|
7018
|
+
/** The base URL for MyAnimeList API v2, from {@link MAL_API_BASE_URL}. */
|
|
7019
|
+
baseUrl = MAL_API_BASE_URL;
|
|
7020
|
+
/**
|
|
7021
|
+
* {@link MalUserOperation.me} gets the currently authenticated MyAnimeList user.
|
|
7022
|
+
*
|
|
7023
|
+
* It calls `GET /users/@me` through `RestOperation.execute` with `requiresAuth` and returns a {@link MalUser} shaped by {@link MalRequestOptions.fields}. The facade alias is `MyAnimeListUserApi.me` and it requires `MalCredentials.accessToken`.
|
|
7024
|
+
*
|
|
7025
|
+
* @param options - Optional field selection and transport settings; a {@link MalRequestOptions} merged over the instance defaults.
|
|
7026
|
+
* @returns The authenticated {@link MalUser}.
|
|
7027
|
+
* @throws An `AniLinkAuthError` without an access token, or a normalized request error.
|
|
7028
|
+
* @example
|
|
7029
|
+
* ```typescript
|
|
7030
|
+
* const api = new AniLink({ mal: { accessToken: "mal-token" } }).mal;
|
|
7031
|
+
* const user = await api.user.me({ fields: ["id", "name"] });
|
|
7032
|
+
* ```
|
|
7033
|
+
* @see https://myanimelist.net/apiconfig/references/api/v2#tag/users/operation/users_user_id_get
|
|
7034
|
+
*/
|
|
7035
|
+
async me(options = {}) {
|
|
7036
|
+
const { fields, ...transportOptions } = options;
|
|
7037
|
+
return await this.execute(
|
|
7038
|
+
"/users/@me",
|
|
7039
|
+
{ requiresAuth: true, transportOptions },
|
|
7040
|
+
fields === void 0 ? void 0 : { fields: Array.isArray(fields) ? fields.join(",") : fields }
|
|
7041
|
+
);
|
|
7042
|
+
}
|
|
7043
|
+
}
|
|
7044
|
+
|
|
7045
|
+
function buildMyAnimeListApi(credentials) {
|
|
7046
|
+
const { auth, options } = resolveMalCredentials(credentials);
|
|
7047
|
+
const anime = new MalAnimeOperation(auth, options);
|
|
7048
|
+
const user = new MalUserOperation(auth, options);
|
|
7049
|
+
return {
|
|
7050
|
+
anime: { get: anime.get.bind(anime) },
|
|
7051
|
+
user: { me: user.me.bind(user) }
|
|
7052
|
+
};
|
|
7053
|
+
}
|
|
7054
|
+
|
|
7055
|
+
const buildAniListClient = (credentials, legacyOptions) => {
|
|
7056
|
+
const resolved = resolveAniListCredentials(credentials);
|
|
7057
|
+
return buildAniListApi(resolved.auth, resolved.options ?? legacyOptions);
|
|
7058
|
+
};
|
|
7059
|
+
const buildMalClient = (credentials) => buildMyAnimeListApi(credentials);
|
|
7060
|
+
const PROVIDER_FACTORIES = {
|
|
7061
|
+
anilist: buildAniListClient,
|
|
7062
|
+
mal: buildMalClient
|
|
7063
|
+
};
|
|
7064
|
+
function buildProviderClients(credentials = {}, legacyOptions) {
|
|
7065
|
+
return {
|
|
7066
|
+
anilist: PROVIDER_FACTORIES.anilist(credentials.anilist, legacyOptions),
|
|
7067
|
+
mal: PROVIDER_FACTORIES.mal(credentials.mal)
|
|
7068
|
+
};
|
|
6522
7069
|
}
|
|
6523
7070
|
|
|
6524
7071
|
const AUTH_TOKEN_TIMEOUT_MS = 1e4;
|
|
@@ -6610,22 +7157,105 @@ const refreshAccessToken = async (clientId, clientSecret, refreshToken, signal)
|
|
|
6610
7157
|
);
|
|
6611
7158
|
const getTokenExpiry = (response, now = Date.now()) => new Date(now + response.expires_in * 1e3);
|
|
6612
7159
|
|
|
7160
|
+
const MAL_AUTH_TIMEOUT_MS = 1e4;
|
|
7161
|
+
const buildMalAuthorizationUrl = (clientId, codeChallenge, state) => {
|
|
7162
|
+
const params = new URLSearchParams({
|
|
7163
|
+
response_type: "code",
|
|
7164
|
+
client_id: clientId,
|
|
7165
|
+
code_challenge: codeChallenge,
|
|
7166
|
+
code_challenge_method: "S256"
|
|
7167
|
+
});
|
|
7168
|
+
if (state !== void 0) params.set("state", state);
|
|
7169
|
+
return `${MAL_AUTHORIZE_URL}?${params.toString().replaceAll("+", "%20")}`;
|
|
7170
|
+
};
|
|
7171
|
+
const normalizeMalTokenError = (error) => {
|
|
7172
|
+
if (error instanceof AniLinkApiError) {
|
|
7173
|
+
error.message = `MAL token request failed with status ${error.status}.`;
|
|
7174
|
+
return error;
|
|
7175
|
+
}
|
|
7176
|
+
if (error instanceof AniLinkError) return error;
|
|
7177
|
+
if (axios.isCancel(error)) {
|
|
7178
|
+
return new AniLinkNetworkError(
|
|
7179
|
+
AniLinkErrorCodes.ABORTED,
|
|
7180
|
+
"The MAL token request was cancelled."
|
|
7181
|
+
);
|
|
7182
|
+
}
|
|
7183
|
+
if (axios.isAxiosError(error)) {
|
|
7184
|
+
if (error.response?.status !== void 0) {
|
|
7185
|
+
const apiError = new AniLinkApiError(error.response.status, error.response.data);
|
|
7186
|
+
apiError.message = `MAL token request failed with status ${error.response.status}.`;
|
|
7187
|
+
return apiError;
|
|
7188
|
+
}
|
|
7189
|
+
if (error.code === "ECONNABORTED" || error.code === "ETIMEDOUT") {
|
|
7190
|
+
return new AniLinkNetworkError(
|
|
7191
|
+
AniLinkErrorCodes.TIMEOUT,
|
|
7192
|
+
"The MAL token request timed out."
|
|
7193
|
+
);
|
|
7194
|
+
}
|
|
7195
|
+
return new AniLinkNetworkError(
|
|
7196
|
+
AniLinkErrorCodes.NETWORK,
|
|
7197
|
+
"The MAL token request failed due to a network error."
|
|
7198
|
+
);
|
|
7199
|
+
}
|
|
7200
|
+
return new AniLinkError("The MAL token request failed.", AniLinkErrorCodes.UNKNOWN);
|
|
7201
|
+
};
|
|
7202
|
+
const requestMalToken = async (params, options) => {
|
|
7203
|
+
try {
|
|
7204
|
+
return await sendRequest(
|
|
7205
|
+
MAL_TOKEN_URL,
|
|
7206
|
+
"POST",
|
|
7207
|
+
new URLSearchParams(params).toString(),
|
|
7208
|
+
void 0,
|
|
7209
|
+
false,
|
|
7210
|
+
{
|
|
7211
|
+
...options,
|
|
7212
|
+
timeout: options?.timeout ?? MAL_AUTH_TIMEOUT_MS,
|
|
7213
|
+
exposeRawAxiosError: false
|
|
7214
|
+
},
|
|
7215
|
+
void 0,
|
|
7216
|
+
"application/x-www-form-urlencoded"
|
|
7217
|
+
);
|
|
7218
|
+
} catch (error) {
|
|
7219
|
+
throw normalizeMalTokenError(error);
|
|
7220
|
+
}
|
|
7221
|
+
};
|
|
7222
|
+
const getMalAccessToken = (request) => requestMalToken(
|
|
7223
|
+
{
|
|
7224
|
+
client_id: request.clientId,
|
|
7225
|
+
code: request.code,
|
|
7226
|
+
code_verifier: request.codeVerifier,
|
|
7227
|
+
grant_type: "authorization_code",
|
|
7228
|
+
...request.clientSecret === void 0 ? {} : { client_secret: request.clientSecret }
|
|
7229
|
+
},
|
|
7230
|
+
request.options
|
|
7231
|
+
);
|
|
7232
|
+
const refreshMalAccessToken = (request) => requestMalToken(
|
|
7233
|
+
{
|
|
7234
|
+
client_id: request.clientId,
|
|
7235
|
+
grant_type: "refresh_token",
|
|
7236
|
+
refresh_token: request.refreshToken,
|
|
7237
|
+
...request.clientSecret === void 0 ? {} : { client_secret: request.clientSecret }
|
|
7238
|
+
},
|
|
7239
|
+
request.options
|
|
7240
|
+
);
|
|
7241
|
+
const getMalTokenExpiry = (response, now = Date.now()) => new Date(now + response.expires_in * 1e3);
|
|
7242
|
+
|
|
6613
7243
|
class AniLink {
|
|
6614
7244
|
/**
|
|
6615
|
-
*
|
|
7245
|
+
* The AniList GraphQL API surface, a {@link AniListApi} composed from the
|
|
7246
|
+
* query, mutation, custom, and helper groups.
|
|
6616
7247
|
* @public
|
|
6617
7248
|
*/
|
|
6618
7249
|
anilist;
|
|
6619
|
-
/**
|
|
6620
|
-
* MyAnimeList API methods. Populated once the MAL provider module ships;
|
|
6621
|
-
* the constructor already accepts and stores MAL credentials so adding
|
|
6622
|
-
* the provider requires no further constructor change.
|
|
6623
|
-
*/
|
|
7250
|
+
/** The MyAnimeList REST API methods, a {@link MyAnimeListApi} exposed under the `mal` namespace. */
|
|
6624
7251
|
mal;
|
|
6625
7252
|
/**
|
|
6626
|
-
* Creates a new AniLink instance. The `authToken` parameter is optional and only
|
|
7253
|
+
* Creates a new {@link AniLink} instance. The `authToken` parameter is optional and only
|
|
7254
|
+
* required for authenticated queries and mutations; without it only public queries are
|
|
7255
|
+
* available. Multiple instances can hold different `authToken`s, each exposing an
|
|
7256
|
+
* {@link AniListApi} under `anilist` and a {@link MyAnimeListApi} under `mal`.
|
|
6627
7257
|
*
|
|
6628
|
-
* Alternatively, pass a per-provider
|
|
7258
|
+
* Alternatively, pass a per-provider {@link AniLinkCredentials} object: each provider
|
|
6629
7259
|
* owns its own credentials shape, and credentials given under one key are
|
|
6630
7260
|
* never applied to another provider's requests.
|
|
6631
7261
|
* @param {string | AniLinkCredentials} [authToken] - The authentication token to use for AniList API requests, or a per-provider credentials object (`{ anilist?: …, mal?: … }`).
|
|
@@ -6652,13 +7282,17 @@ class AniLink {
|
|
|
6652
7282
|
* ```
|
|
6653
7283
|
*/
|
|
6654
7284
|
constructor(authToken, options) {
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
7285
|
+
let clients;
|
|
7286
|
+
if (typeof authToken === "string") {
|
|
7287
|
+
clients = buildProviderClients({ anilist: { authToken } }, options);
|
|
7288
|
+
} else if (authToken === void 0) {
|
|
7289
|
+
clients = buildProviderClients({}, options);
|
|
7290
|
+
} else {
|
|
7291
|
+
clients = buildProviderClients(authToken);
|
|
6658
7292
|
}
|
|
6659
|
-
|
|
6660
|
-
this.
|
|
7293
|
+
this.anilist = clients.anilist;
|
|
7294
|
+
this.mal = clients.mal;
|
|
6661
7295
|
}
|
|
6662
7296
|
}
|
|
6663
7297
|
|
|
6664
|
-
export { ANILIST_AUTHORIZE_URL, ANILIST_TOKEN_URL, AniLink, AniLinkApiError, AniLinkAuthError, AniLinkError, AniLinkErrorCodes, AniLinkGraphQLError, AniLinkNetworkError, AniLinkRestError, AniLinkValidationError, buildAuthorizationUrl, getAccessToken, getTokenExpiry, paginate, paginateChunks, paginatePages, refreshAccessToken };
|
|
7298
|
+
export { ANILIST_AUTHORIZE_URL, ANILIST_TOKEN_URL, AniLink, AniLinkApiError, AniLinkAuthError, AniLinkError, AniLinkErrorCodes, AniLinkGraphQLError, AniLinkNetworkError, AniLinkRestError, AniLinkValidationError, MAL_API_BASE_URL, MAL_API_REFERENCE, MAL_AUTHORIZE_URL, MAL_TOKEN_URL, buildAuthorizationUrl, buildMalAuthorizationUrl, buildMyAnimeListApi, buildProviderClients, getAccessToken, getMalAccessToken, getMalTokenExpiry, getTokenExpiry, paginate, paginateChunks, paginatePages, refreshAccessToken, refreshMalAccessToken };
|