anilink-api-wrapper 1.0.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.
Files changed (104) hide show
  1. package/.eslintignore +1 -0
  2. package/.github/workflows/code_quality.yml +32 -0
  3. package/.github/workflows/codeql.yml +33 -0
  4. package/.github/workflows/test.yml +30 -0
  5. package/LICENSE +21 -0
  6. package/README.md +1 -0
  7. package/__tests__/anilist.test.ts +268 -0
  8. package/babel.config.js +6 -0
  9. package/dist/AniLink.js +40 -0
  10. package/dist/apis/anilist/interfaces/ActivityHistory.js +2 -0
  11. package/dist/apis/anilist/interfaces/CoverImage.js +2 -0
  12. package/dist/apis/anilist/interfaces/Distribution.js +2 -0
  13. package/dist/apis/anilist/interfaces/ExternalLink.js +2 -0
  14. package/dist/apis/anilist/interfaces/Favoured.js +2 -0
  15. package/dist/apis/anilist/interfaces/FuzzyDate.js +2 -0
  16. package/dist/apis/anilist/interfaces/Image.js +2 -0
  17. package/dist/apis/anilist/interfaces/ListScores.js +2 -0
  18. package/dist/apis/anilist/interfaces/Media.js +2 -0
  19. package/dist/apis/anilist/interfaces/MediaListEntry.js +2 -0
  20. package/dist/apis/anilist/interfaces/MediaStatistics.js +2 -0
  21. package/dist/apis/anilist/interfaces/MediaStats.js +2 -0
  22. package/dist/apis/anilist/interfaces/Name.js +2 -0
  23. package/dist/apis/anilist/interfaces/NextAiringEpisode.js +2 -0
  24. package/dist/apis/anilist/interfaces/Ranking.js +2 -0
  25. package/dist/apis/anilist/interfaces/ScoreDistribution.js +2 -0
  26. package/dist/apis/anilist/interfaces/Staff.js +2 -0
  27. package/dist/apis/anilist/interfaces/Stat.js +2 -0
  28. package/dist/apis/anilist/interfaces/Statistics.js +2 -0
  29. package/dist/apis/anilist/interfaces/Stats.js +2 -0
  30. package/dist/apis/anilist/interfaces/StatusDistribution.js +2 -0
  31. package/dist/apis/anilist/interfaces/StreamingEpisode.js +2 -0
  32. package/dist/apis/anilist/interfaces/Studio.js +2 -0
  33. package/dist/apis/anilist/interfaces/Tag.js +2 -0
  34. package/dist/apis/anilist/interfaces/Title.js +2 -0
  35. package/dist/apis/anilist/interfaces/Trailer.js +2 -0
  36. package/dist/apis/anilist/interfaces/UserStats.js +2 -0
  37. package/dist/apis/anilist/interfaces/responses/AiringSchedule.js +2 -0
  38. package/dist/apis/anilist/interfaces/responses/Character.js +2 -0
  39. package/dist/apis/anilist/interfaces/responses/Media.js +2 -0
  40. package/dist/apis/anilist/interfaces/responses/MediaList.js +2 -0
  41. package/dist/apis/anilist/interfaces/responses/MediaListCollectionResponse.js +2 -0
  42. package/dist/apis/anilist/interfaces/responses/MediaTrend.js +2 -0
  43. package/dist/apis/anilist/interfaces/responses/Staff.js +2 -0
  44. package/dist/apis/anilist/interfaces/responses/User.js +2 -0
  45. package/dist/apis/anilist/mutation/UpdateUser.js +82 -0
  46. package/dist/apis/anilist/query/AiringSchedule.js +147 -0
  47. package/dist/apis/anilist/query/Character.js +69 -0
  48. package/dist/apis/anilist/query/Media.js +232 -0
  49. package/dist/apis/anilist/query/MediaList.js +170 -0
  50. package/dist/apis/anilist/query/MediaListCollection.js +650 -0
  51. package/dist/apis/anilist/query/MediaTrend.js +149 -0
  52. package/dist/apis/anilist/query/Staff.js +108 -0
  53. package/dist/apis/anilist/query/User.js +573 -0
  54. package/dist/base/APIWrapper.js +9 -0
  55. package/dist/base/RequestHandler.js +33 -0
  56. package/jest.config.js +11 -0
  57. package/package.json +31 -0
  58. package/src/AniLink.ts +80 -0
  59. package/src/apis/anilist/interfaces/ActivityHistory.ts +5 -0
  60. package/src/apis/anilist/interfaces/CoverImage.ts +6 -0
  61. package/src/apis/anilist/interfaces/Distribution.ts +4 -0
  62. package/src/apis/anilist/interfaces/ExternalLink.ts +5 -0
  63. package/src/apis/anilist/interfaces/Favoured.ts +15 -0
  64. package/src/apis/anilist/interfaces/FuzzyDate.ts +5 -0
  65. package/src/apis/anilist/interfaces/Image.ts +4 -0
  66. package/src/apis/anilist/interfaces/ListScores.ts +4 -0
  67. package/src/apis/anilist/interfaces/Media.ts +59 -0
  68. package/src/apis/anilist/interfaces/MediaListEntry.ts +4 -0
  69. package/src/apis/anilist/interfaces/MediaStatistics.ts +23 -0
  70. package/src/apis/anilist/interfaces/MediaStats.ts +7 -0
  71. package/src/apis/anilist/interfaces/Name.ts +8 -0
  72. package/src/apis/anilist/interfaces/NextAiringEpisode.ts +5 -0
  73. package/src/apis/anilist/interfaces/Ranking.ts +10 -0
  74. package/src/apis/anilist/interfaces/ScoreDistribution.ts +4 -0
  75. package/src/apis/anilist/interfaces/Staff.ts +6 -0
  76. package/src/apis/anilist/interfaces/Stat.ts +24 -0
  77. package/src/apis/anilist/interfaces/Statistics.ts +6 -0
  78. package/src/apis/anilist/interfaces/StatusDistribution.ts +4 -0
  79. package/src/apis/anilist/interfaces/StreamingEpisode.ts +6 -0
  80. package/src/apis/anilist/interfaces/Studio.ts +4 -0
  81. package/src/apis/anilist/interfaces/Tag.ts +10 -0
  82. package/src/apis/anilist/interfaces/Title.ts +6 -0
  83. package/src/apis/anilist/interfaces/Trailer.ts +5 -0
  84. package/src/apis/anilist/interfaces/UserStats.ts +25 -0
  85. package/src/apis/anilist/interfaces/responses/AiringSchedule.ts +10 -0
  86. package/src/apis/anilist/interfaces/responses/Character.ts +26 -0
  87. package/src/apis/anilist/interfaces/responses/Media.ts +118 -0
  88. package/src/apis/anilist/interfaces/responses/MediaList.ts +24 -0
  89. package/src/apis/anilist/interfaces/responses/MediaListCollectionResponse.ts +37 -0
  90. package/src/apis/anilist/interfaces/responses/MediaTrend.ts +13 -0
  91. package/src/apis/anilist/interfaces/responses/Staff.ts +53 -0
  92. package/src/apis/anilist/interfaces/responses/User.ts +72 -0
  93. package/src/apis/anilist/mutation/UpdateUser.ts +162 -0
  94. package/src/apis/anilist/query/AiringSchedule.ts +160 -0
  95. package/src/apis/anilist/query/Character.ts +75 -0
  96. package/src/apis/anilist/query/Media.ts +295 -0
  97. package/src/apis/anilist/query/MediaList.ts +192 -0
  98. package/src/apis/anilist/query/MediaListCollection.ts +673 -0
  99. package/src/apis/anilist/query/MediaTrend.ts +169 -0
  100. package/src/apis/anilist/query/Staff.ts +122 -0
  101. package/src/apis/anilist/query/User.ts +567 -0
  102. package/src/base/APIWrapper.ts +7 -0
  103. package/src/base/RequestHandler.ts +21 -0
  104. package/tsconfig.json +15 -0
@@ -0,0 +1,650 @@
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.MediaListCollectionQuery = void 0;
13
+ const APIWrapper_1 = require("../../../base/APIWrapper");
14
+ const RequestHandler_1 = require("../../../base/RequestHandler");
15
+ class MediaListCollectionQuery extends APIWrapper_1.APIWrapper {
16
+ constructor(authToken) {
17
+ super('https://graphql.anilist.co');
18
+ this.authToken = authToken;
19
+ }
20
+ mediaListCollection(variables) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ const query = `
23
+ query ($userId: Int, $userName: String, $type: MediaType, $status: MediaListStatus, $notes: String, $startedAt: FuzzyDateInt, $completedAt: FuzzyDateInt, $forceSingleCompletedList: Boolean, $chunk: Int, $perChunk: Int, $status_in: [MediaListStatus], $status_not_in: [MediaListStatus], $status_not: MediaListStatus, $notes_like: String, $startedAt_greater: FuzzyDateInt, $startedAt_lesser: FuzzyDateInt, $startedAt_like: String, $completedAt_greater: FuzzyDateInt, $completedAt_lesser: FuzzyDateInt, $completedAt_like: String, $sort: [MediaListSort], $scoreFormat: ScoreFormat, $asArray: Boolean, $asHtml: Boolean, $animeStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatLimit: Int, $mangaStatSort: [UserStatisticsSort]) {
24
+ MediaListCollection (userId: $userId, userName: $userName, type: $type, status: $status, notes: $notes, startedAt: $startedAt, completedAt: $completedAt, forceSingleCompletedList: $forceSingleCompletedList, chunk: $chunk, perChunk: $perChunk, status_in: $status_in, status_not_in: $status_not_in, status_not: $status_not, notes_like: $notes_like, startedAt_greater: $startedAt_greater, startedAt_lesser: $startedAt_lesser, startedAt_like: $startedAt_like, completedAt_greater: $completedAt_greater, completedAt_lesser: $completedAt_lesser, completedAt_like: $completedAt_like, sort: $sort) {
25
+ lists {
26
+ entries {
27
+ id
28
+ userId
29
+ mediaId
30
+ status
31
+ score (format: $scoreFormat)
32
+ progress
33
+ progressVolumes
34
+ repeat
35
+ priority
36
+ private
37
+ notes
38
+ hiddenFromStatusLists
39
+ customLists (asArray: $asArray)
40
+ advancedScores
41
+ startedAt {
42
+ year
43
+ month
44
+ day
45
+ }
46
+ completedAt {
47
+ year
48
+ month
49
+ day
50
+ }
51
+ updatedAt
52
+ createdAt
53
+ media {
54
+ id
55
+ idMal
56
+ title {
57
+ romaji
58
+ english
59
+ native
60
+ }
61
+ type
62
+ format
63
+ status
64
+ description (asHtml: $asHtml)
65
+ startDate {
66
+ year
67
+ month
68
+ day
69
+ }
70
+ endDate {
71
+ year
72
+ month
73
+ day
74
+ }
75
+ season
76
+ seasonYear
77
+ seasonInt
78
+ episodes
79
+ duration
80
+ chapters
81
+ volumes
82
+ countryOfOrigin
83
+ isLicensed
84
+ source
85
+ hashtag
86
+ trailer {
87
+ id
88
+ site
89
+ thumbnail
90
+ }
91
+ updatedAt
92
+ coverImage {
93
+ extraLarge
94
+ large
95
+ medium
96
+ color
97
+ }
98
+ bannerImage
99
+ genres
100
+ synonyms
101
+ averageScore
102
+ meanScore
103
+ popularity
104
+ isLocked
105
+ trending
106
+ favourites
107
+ tags {
108
+ id
109
+ name
110
+ description
111
+ rank
112
+ isGeneralSpoiler
113
+ isMediaSpoiler
114
+ isAdult
115
+ }
116
+ relations {
117
+ edges {
118
+ relationType
119
+ node {
120
+ id
121
+ title {
122
+ romaji
123
+ english
124
+ native
125
+ }
126
+ }
127
+ }
128
+ }
129
+ characters {
130
+ edges {
131
+ id
132
+ role
133
+ name
134
+ voiceActors {
135
+ id
136
+ name {
137
+ full
138
+ native
139
+ }
140
+ image {
141
+ large
142
+ }
143
+ }
144
+ media {
145
+ id
146
+ title {
147
+ romaji
148
+ english
149
+ native
150
+ }
151
+ coverImage {
152
+ extraLarge
153
+ large
154
+ medium
155
+ color
156
+ }
157
+ }
158
+ favouriteOrder
159
+ node {
160
+ id
161
+ name {
162
+ full
163
+ native
164
+ }
165
+ image {
166
+ large
167
+ }
168
+ }
169
+ }
170
+ }
171
+ staff {
172
+ edges {
173
+ id
174
+ role
175
+ favouriteOrder
176
+ node {
177
+ id
178
+ name {
179
+ full
180
+ native
181
+ }
182
+ image {
183
+ large
184
+ }
185
+ }
186
+ }
187
+ }
188
+ studios {
189
+ edges {
190
+ id
191
+ isMain
192
+ favouriteOrder
193
+ node {
194
+ id
195
+ name
196
+ isAnimationStudio
197
+ siteUrl
198
+ }
199
+ }
200
+ }
201
+ isFavourite
202
+ isAdult
203
+ nextAiringEpisode {
204
+ airingAt
205
+ timeUntilAiring
206
+ episode
207
+ }
208
+ externalLinks {
209
+ id
210
+ url
211
+ site
212
+ }
213
+ streamingEpisodes {
214
+ title
215
+ thumbnail
216
+ url
217
+ site
218
+ }
219
+ rankings {
220
+ id
221
+ rank
222
+ type
223
+ format
224
+ year
225
+ season
226
+ allTime
227
+ context
228
+ }
229
+ mediaListEntry {
230
+ id
231
+ status
232
+ }
233
+ stats {
234
+ scoreDistribution {
235
+ score
236
+ amount
237
+ }
238
+ statusDistribution {
239
+ status
240
+ amount
241
+ }
242
+ }
243
+ siteUrl
244
+ autoCreateForumThread
245
+ isRecommendationBlocked
246
+ modNotes
247
+ }
248
+ }
249
+ name
250
+ isCustomList
251
+ isSplitCompletedList
252
+ status
253
+ }
254
+ user {
255
+ id
256
+ name
257
+ about (asHtml: $asHtml)
258
+ avatar {
259
+ large
260
+ medium
261
+ }
262
+ bannerImage
263
+ isFollowing
264
+ isFollower
265
+ isBlocked
266
+ bans
267
+ options {
268
+ titleLanguage
269
+ displayAdultContent
270
+ airingNotifications
271
+ profileColor
272
+ notificationOptions {
273
+ type
274
+ enabled
275
+ }
276
+ timezone
277
+ activityMergeTime
278
+ staffNameLanguage
279
+ restrictMessagesToFollowing
280
+ disabledListActivity {
281
+ disabled
282
+ type
283
+ }
284
+ }
285
+ mediaListOptions {
286
+ scoreFormat
287
+ rowOrder
288
+ animeList {
289
+ sectionOrder
290
+ splitCompletedSectionByFormat
291
+ customLists
292
+ advancedScoring
293
+ advancedScoringEnabled
294
+ }
295
+ mangaList {
296
+ sectionOrder
297
+ splitCompletedSectionByFormat
298
+ customLists
299
+ advancedScoring
300
+ advancedScoringEnabled
301
+ }
302
+ }
303
+ favourites {
304
+ anime (perPage: 50) {
305
+ edges {
306
+ node {
307
+ id
308
+ title {
309
+ romaji
310
+ english
311
+ native
312
+ }
313
+ }
314
+ }
315
+ nodes {
316
+ id
317
+ title {
318
+ romaji
319
+ english
320
+ native
321
+ userPreferred
322
+ }
323
+ }
324
+ }
325
+ manga (perPage: 50) {
326
+ edges {
327
+ node {
328
+ id
329
+ title {
330
+ romaji
331
+ english
332
+ native
333
+ userPreferred
334
+ }
335
+ }
336
+ }
337
+ nodes {
338
+ id
339
+ title {
340
+ romaji
341
+ english
342
+ native
343
+ userPreferred
344
+ }
345
+ }
346
+ }
347
+ characters (perPage: 50) {
348
+ edges {
349
+ id
350
+ role
351
+ name
352
+ voiceActors {
353
+ id
354
+ name {
355
+ full
356
+ native
357
+ }
358
+ image {
359
+ large
360
+ }
361
+ }
362
+ media {
363
+ id
364
+ title {
365
+ romaji
366
+ english
367
+ native
368
+ }
369
+ coverImage {
370
+ extraLarge
371
+ large
372
+ medium
373
+ color
374
+ }
375
+ }
376
+ favouriteOrder
377
+ node {
378
+ id
379
+ name {
380
+ full
381
+ native
382
+ }
383
+ image {
384
+ large
385
+ }
386
+ }
387
+ }
388
+ }
389
+ staff (perPage: 50) {
390
+ edges {
391
+ id
392
+ role
393
+ favouriteOrder
394
+ node {
395
+ id
396
+ name {
397
+ full
398
+ native
399
+ }
400
+ image {
401
+ large
402
+ }
403
+ }
404
+ }
405
+ }
406
+ studios (perPage: 50) {
407
+ edges {
408
+ id
409
+ isMain
410
+ favouriteOrder
411
+ node {
412
+ id
413
+ name
414
+ isAnimationStudio
415
+ siteUrl
416
+ }
417
+ }
418
+ }
419
+ }
420
+ statistics {
421
+ anime {
422
+ count
423
+ meanScore
424
+ standardDeviation
425
+ minutesWatched
426
+ episodesWatched
427
+ formats (limit: $animeStatLimit, sort: $animeStatSort) {
428
+ count
429
+ meanScore
430
+ minutesWatched
431
+ mediaIds
432
+ format
433
+ }
434
+ statuses (limit: $animeStatLimit, sort: $animeStatSort) {
435
+ count
436
+ meanScore
437
+ minutesWatched
438
+ mediaIds
439
+ status
440
+ }
441
+ scores (limit: $animeStatLimit, sort: $animeStatSort) {
442
+ count
443
+ meanScore
444
+ minutesWatched
445
+ mediaIds
446
+ score
447
+ }
448
+ lengths (limit: $animeStatLimit, sort: $animeStatSort) {
449
+ count
450
+ meanScore
451
+ minutesWatched
452
+ mediaIds
453
+ length
454
+ }
455
+ releaseYears (limit: $animeStatLimit, sort: $animeStatSort) {
456
+ count
457
+ meanScore
458
+ minutesWatched
459
+ mediaIds
460
+ releaseYear
461
+ }
462
+ startYears (limit: $animeStatLimit, sort: $animeStatSort) {
463
+ count
464
+ meanScore
465
+ minutesWatched
466
+ mediaIds
467
+ startYear
468
+ }
469
+ genres (limit: $animeStatLimit, sort: $animeStatSort) {
470
+ count
471
+ meanScore
472
+ minutesWatched
473
+ mediaIds
474
+ genre
475
+ }
476
+ tags (limit: $animeStatLimit, sort: $animeStatSort) {
477
+ count
478
+ meanScore
479
+ minutesWatched
480
+ mediaIds
481
+ tag {
482
+ id
483
+ name
484
+ description
485
+ category
486
+ rank
487
+ isGeneralSpoiler
488
+ isMediaSpoiler
489
+ isAdult
490
+ }
491
+ }
492
+ countries (limit: $animeStatLimit, sort: $animeStatSort) {
493
+ count
494
+ meanScore
495
+ minutesWatched
496
+ mediaIds
497
+ country
498
+ }
499
+ voiceActors (limit: $animeStatLimit, sort: $animeStatSort) {
500
+ count
501
+ meanScore
502
+ minutesWatched
503
+ mediaIds
504
+ voiceActor {
505
+ id
506
+ name {
507
+ full
508
+ native
509
+ }
510
+ }
511
+ characterIds
512
+ }
513
+ staff (limit: $animeStatLimit, sort: $animeStatSort) {
514
+ count
515
+ meanScore
516
+ minutesWatched
517
+ mediaIds
518
+ staff {
519
+ id
520
+ name {
521
+ full
522
+ native
523
+ }
524
+ }
525
+ }
526
+ studios (limit: $animeStatLimit, sort: $animeStatSort) {
527
+ count
528
+ meanScore
529
+ minutesWatched
530
+ mediaIds
531
+ studio {
532
+ id
533
+ name
534
+ }
535
+ }
536
+ }
537
+ manga {
538
+ count
539
+ meanScore
540
+ standardDeviation
541
+ chaptersRead
542
+ volumesRead
543
+ formats (limit: $mangaStatLimit, sort: $mangaStatSort) {
544
+ count
545
+ meanScore
546
+ chaptersRead
547
+ mediaIds
548
+ format
549
+ }
550
+ statuses (limit: $mangaStatLimit, sort: $mangaStatSort) {
551
+ count
552
+ meanScore
553
+ chaptersRead
554
+ mediaIds
555
+ status
556
+ }
557
+ scores (limit: $mangaStatLimit, sort: $mangaStatSort) {
558
+ count
559
+ meanScore
560
+ chaptersRead
561
+ mediaIds
562
+ score
563
+ }
564
+ lengths (limit: $mangaStatLimit, sort: $mangaStatSort) {
565
+ count
566
+ meanScore
567
+ chaptersRead
568
+ mediaIds
569
+ length
570
+ }
571
+ releaseYears (limit: $mangaStatLimit, sort: $mangaStatSort) {
572
+ count
573
+ meanScore
574
+ chaptersRead
575
+ mediaIds
576
+ releaseYear
577
+ }
578
+ startYears (limit: $mangaStatLimit, sort: $mangaStatSort) {
579
+ count
580
+ meanScore
581
+ chaptersRead
582
+ mediaIds
583
+ startYear
584
+ }
585
+ genres (limit: $mangaStatLimit, sort: $mangaStatSort) {
586
+ count
587
+ meanScore
588
+ chaptersRead
589
+ mediaIds
590
+ genre
591
+ }
592
+ tags (limit: $mangaStatLimit, sort: $mangaStatSort) {
593
+ count
594
+ meanScore
595
+ chaptersRead
596
+ mediaIds
597
+ tag {
598
+ id
599
+ name
600
+ description
601
+ category
602
+ rank
603
+ isGeneralSpoiler
604
+ isMediaSpoiler
605
+ isAdult
606
+ }
607
+ }
608
+ countries (limit: $mangaStatLimit, sort: $mangaStatSort) {
609
+ count
610
+ meanScore
611
+ chaptersRead
612
+ mediaIds
613
+ country
614
+ }
615
+ staff (limit: $mangaStatLimit, sort: $mangaStatSort) {
616
+ count
617
+ meanScore
618
+ chaptersRead
619
+ mediaIds
620
+ staff {
621
+ id
622
+ name {
623
+ full
624
+ native
625
+ }
626
+ }
627
+ }
628
+ studios (limit: $mangaStatLimit, sort: $mangaStatSort) {
629
+ count
630
+ meanScore
631
+ chaptersRead
632
+ mediaIds
633
+ studio {
634
+ id
635
+ name
636
+ }
637
+ }
638
+ }
639
+ }
640
+ }
641
+ hasNextChunk
642
+ }
643
+ }
644
+ `;
645
+ const data = { query, variables };
646
+ return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
647
+ });
648
+ }
649
+ }
650
+ exports.MediaListCollectionQuery = MediaListCollectionQuery;