anilink-api-wrapper 1.20.0 → 1.22.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 +6 -227
- package/dist/AniLink.js +25 -3
- package/dist/apis/anilist/interfaces/Activity.js +67 -1
- package/dist/apis/anilist/mutation/DeleteActivity.js +61 -0
- package/dist/apis/anilist/mutation/DeleteCustomList.js +4 -1
- package/dist/apis/anilist/mutation/DeleteMediaListEntry.js +3 -0
- package/dist/apis/anilist/mutation/SaveListActivity.js +64 -0
- package/dist/apis/anilist/mutation/SaveMediaListEntry.js +3 -0
- package/dist/apis/anilist/mutation/SaveMessageActivity.js +68 -0
- package/dist/apis/anilist/mutation/SaveTextActivity.js +3 -0
- package/dist/apis/anilist/mutation/ToggleActivityPin.js +64 -0
- package/dist/apis/anilist/mutation/ToggleActivitySubscription.js +64 -0
- package/dist/apis/anilist/mutation/UpdateMediaListEntries.js +3 -0
- package/dist/apis/anilist/mutation/UpdateUser.js +3 -0
- package/dist/apis/anilist/query/AniChartUser.js +3 -3
- package/dist/apis/anilist/query/Notification.js +3 -0
- package/dist/apis/anilist/query/Viewer.js +3 -0
- package/package.json +10 -4
- package/dist/apis/anilist/interfaces/Stats.js +0 -2
- package/dist/apis/anilist/interfaces/responses/AiringSchedule.js +0 -14
- package/dist/apis/anilist/interfaces/responses/AniChartUser.js +0 -2
- package/dist/apis/anilist/interfaces/responses/Character.js +0 -30
- package/dist/apis/anilist/interfaces/responses/ExternalLinkSourceCollection.js +0 -2
- package/dist/apis/anilist/interfaces/responses/Media.js +0 -210
- package/dist/apis/anilist/interfaces/responses/MediaList.js +0 -32
- package/dist/apis/anilist/interfaces/responses/MediaListCollectionResponse.js +0 -41
- package/dist/apis/anilist/interfaces/responses/MediaTag.js +0 -2
- package/dist/apis/anilist/interfaces/responses/MediaTagCollection.js +0 -2
- package/dist/apis/anilist/interfaces/responses/MediaTrend.js +0 -17
- package/dist/apis/anilist/interfaces/responses/Notification.js +0 -164
- package/dist/apis/anilist/interfaces/responses/Recommendation.js +0 -19
- package/dist/apis/anilist/interfaces/responses/Review.js +0 -26
- package/dist/apis/anilist/interfaces/responses/SiteStatistics.js +0 -27
- package/dist/apis/anilist/interfaces/responses/Staff.js +0 -55
- package/dist/apis/anilist/interfaces/responses/Studio.js +0 -56
- package/dist/apis/anilist/interfaces/responses/Thread.js +0 -40
- package/dist/apis/anilist/interfaces/responses/ThreadComment.js +0 -27
- package/dist/apis/anilist/interfaces/responses/User.js +0 -362
- package/dist/apis/anilist/query/Like.js +0 -69
- package/dist/apis/anilist/types/MediaListStatus.js +0 -15
- package/dist/apis/anilist/types/ScoreFormat.js +0 -14
package/README.md
CHANGED
|
@@ -118,6 +118,10 @@ List of methods in `anilist.mutation`:
|
|
|
118
118
|
- deleteMediaListEntries
|
|
119
119
|
- deleteCustomLists
|
|
120
120
|
- saveTextActivity
|
|
121
|
+
- saveMessageActivity
|
|
122
|
+
- deleteActivity
|
|
123
|
+
- toggleActivityPin
|
|
124
|
+
- toggleActivitySubscription
|
|
121
125
|
|
|
122
126
|
### Error Handling
|
|
123
127
|
|
|
@@ -199,233 +203,8 @@ Example Error Thrown:
|
|
|
199
203
|
|
|
200
204
|
### Examples
|
|
201
205
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
#### Querying user data
|
|
205
|
-
|
|
206
|
-
```typescript
|
|
207
|
-
// Querying user data
|
|
208
|
-
aniLink.anilist.query.user({id: 542244, isHTML: true});
|
|
209
|
-
|
|
210
|
-
// Querying media data
|
|
211
|
-
aniLink.anilist.query.media({id: 1, type: 'ANIME'});
|
|
212
|
-
|
|
213
|
-
// Querying media trend data
|
|
214
|
-
aniLink.anilist.query.mediaTrend({mediaId: 1, type: 'ANIME'});
|
|
215
|
-
|
|
216
|
-
// Querying airing schedule data
|
|
217
|
-
aniLink.anilist.query.airingSchedule({mediaId: 130590});
|
|
218
|
-
|
|
219
|
-
// Querying character data
|
|
220
|
-
aniLink.anilist.query.character({
|
|
221
|
-
id: 1,
|
|
222
|
-
asHtml: true,
|
|
223
|
-
mediaSort: ['POPULARITY_DESC'],
|
|
224
|
-
mediaType: 'ANIME',
|
|
225
|
-
mediaOnList: true,
|
|
226
|
-
mediaPage: 1,
|
|
227
|
-
mediaPerPage: 10
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
// Querying staff data
|
|
231
|
-
aniLink.anilist.query.staff({
|
|
232
|
-
id: 132186,
|
|
233
|
-
asHtml: true,
|
|
234
|
-
staffMediaSort: ['POPULARITY_DESC'],
|
|
235
|
-
staffMediaType: 'ANIME',
|
|
236
|
-
staffMediaOnList: true,
|
|
237
|
-
staffMediaPage: 1,
|
|
238
|
-
staffMediaPerPage: 10,
|
|
239
|
-
charactersSort: ['ID'],
|
|
240
|
-
charactersPage: 1,
|
|
241
|
-
charactersPerPage: 10,
|
|
242
|
-
characterMediaSort: ['POPULARITY_DESC'],
|
|
243
|
-
characterMediaOnList: true,
|
|
244
|
-
characterMediaPage: 1,
|
|
245
|
-
characterMediaPerPage: 10
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
// Querying media list data
|
|
249
|
-
aniLink.anilist.query.mediaList({userId: 542244});
|
|
250
|
-
|
|
251
|
-
// Querying media list collection data
|
|
252
|
-
aniLink.anilist.query.mediaListCollection({
|
|
253
|
-
userId: 542244,
|
|
254
|
-
type: 'ANIME',
|
|
255
|
-
status: 'COMPLETED',
|
|
256
|
-
chunk: 1,
|
|
257
|
-
perChunk: 10000
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
// Querying genre collection data
|
|
261
|
-
aniLink.anilist.query.genreCollection();
|
|
262
|
-
|
|
263
|
-
// Querying media tag collection data
|
|
264
|
-
aniLink.anilist.query.mediaTagCollection();
|
|
265
|
-
|
|
266
|
-
// Querying viewer data
|
|
267
|
-
aniLink.anilist.query.viewer({isHTML: true});
|
|
268
|
-
|
|
269
|
-
// Querying notification data
|
|
270
|
-
aniLink.anilist.query.notification({asHtml: true});
|
|
271
|
-
|
|
272
|
-
// Querying studio data
|
|
273
|
-
aniLink.anilist.query.studio({id: 561, asHtml: true});
|
|
274
|
-
|
|
275
|
-
// Querying review data
|
|
276
|
-
aniLink.anilist.query.review({id: 8008, asHtml: true});
|
|
277
|
-
|
|
278
|
-
// Querying activity data
|
|
279
|
-
aniLink.anilist.query.activity({id: 723235883, asHtml: true});
|
|
280
|
-
|
|
281
|
-
// Querying activity reply data
|
|
282
|
-
aniLink.anilist.query.activityReply({id: 12191046, asHtml: true});
|
|
283
|
-
|
|
284
|
-
// Querying following data
|
|
285
|
-
aniLink.anilist.query.following({userId: 542244, asHtml: true});
|
|
286
|
-
|
|
287
|
-
// Querying follower data
|
|
288
|
-
aniLink.anilist.query.follower({userId: 542244, asHtml: true});
|
|
289
|
-
|
|
290
|
-
// Querying thread data
|
|
291
|
-
aniLink.anilist.query.thread({id: 71881, asHtml: true});
|
|
292
|
-
|
|
293
|
-
// Querying thread comment data
|
|
294
|
-
aniLink.anilist.query.threadComment({id: 2555166, asHtml: true});
|
|
295
|
-
|
|
296
|
-
// Querying recommendation data
|
|
297
|
-
aniLink.anilist.query.recommendation({mediaId: 156822, asHtml: true});
|
|
298
|
-
|
|
299
|
-
// Querying markdown data
|
|
300
|
-
aniLink.anilist.query.markdown({markdown: 'Hello'});
|
|
301
|
-
|
|
302
|
-
// Querying AniChartUser data
|
|
303
|
-
aniLink.anilist.query.aniChartUser();
|
|
304
|
-
|
|
305
|
-
// Querying site statistics data
|
|
306
|
-
aniLink.anilist.query.siteStatistics();
|
|
307
|
-
|
|
308
|
-
// Querying external link source collection data
|
|
309
|
-
aniLink.anilist.query.externalLinkSourceCollection();
|
|
310
|
-
|
|
311
|
-
// Querying users page data
|
|
312
|
-
aniLink.anilist.query.page.users({id: 542244, isHTML: true});
|
|
313
|
-
|
|
314
|
-
// Querying media page data
|
|
315
|
-
aniLink.anilist.query.page.medias({id: 1, type: 'ANIME'});
|
|
316
|
-
|
|
317
|
-
// Querying character page data
|
|
318
|
-
aniLink.anilist.query.page.characters({id: 1, asHtml: true});
|
|
319
|
-
|
|
320
|
-
// Querying staff page data
|
|
321
|
-
aniLink.anilist.query.page.staffs({id: 132186, asHtml: true});
|
|
322
|
-
|
|
323
|
-
// Querying studio page data
|
|
324
|
-
aniLink.anilist.query.page.studios({id: 561, asHtml: true});
|
|
325
|
-
|
|
326
|
-
// Querying media list page data
|
|
327
|
-
aniLink.anilist.query.page.mediaLists({userId: 542244});
|
|
328
|
-
|
|
329
|
-
// Querying airing schedule page data
|
|
330
|
-
aniLink.anilist.query.page.airingSchedules({mediaId: 130590});
|
|
331
|
-
|
|
332
|
-
// Querying media trend page data
|
|
333
|
-
aniLink.anilist.query.page.mediaTrends({mediaId: 1, type: 'ANIME'});
|
|
334
|
-
|
|
335
|
-
// Querying notification page data
|
|
336
|
-
aniLink.anilist.query.page.notifications({asHtml: true});
|
|
337
|
-
|
|
338
|
-
// Querying follower page data
|
|
339
|
-
aniLink.anilist.query.page.followers({userId: 542244, asHtml: true});
|
|
340
|
-
|
|
341
|
-
// Querying following page data
|
|
342
|
-
aniLink.anilist.query.page.following({userId: 542244, asHtml: true});
|
|
343
|
-
|
|
344
|
-
// Querying activity page data
|
|
345
|
-
aniLink.anilist.query.page.activities({id: 723235883, asHtml: true});
|
|
346
|
-
|
|
347
|
-
// Querying activity reply page data
|
|
348
|
-
aniLink.anilist.query.page.activityReplies({id: 12191046, asHtml: true
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
// Querying thread page data
|
|
352
|
-
aniLink.anilist.query.page.threads({id: 71881, asHtml: true});
|
|
353
|
-
|
|
354
|
-
// Querying thread comment page data
|
|
355
|
-
aniLink.anilist.query.page.threadComments({threadId: 71881, asHtml: true
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
// Querying review page data
|
|
359
|
-
aniLink.anilist.query.page.reviews({id: 8008, asHtml: true});
|
|
360
|
-
|
|
361
|
-
// Querying recommendation page data
|
|
362
|
-
aniLink.anilist.query.page.recommendations({mediaId: 156822, asHtml: true
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
// Querying likes page data
|
|
366
|
-
aniLink.anilist.query.page.likes({likeableId: 723422275, type: 'ACTIVITY', asHtml: true
|
|
367
|
-
});
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
#### Mutating user data
|
|
371
|
-
|
|
372
|
-
```typescript
|
|
373
|
-
// Updating a user
|
|
374
|
-
aniLink.anilist.mutation.updateUser({
|
|
375
|
-
about: 'New about text',
|
|
376
|
-
titleLanguage: 'ENGLISH',
|
|
377
|
-
displayAdultContent: true,
|
|
378
|
-
airingNotifications: true,
|
|
379
|
-
scoreFormat: 'POINT_10',
|
|
380
|
-
rowOrder: 'title',
|
|
381
|
-
profileColor: 'blue',
|
|
382
|
-
donatorBadge: 'Supporter',
|
|
383
|
-
notificationOptions: [{type: 'AIRING', enabled: true}],
|
|
384
|
-
timezone: '-06:00',
|
|
385
|
-
activityMergeTime: 30,
|
|
386
|
-
animeListOptions: {sectionOrder: ['title'], customLists: ['test'], advancedScoring: [], advancedScoringEnabled: false},
|
|
387
|
-
mangaListOptions: {sectionOrder: ['title'], customLists: ['test'], advancedScoring: [], advancedScoringEnabled: false},
|
|
388
|
-
staffNameLanguage: 'ROMAJI',
|
|
389
|
-
restrictMessagesToFollowing: false,
|
|
390
|
-
disabledListActivity: [{type: 'CURRENT', disabled: false}]
|
|
391
|
-
});
|
|
392
|
-
|
|
393
|
-
// Saving media list entries
|
|
394
|
-
aniLink.anilist.mutation.saveMediaListEntry({
|
|
395
|
-
mediaId: 143271,
|
|
396
|
-
status: 'CURRENT',
|
|
397
|
-
score: 8.5,
|
|
398
|
-
progress: 3,
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
// Updating media list entries
|
|
402
|
-
aniLink.anilist.mutation.updateMediaListEntries({
|
|
403
|
-
status: 'CURRENT',
|
|
404
|
-
score: 8.5,
|
|
405
|
-
progress: 3,
|
|
406
|
-
ids: [143271, 156822, 170890],
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
// Deleting custom list
|
|
410
|
-
aniLink.anilist.mutation.deleteCustomLists({customList: 'test'});
|
|
411
|
-
|
|
412
|
-
// Deleting media list entry
|
|
413
|
-
const entryId = (
|
|
414
|
-
await handleRateLimit(() => aniLink.anilist.query.mediaList(
|
|
415
|
-
{
|
|
416
|
-
userId: 6503722,
|
|
417
|
-
mediaId: 143271
|
|
418
|
-
}
|
|
419
|
-
))).data.MediaList.id;
|
|
420
|
-
aniLink.anilist.mutation.deleteMediaListEntry({id: entryId});
|
|
421
|
-
|
|
422
|
-
// Create text activity
|
|
423
|
-
aniLink.anilist.mutation.saveTextActivity({text: 'test'})
|
|
424
|
-
|
|
425
|
-
// Update text activity
|
|
426
|
-
aniLink.anilist.mutation.saveTextActivity({id: 725254160, text: 'Updated Text'})
|
|
427
|
-
```
|
|
206
|
+
See the [ANILIST_API_EXAMPLES](https://github.com/RLAlpha49/AniLink/blob/master/Examples/ANILIST_API_EXAMPLES.md) for examples of how to use AniLink to interact with the AniList API.
|
|
428
207
|
|
|
429
208
|
## License
|
|
430
209
|
|
|
431
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
210
|
+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/RLAlpha49/AniLink/blob/master/LICENSE) file for details.
|
package/dist/AniLink.js
CHANGED
|
@@ -50,14 +50,26 @@ const Viewer_1 = require("./apis/anilist/query/Viewer");
|
|
|
50
50
|
const DeleteMediaListEntry_1 = require("./apis/anilist/mutation/DeleteMediaListEntry");
|
|
51
51
|
const DeleteCustomList_1 = require("./apis/anilist/mutation/DeleteCustomList");
|
|
52
52
|
const SaveTextActivity_1 = require("./apis/anilist/mutation/SaveTextActivity");
|
|
53
|
+
const SaveMessageActivity_1 = require("./apis/anilist/mutation/SaveMessageActivity");
|
|
54
|
+
const SaveListActivity_1 = require("./apis/anilist/mutation/SaveListActivity");
|
|
55
|
+
const DeleteActivity_1 = require("./apis/anilist/mutation/DeleteActivity");
|
|
56
|
+
const ToggleActivitySubscription_1 = require("./apis/anilist/mutation/ToggleActivitySubscription");
|
|
57
|
+
const ToggleActivityPin_1 = require("./apis/anilist/mutation/ToggleActivityPin");
|
|
53
58
|
/**
|
|
54
59
|
* `AniLink` is a class for interacting with the APIs.
|
|
55
60
|
* It provides methods for querying and mutating data.
|
|
56
61
|
*/
|
|
57
62
|
class AniLink {
|
|
58
63
|
/**
|
|
59
|
-
* Creates a new AniLink instance.
|
|
60
|
-
* @param {string} authToken - The authentication token to use for API requests.
|
|
64
|
+
* Creates a new AniLink instance. The `authToken` parameter is optional and only required for authenticated queries and mutations. If no `authToken` is provided, only public queries will be available. You are able to create multiple AniLink instances with different `authToken`s.
|
|
65
|
+
* @param {string} [authToken] - The authentication token to use for API requests.
|
|
66
|
+
* @public
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const aniLink = new AniLink('authToken');
|
|
70
|
+
*
|
|
71
|
+
* const aniLink2 = new AniLink();
|
|
72
|
+
* ```
|
|
61
73
|
*/
|
|
62
74
|
constructor(authToken) {
|
|
63
75
|
const userQueryInstance = new User_1.UserQuery(authToken);
|
|
@@ -109,6 +121,11 @@ class AniLink {
|
|
|
109
121
|
const deleteMediaListEntryMutationInstance = new DeleteMediaListEntry_1.DeleteMediaListEntryMutation(authToken);
|
|
110
122
|
const deleteCustomListMutationInstance = new DeleteCustomList_1.DeleteCustomListMutation(authToken);
|
|
111
123
|
const saveTextActivityMutationInstance = new SaveTextActivity_1.SaveTextActivityMutation(authToken);
|
|
124
|
+
const saveMessageActivityMutationInstance = new SaveMessageActivity_1.SaveMessageActivityMutation(authToken);
|
|
125
|
+
const saveListActivityMutationInstance = new SaveListActivity_1.SaveListActivityMutation(authToken);
|
|
126
|
+
const deleteActivityMutationInstance = new DeleteActivity_1.DeleteActivityMutation(authToken);
|
|
127
|
+
const toggleActivityPinMutationInstance = new ToggleActivityPin_1.ToggleActivityPinMutation(authToken);
|
|
128
|
+
const toggleActivitySubscriptionMutationInstance = new ToggleActivitySubscription_1.ToggleActivitySubscriptionMutation(authToken);
|
|
112
129
|
this.anilist = {
|
|
113
130
|
query: {
|
|
114
131
|
user: userQueryInstance.user.bind(userQueryInstance),
|
|
@@ -163,7 +180,12 @@ class AniLink {
|
|
|
163
180
|
updateMediaListEntries: updateMediaListEntriesMutationInstance.updateMediaListEntries.bind(updateMediaListEntriesMutationInstance),
|
|
164
181
|
deleteMediaListEntry: deleteMediaListEntryMutationInstance.deleteMediaListEntry.bind(deleteMediaListEntryMutationInstance),
|
|
165
182
|
deleteCustomList: deleteCustomListMutationInstance.deleteCustomList.bind(deleteCustomListMutationInstance),
|
|
166
|
-
saveTextActivity: saveTextActivityMutationInstance.saveTextActivity.bind(saveTextActivityMutationInstance)
|
|
183
|
+
saveTextActivity: saveTextActivityMutationInstance.saveTextActivity.bind(saveTextActivityMutationInstance),
|
|
184
|
+
saveMessageActivity: saveMessageActivityMutationInstance.saveMessageActivity.bind(saveMessageActivityMutationInstance),
|
|
185
|
+
saveListActivity: saveListActivityMutationInstance.saveListActivity.bind(saveListActivityMutationInstance),
|
|
186
|
+
deleteActivity: deleteActivityMutationInstance.deleteActivity.bind(deleteActivityMutationInstance),
|
|
187
|
+
toggleActivityPin: toggleActivityPinMutationInstance.toggleActivityPin.bind(toggleActivityPinMutationInstance),
|
|
188
|
+
toggleActivitySubscription: toggleActivitySubscriptionMutationInstance.toggleActivitySubscription.bind(toggleActivitySubscriptionMutationInstance)
|
|
167
189
|
}
|
|
168
190
|
};
|
|
169
191
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextActivitySchema = exports.ActivityWithRepliesSchema = exports.ActivitySchema = void 0;
|
|
3
|
+
exports.MessageActivitySchema = exports.ListActivitySchema = exports.TextActivitySchema = exports.ActivityWithRepliesSchema = exports.ActivitySchema = void 0;
|
|
4
4
|
const BasicUser_1 = require("./BasicUser");
|
|
5
5
|
const ActivityReply_1 = require("./ActivityReply");
|
|
6
6
|
/**
|
|
@@ -176,3 +176,69 @@ exports.TextActivitySchema = `
|
|
|
176
176
|
${BasicUser_1.BasicUserSchema}
|
|
177
177
|
}
|
|
178
178
|
`;
|
|
179
|
+
/**
|
|
180
|
+
* `ListActivitySchema` is an object representing a list activity.
|
|
181
|
+
* It includes the id, user id, type, reply count, status, progress, lock status, subscription status, like count, like status, pin status, site url, creation date, media details, user details, replies, and likes.
|
|
182
|
+
*/
|
|
183
|
+
exports.ListActivitySchema = `
|
|
184
|
+
id
|
|
185
|
+
userId
|
|
186
|
+
type
|
|
187
|
+
replyCount
|
|
188
|
+
status
|
|
189
|
+
progress
|
|
190
|
+
isLocked
|
|
191
|
+
isSubscribed
|
|
192
|
+
likeCount
|
|
193
|
+
isLiked
|
|
194
|
+
isPinned
|
|
195
|
+
siteUrl
|
|
196
|
+
createdAt
|
|
197
|
+
media {
|
|
198
|
+
id
|
|
199
|
+
title {
|
|
200
|
+
romaji
|
|
201
|
+
english
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
user {
|
|
205
|
+
${BasicUser_1.BasicUserSchema}
|
|
206
|
+
}
|
|
207
|
+
replies {
|
|
208
|
+
${ActivityReply_1.ActivityReplySchema}
|
|
209
|
+
}
|
|
210
|
+
likes {
|
|
211
|
+
${BasicUser_1.BasicUserSchema}
|
|
212
|
+
}
|
|
213
|
+
`;
|
|
214
|
+
/**
|
|
215
|
+
* `MessageActivitySchema` is an object representing a message activity.
|
|
216
|
+
* It includes the id, recipient id, messenger id, type, reply count, message, lock status, subscription status, like count, like status, privacy status, site url, creation date, recipient details, messenger details, replies, and likes.
|
|
217
|
+
*/
|
|
218
|
+
exports.MessageActivitySchema = `
|
|
219
|
+
id
|
|
220
|
+
recipientId
|
|
221
|
+
messengerId
|
|
222
|
+
type
|
|
223
|
+
replyCount
|
|
224
|
+
message (asHtml: $asHtml)
|
|
225
|
+
isLocked
|
|
226
|
+
isSubscribed
|
|
227
|
+
likeCount
|
|
228
|
+
isLiked
|
|
229
|
+
isPrivate
|
|
230
|
+
siteUrl
|
|
231
|
+
createdAt
|
|
232
|
+
recipient {
|
|
233
|
+
${BasicUser_1.BasicUserSchema}
|
|
234
|
+
}
|
|
235
|
+
messenger {
|
|
236
|
+
${BasicUser_1.BasicUserSchema}
|
|
237
|
+
}
|
|
238
|
+
replies {
|
|
239
|
+
${ActivityReply_1.ActivityReplySchema}
|
|
240
|
+
}
|
|
241
|
+
likes {
|
|
242
|
+
${BasicUser_1.BasicUserSchema}
|
|
243
|
+
}
|
|
244
|
+
`;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DeleteActivityMutation = void 0;
|
|
13
|
+
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
|
+
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
|
+
/**
|
|
17
|
+
* `DeleteActivityMutation` is a class representing a mutation to delete a activity.
|
|
18
|
+
* It includes a method to delete a activity
|
|
19
|
+
*/
|
|
20
|
+
class DeleteActivityMutation extends APIWrapper_1.APIWrapper {
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a new `DeleteActivityMutation` instance.
|
|
23
|
+
*
|
|
24
|
+
* @param authToken - The authentication token.
|
|
25
|
+
*/
|
|
26
|
+
constructor(authToken) {
|
|
27
|
+
super('https://graphql.anilist.co');
|
|
28
|
+
this.authToken = authToken;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* `deleteActivity` is a method that sends a mutation request to delete a activity.
|
|
32
|
+
*
|
|
33
|
+
* @param variables - An object of type `DeleteActivityVariables` representing the variables for the mutation.
|
|
34
|
+
* @returns A Promise that resolves to the response from the mutation request.
|
|
35
|
+
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
36
|
+
* */
|
|
37
|
+
deleteActivity(variables) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
if (!this.authToken) {
|
|
40
|
+
throw new Error('DeleteActivityMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
41
|
+
}
|
|
42
|
+
if (!variables.id) {
|
|
43
|
+
throw new Error('id variable is required');
|
|
44
|
+
}
|
|
45
|
+
const variableTypeMappings = {
|
|
46
|
+
id: 'number'
|
|
47
|
+
};
|
|
48
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
49
|
+
const mutation = `
|
|
50
|
+
mutation ($id: Int) {
|
|
51
|
+
DeleteActivity(id: $id) {
|
|
52
|
+
deleted
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
const data = { query: mutation, variables };
|
|
57
|
+
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.DeleteActivityMutation = DeleteActivityMutation;
|
|
@@ -29,7 +29,7 @@ class DeleteCustomListMutation extends APIWrapper_1.APIWrapper {
|
|
|
29
29
|
this.authToken = authToken;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* `
|
|
32
|
+
* `deleteCustomList` is a method that sends a mutation request to delete a custom list.
|
|
33
33
|
*
|
|
34
34
|
* @param variables - An object of type `DeleteCustomListVariables` representing the variables for the mutation.
|
|
35
35
|
* @returns A Promise that resolves to the response from the mutation request.
|
|
@@ -37,6 +37,9 @@ class DeleteCustomListMutation extends APIWrapper_1.APIWrapper {
|
|
|
37
37
|
* */
|
|
38
38
|
deleteCustomList(variables) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (!this.authToken) {
|
|
41
|
+
throw new Error('DeleteCustomListMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
+
}
|
|
40
43
|
if (!variables.customList || !variables.type) {
|
|
41
44
|
throw new Error('customList & type variables are required');
|
|
42
45
|
}
|
|
@@ -36,6 +36,9 @@ class DeleteMediaListEntryMutation extends APIWrapper_1.APIWrapper {
|
|
|
36
36
|
* */
|
|
37
37
|
deleteMediaListEntry(variables) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
if (!this.authToken) {
|
|
40
|
+
throw new Error('DeleteMediaListEntryMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
41
|
+
}
|
|
39
42
|
if (!variables.id) {
|
|
40
43
|
throw new Error('id variable is required');
|
|
41
44
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SaveListActivityMutation = void 0;
|
|
13
|
+
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
|
+
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
|
+
const Activity_1 = require("../interfaces/Activity");
|
|
17
|
+
/**
|
|
18
|
+
* `SaveListActivityMutation` is a class representing a mutation to save a list activity.
|
|
19
|
+
* It includes a method to save a list activity
|
|
20
|
+
*/
|
|
21
|
+
class SaveListActivityMutation extends APIWrapper_1.APIWrapper {
|
|
22
|
+
/**
|
|
23
|
+
* Constructs a new `SaveListActivityMutation` instance.
|
|
24
|
+
*
|
|
25
|
+
* @param authToken - The authentication token.
|
|
26
|
+
*/
|
|
27
|
+
constructor(authToken) {
|
|
28
|
+
super('https://graphql.anilist.co');
|
|
29
|
+
this.authToken = authToken;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* `saveListActivity` is a method that sends a mutation request to save a list activity.
|
|
33
|
+
*
|
|
34
|
+
* @param variables - An object of type `SaveListActivityVariables` representing the variables for the mutation.
|
|
35
|
+
* @returns A Promise that resolves to the response from the mutation request.
|
|
36
|
+
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
37
|
+
* */
|
|
38
|
+
saveListActivity(variables) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (!this.authToken) {
|
|
41
|
+
throw new Error('SaveListActivityMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
+
}
|
|
43
|
+
if (!variables.id) {
|
|
44
|
+
throw new Error('id variable is required');
|
|
45
|
+
}
|
|
46
|
+
const variableTypeMappings = {
|
|
47
|
+
id: 'number',
|
|
48
|
+
locked: 'boolean',
|
|
49
|
+
asHtml: 'boolean'
|
|
50
|
+
};
|
|
51
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
52
|
+
const mutation = `
|
|
53
|
+
mutation ($id: Int, $locked: Boolean, $asHtml: Boolean) {
|
|
54
|
+
SaveListActivity(id: $id, locked:$locked)
|
|
55
|
+
${Activity_1.ListActivitySchema}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
const data = { query: mutation, variables };
|
|
60
|
+
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.SaveListActivityMutation = SaveListActivityMutation;
|
|
@@ -39,6 +39,9 @@ class SaveMediaListEntryMutation extends APIWrapper_1.APIWrapper {
|
|
|
39
39
|
*/
|
|
40
40
|
saveMediaListEntry(variables) {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
if (!this.authToken) {
|
|
43
|
+
throw new Error('SaveMediaListEntryMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
44
|
+
}
|
|
42
45
|
if (variables.mediaId === undefined) {
|
|
43
46
|
throw new Error('mediaId is required for SaveMediaListEntryMutation');
|
|
44
47
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SaveMessageActivityMutation = void 0;
|
|
13
|
+
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
|
+
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
|
+
const Activity_1 = require("../interfaces/Activity");
|
|
17
|
+
/**
|
|
18
|
+
* `SaveMessageActivityMutation` is a class representing a mutation to save a message activity.
|
|
19
|
+
* It includes a method to save a message activity
|
|
20
|
+
*/
|
|
21
|
+
class SaveMessageActivityMutation extends APIWrapper_1.APIWrapper {
|
|
22
|
+
/**
|
|
23
|
+
* Constructs a new `SaveMessageActivityMutation` instance.
|
|
24
|
+
*
|
|
25
|
+
* @param authToken - The authentication token.
|
|
26
|
+
*/
|
|
27
|
+
constructor(authToken) {
|
|
28
|
+
super('https://graphql.anilist.co');
|
|
29
|
+
this.authToken = authToken;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* `saveMessageActivity` is a method that sends a mutation request to save a message activity.
|
|
33
|
+
*
|
|
34
|
+
* @param variables - An object of type `SaveMessageActivityVariables` representing the variables for the mutation.
|
|
35
|
+
* @returns A Promise that resolves to the response from the mutation request.
|
|
36
|
+
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
37
|
+
* */
|
|
38
|
+
saveMessageActivity(variables) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (!this.authToken) {
|
|
41
|
+
throw new Error('SaveMessageActivityMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
+
}
|
|
43
|
+
if (!variables.id && !variables.message) {
|
|
44
|
+
throw new Error('id or text variable is required');
|
|
45
|
+
}
|
|
46
|
+
const variableTypeMappings = {
|
|
47
|
+
id: 'number',
|
|
48
|
+
message: 'string',
|
|
49
|
+
recipientId: 'number',
|
|
50
|
+
private: 'boolean',
|
|
51
|
+
locked: 'boolean',
|
|
52
|
+
asMod: 'boolean',
|
|
53
|
+
asHtml: 'boolean'
|
|
54
|
+
};
|
|
55
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
56
|
+
const mutation = `
|
|
57
|
+
mutation ($id: Int, $message: String, $recipientId: Int, $private: Boolean, $locked: Boolean, $asMod: Boolean, $asHtml: Boolean) {
|
|
58
|
+
SaveMessageActivity(id: $id, message: $message, recipientId: $recipientId, private: $private, locked:$locked, asMod: $asMod) {
|
|
59
|
+
${Activity_1.MessageActivitySchema}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
const data = { query: mutation, variables };
|
|
64
|
+
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.SaveMessageActivityMutation = SaveMessageActivityMutation;
|
|
@@ -37,6 +37,9 @@ class SaveTextActivityMutation extends APIWrapper_1.APIWrapper {
|
|
|
37
37
|
* */
|
|
38
38
|
saveTextActivity(variables) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (!this.authToken) {
|
|
41
|
+
throw new Error('SaveTextActivityMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
+
}
|
|
40
43
|
if (!variables.id && !variables.text) {
|
|
41
44
|
throw new Error('id or text variable is required');
|
|
42
45
|
}
|