anilink-api-wrapper 1.1.0 → 1.3.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 (72) hide show
  1. package/dist/AniLink.js +13 -1
  2. package/dist/apis/anilist/interfaces/Activity.js +19 -0
  3. package/dist/apis/anilist/interfaces/ActivityNotification.js +17 -0
  4. package/dist/apis/anilist/interfaces/BasicComment.js +8 -0
  5. package/dist/apis/anilist/interfaces/BasicThread.js +9 -0
  6. package/dist/apis/anilist/interfaces/BasicUser.js +10 -0
  7. package/dist/apis/anilist/interfaces/Tag.js +2 -0
  8. package/dist/apis/anilist/interfaces/ThreadNotification.js +23 -0
  9. package/dist/apis/anilist/interfaces/responses/MediaTag.js +2 -0
  10. package/dist/apis/anilist/interfaces/responses/MediaTagCollection.js +2 -0
  11. package/dist/apis/anilist/interfaces/responses/Notification.js +170 -0
  12. package/dist/apis/anilist/interfaces/responses/User.js +3 -3
  13. package/dist/apis/anilist/query/GenreCollection.js +32 -0
  14. package/dist/apis/anilist/query/MediaTagCollection.js +35 -0
  15. package/dist/apis/anilist/query/Notification.js +35 -0
  16. package/dist/apis/anilist/query/User.js +2 -15
  17. package/dist/apis/anilist/query/Viewer.js +35 -0
  18. package/package.json +3 -2
  19. package/.eslintignore +0 -1
  20. package/.github/workflows/code_quality.yml +0 -32
  21. package/.github/workflows/codeql.yml +0 -33
  22. package/.github/workflows/test.yml +0 -30
  23. package/__tests__/anilist.test.ts +0 -268
  24. package/babel.config.js +0 -6
  25. package/jest.config.js +0 -11
  26. package/src/AniLink.ts +0 -80
  27. package/src/apis/anilist/interfaces/ActivityHistory.ts +0 -5
  28. package/src/apis/anilist/interfaces/CoverImage.ts +0 -15
  29. package/src/apis/anilist/interfaces/Distribution.ts +0 -4
  30. package/src/apis/anilist/interfaces/ExternalLink.ts +0 -13
  31. package/src/apis/anilist/interfaces/Favoured.ts +0 -15
  32. package/src/apis/anilist/interfaces/FuzzyDate.ts +0 -11
  33. package/src/apis/anilist/interfaces/Image.ts +0 -11
  34. package/src/apis/anilist/interfaces/ListScores.ts +0 -4
  35. package/src/apis/anilist/interfaces/Media.ts +0 -59
  36. package/src/apis/anilist/interfaces/MediaListEntry.ts +0 -11
  37. package/src/apis/anilist/interfaces/MediaStatistics.ts +0 -23
  38. package/src/apis/anilist/interfaces/MediaStats.ts +0 -7
  39. package/src/apis/anilist/interfaces/Name.ts +0 -17
  40. package/src/apis/anilist/interfaces/NextAiringEpisode.ts +0 -13
  41. package/src/apis/anilist/interfaces/Ranking.ts +0 -23
  42. package/src/apis/anilist/interfaces/ScoreDistribution.ts +0 -11
  43. package/src/apis/anilist/interfaces/Staff.ts +0 -6
  44. package/src/apis/anilist/interfaces/Stat.ts +0 -24
  45. package/src/apis/anilist/interfaces/Statistics.ts +0 -6
  46. package/src/apis/anilist/interfaces/StatusDistribution.ts +0 -11
  47. package/src/apis/anilist/interfaces/StreamingEpisode.ts +0 -15
  48. package/src/apis/anilist/interfaces/Studio.ts +0 -4
  49. package/src/apis/anilist/interfaces/Tag.ts +0 -20
  50. package/src/apis/anilist/interfaces/Title.ts +0 -15
  51. package/src/apis/anilist/interfaces/Trailer.ts +0 -13
  52. package/src/apis/anilist/interfaces/UserStats.ts +0 -39
  53. package/src/apis/anilist/interfaces/responses/AiringSchedule.ts +0 -22
  54. package/src/apis/anilist/interfaces/responses/Character.ts +0 -50
  55. package/src/apis/anilist/interfaces/responses/Media.ts +0 -322
  56. package/src/apis/anilist/interfaces/responses/MediaList.ts +0 -54
  57. package/src/apis/anilist/interfaces/responses/MediaListCollectionResponse.ts +0 -75
  58. package/src/apis/anilist/interfaces/responses/MediaTrend.ts +0 -28
  59. package/src/apis/anilist/interfaces/responses/Staff.ts +0 -102
  60. package/src/apis/anilist/interfaces/responses/User.ts +0 -432
  61. package/src/apis/anilist/mutation/UpdateUser.ts +0 -162
  62. package/src/apis/anilist/query/AiringSchedule.ts +0 -48
  63. package/src/apis/anilist/query/Character.ts +0 -40
  64. package/src/apis/anilist/query/Media.ts +0 -98
  65. package/src/apis/anilist/query/MediaList.ts +0 -56
  66. package/src/apis/anilist/query/MediaListCollection.ts +0 -47
  67. package/src/apis/anilist/query/MediaTrend.ts +0 -54
  68. package/src/apis/anilist/query/Staff.ts +0 -48
  69. package/src/apis/anilist/query/User.ts +0 -41
  70. package/src/base/APIWrapper.ts +0 -7
  71. package/src/base/RequestHandler.ts +0 -21
  72. package/tsconfig.json +0 -15
package/dist/AniLink.js CHANGED
@@ -8,7 +8,11 @@ const Character_1 = require("./apis/anilist/query/Character");
8
8
  const MediaList_1 = require("./apis/anilist/query/MediaList");
9
9
  const Staff_1 = require("./apis/anilist/query/Staff");
10
10
  const MediaListCollection_1 = require("./apis/anilist/query/MediaListCollection");
11
+ const GenreCollection_1 = require("./apis/anilist/query/GenreCollection");
11
12
  const UpdateUser_1 = require("./apis/anilist/mutation/UpdateUser");
13
+ const MediaTagCollection_1 = require("./apis/anilist/query/MediaTagCollection");
14
+ const Viewer_1 = require("./apis/anilist/query/Viewer");
15
+ const Notification_1 = require("./apis/anilist/query/Notification");
12
16
  class AniLink {
13
17
  constructor(authToken) {
14
18
  const userQueryInstance = new User_1.UserQuery(authToken);
@@ -19,6 +23,10 @@ class AniLink {
19
23
  const staffQueryInstance = new Staff_1.StaffQuery(authToken);
20
24
  const mediaListQueryInstance = new MediaList_1.MediaListQuery(authToken);
21
25
  const mediaListCollectionQueryInstance = new MediaListCollection_1.MediaListCollectionQuery(authToken);
26
+ const genreCollectionQueryInstance = new GenreCollection_1.GenreCollectionQuery(authToken);
27
+ const mediaTagCollectionQueryInstance = new MediaTagCollection_1.MediaTagCollectionQuery(authToken);
28
+ const viewerQueryInstance = new Viewer_1.ViewerQuery(authToken);
29
+ const notificationQueryInstance = new Notification_1.NotificationQuery(authToken);
22
30
  const updateUserMutationInstance = new UpdateUser_1.UpdateUserMutation(authToken);
23
31
  this.anilist = {
24
32
  query: {
@@ -29,7 +37,11 @@ class AniLink {
29
37
  character: characterQueryInstance.character.bind(characterQueryInstance),
30
38
  staff: staffQueryInstance.staff.bind(staffQueryInstance),
31
39
  mediaList: mediaListQueryInstance.mediaList.bind(mediaListQueryInstance),
32
- mediaListCollection: mediaListCollectionQueryInstance.mediaListCollection.bind(mediaListQueryInstance)
40
+ mediaListCollection: mediaListCollectionQueryInstance.mediaListCollection.bind(mediaListQueryInstance),
41
+ genreCollection: genreCollectionQueryInstance.genreCollection.bind(genreCollectionQueryInstance),
42
+ mediaTagCollection: mediaTagCollectionQueryInstance.mediaTagCollection.bind(mediaTagCollectionQueryInstance),
43
+ viewer: viewerQueryInstance.viewer.bind(viewerQueryInstance),
44
+ notification: notificationQueryInstance.notification.bind(notificationQueryInstance)
33
45
  },
34
46
  mutation: {
35
47
  updateUser: updateUserMutationInstance.updateUser.bind(updateUserMutationInstance)
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActivitySchema = void 0;
4
+ exports.ActivitySchema = `
5
+ activity {
6
+ ... on TextActivity {
7
+ id
8
+ type
9
+ }
10
+ ... on ListActivity {
11
+ id
12
+ type
13
+ }
14
+ ... on MessageActivity {
15
+ id
16
+ type
17
+ }
18
+ }
19
+ `;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActivityNotificationSchema = void 0;
4
+ const Activity_1 = require("./Activity");
5
+ const BasicUser_1 = require("./BasicUser");
6
+ exports.ActivityNotificationSchema = `
7
+ id
8
+ userId
9
+ type
10
+ activityId
11
+ context
12
+ createdAt
13
+ ${Activity_1.ActivitySchema}
14
+ user {
15
+ ${BasicUser_1.BasicUserSchema}
16
+ }
17
+ `;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasicCommentSchema = void 0;
4
+ exports.BasicCommentSchema = `
5
+ id
6
+ userId
7
+ threadId
8
+ `;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasicThreadSchema = void 0;
4
+ exports.BasicThreadSchema = `
5
+ id
6
+ title
7
+ body (asHtml: $asHtml)
8
+ siteUrl
9
+ `;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasicUserSchema = void 0;
4
+ exports.BasicUserSchema = `
5
+ id
6
+ name
7
+ avatar {
8
+ large
9
+ }
10
+ `;
@@ -5,8 +5,10 @@ exports.TagSchema = `
5
5
  id
6
6
  name
7
7
  description
8
+ category
8
9
  rank
9
10
  isGeneralSpoiler
10
11
  isMediaSpoiler
11
12
  isAdult
13
+ userId
12
14
  `;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThreadNotificationSchema = void 0;
4
+ const BasicThread_1 = require("./BasicThread");
5
+ const BasicComment_1 = require("./BasicComment");
6
+ const BasicUser_1 = require("./BasicUser");
7
+ exports.ThreadNotificationSchema = `
8
+ id
9
+ userId
10
+ type
11
+ commentId
12
+ context
13
+ createdAt
14
+ thread {
15
+ ${BasicThread_1.BasicThreadSchema}
16
+ }
17
+ comment {
18
+ ${BasicComment_1.BasicCommentSchema}
19
+ }
20
+ user {
21
+ ${BasicUser_1.BasicUserSchema}
22
+ }
23
+ `;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationSchema = void 0;
4
+ const Title_1 = require("../Title");
5
+ const ActivityNotification_1 = require("../ActivityNotification");
6
+ const BasicUser_1 = require("../BasicUser");
7
+ const BasicThread_1 = require("../BasicThread");
8
+ const BasicComment_1 = require("../BasicComment");
9
+ const ThreadNotification_1 = require("../ThreadNotification");
10
+ exports.NotificationSchema = `
11
+ ... on AiringNotification {
12
+ id
13
+ type
14
+ animeId
15
+ episode
16
+ contexts
17
+ createdAt
18
+ media {
19
+ id
20
+ ${Title_1.TitleSchema}
21
+ }
22
+ }
23
+ ... on FollowingNotification {
24
+ id
25
+ type
26
+ userId
27
+ context
28
+ createdAt
29
+ user {
30
+ ${BasicUser_1.BasicUserSchema}
31
+ }
32
+ }
33
+ ... on ActivityMessageNotification {
34
+ id
35
+ userId
36
+ type
37
+ activityId
38
+ context
39
+ createdAt
40
+ message {
41
+ id
42
+ recipientId
43
+ messengerId
44
+ type
45
+ replyCount
46
+ message (asHtml: $asHtml)
47
+ isLocked
48
+ isSubscribed
49
+ likeCount
50
+ isLiked
51
+ isPrivate
52
+ siteUrl
53
+ createdAt
54
+ recipient {
55
+ ${BasicUser_1.BasicUserSchema}
56
+ }
57
+ messenger {
58
+ ${BasicUser_1.BasicUserSchema}
59
+ }
60
+ replies {
61
+ id
62
+ userId
63
+ activityId
64
+ text (asHtml: $asHtml)
65
+ createdAt
66
+ likeCount
67
+ isLiked
68
+ user {
69
+ ${BasicUser_1.BasicUserSchema}
70
+ }
71
+ likes {
72
+ ${BasicUser_1.BasicUserSchema}
73
+ }
74
+ }
75
+ likes {
76
+ ${BasicUser_1.BasicUserSchema}
77
+ }
78
+ }
79
+ user {
80
+ ${BasicUser_1.BasicUserSchema}
81
+ }
82
+ }
83
+ ... on ActivityMentionNotification {
84
+ ${ActivityNotification_1.ActivityNotificationSchema}
85
+ }
86
+ ... on ActivityReplyNotification {
87
+ ${ActivityNotification_1.ActivityNotificationSchema}
88
+ }
89
+ ... on ActivityReplySubscribedNotification {
90
+ ${ActivityNotification_1.ActivityNotificationSchema}
91
+ }
92
+ ... on ActivityLikeNotification {
93
+ ${ActivityNotification_1.ActivityNotificationSchema}
94
+ }
95
+ ... on ActivityReplyLikeNotification {
96
+ ${ActivityNotification_1.ActivityNotificationSchema}
97
+ }
98
+ ... on ThreadCommentMentionNotification {
99
+ ${ThreadNotification_1.ThreadNotificationSchema}
100
+ }
101
+ ... on ThreadCommentReplyNotification {
102
+ ${ThreadNotification_1.ThreadNotificationSchema}
103
+ }
104
+ ... on ThreadCommentSubscribedNotification {
105
+ ${ThreadNotification_1.ThreadNotificationSchema}
106
+ }
107
+ ... on ThreadCommentLikeNotification {
108
+ ${ThreadNotification_1.ThreadNotificationSchema}
109
+ }
110
+ ... on ThreadLikeNotification {
111
+ id
112
+ userId
113
+ type
114
+ context
115
+ createdAt
116
+ thread {
117
+ ${BasicThread_1.BasicThreadSchema}
118
+ }
119
+ comment {
120
+ ${BasicComment_1.BasicCommentSchema}
121
+ }
122
+ user {
123
+ ${BasicUser_1.BasicUserSchema}
124
+ }
125
+ }
126
+ ... on RelatedMediaAdditionNotification {
127
+ id
128
+ type
129
+ mediaId
130
+ context
131
+ createdAt
132
+ media {
133
+ id
134
+ ${Title_1.TitleSchema}
135
+ }
136
+ }
137
+ ... on MediaDataChangeNotification {
138
+ id
139
+ type
140
+ mediaId
141
+ context
142
+ reason
143
+ createdAt
144
+ media {
145
+ id
146
+ ${Title_1.TitleSchema}
147
+ }
148
+ }
149
+ ... on MediaMergeNotification {
150
+ id
151
+ type
152
+ mediaId
153
+ deletedMediaTitles
154
+ context
155
+ reason
156
+ createdAt
157
+ media {
158
+ id
159
+ ${Title_1.TitleSchema}
160
+ }
161
+ }
162
+ ... on MediaDeletionNotification {
163
+ id
164
+ type
165
+ deletedMediaTitle
166
+ context
167
+ reason
168
+ createdAt
169
+ }
170
+ `;
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UserSchema = void 0;
4
+ const Image_1 = require("../Image");
5
+ const UserStats_1 = require("../UserStats");
4
6
  const Title_1 = require("../Title");
5
7
  const Name_1 = require("../Name");
6
- const Image_1 = require("../Image");
7
8
  const CoverImage_1 = require("../CoverImage");
8
- const UserStats_1 = require("../UserStats");
9
9
  const Tag_1 = require("../Tag");
10
10
  exports.UserSchema = `
11
11
  id
12
12
  name
13
- about(asHtml: $isHTML)
13
+ about(asHtml: $asHtml)
14
14
  avatar {
15
15
  large
16
16
  medium
@@ -0,0 +1,32 @@
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.GenreCollectionQuery = void 0;
13
+ const APIWrapper_1 = require("../../../base/APIWrapper");
14
+ const RequestHandler_1 = require("../../../base/RequestHandler");
15
+ class GenreCollectionQuery extends APIWrapper_1.APIWrapper {
16
+ constructor(authToken) {
17
+ super('https://graphql.anilist.co');
18
+ this.authToken = authToken;
19
+ }
20
+ genreCollection() {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ const query = `
23
+ query {
24
+ GenreCollection
25
+ }
26
+ `;
27
+ const data = { query };
28
+ return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
29
+ });
30
+ }
31
+ }
32
+ exports.GenreCollectionQuery = GenreCollectionQuery;
@@ -0,0 +1,35 @@
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.MediaTagCollectionQuery = void 0;
13
+ const APIWrapper_1 = require("../../../base/APIWrapper");
14
+ const RequestHandler_1 = require("../../../base/RequestHandler");
15
+ const Tag_1 = require("../interfaces/Tag");
16
+ class MediaTagCollectionQuery extends APIWrapper_1.APIWrapper {
17
+ constructor(authToken) {
18
+ super('https://graphql.anilist.co');
19
+ this.authToken = authToken;
20
+ }
21
+ mediaTagCollection(variables) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const query = `
24
+ query ($status: Int) {
25
+ MediaTagCollection (status: $status) {
26
+ ${Tag_1.TagSchema}
27
+ }
28
+ }
29
+ `;
30
+ const data = { query, variables };
31
+ return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
32
+ });
33
+ }
34
+ }
35
+ exports.MediaTagCollectionQuery = MediaTagCollectionQuery;
@@ -0,0 +1,35 @@
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.NotificationQuery = void 0;
13
+ const APIWrapper_1 = require("../../../base/APIWrapper");
14
+ const RequestHandler_1 = require("../../../base/RequestHandler");
15
+ const Notification_1 = require("../interfaces/responses/Notification");
16
+ class NotificationQuery extends APIWrapper_1.APIWrapper {
17
+ constructor(authToken) {
18
+ super('https://graphql.anilist.co');
19
+ this.authToken = authToken;
20
+ }
21
+ notification(variables) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const query = `
24
+ query ($type: NotificationType, $resetNotificationCount: Boolean, $type_in: [NotificationType], $asHtml: Boolean) {
25
+ Notification (type: $type, resetNotificationCount: $resetNotificationCount, type_in: $type_in) {
26
+ ${Notification_1.NotificationSchema}
27
+ }
28
+ }
29
+ `;
30
+ const data = { query, variables };
31
+ return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
32
+ });
33
+ }
34
+ }
35
+ exports.NotificationQuery = NotificationQuery;
@@ -8,17 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
11
  Object.defineProperty(exports, "__esModule", { value: true });
23
12
  exports.UserQuery = void 0;
24
13
  const APIWrapper_1 = require("../../../base/APIWrapper");
@@ -31,16 +20,14 @@ class UserQuery extends APIWrapper_1.APIWrapper {
31
20
  }
32
21
  user(variables) {
33
22
  return __awaiter(this, void 0, void 0, function* () {
34
- // If isHTML is not provided in variables, default it to true
35
- const _a = variables != null ? variables : {}, { isHTML = true } = _a, rest = __rest(_a, ["isHTML"]);
36
23
  const query = `
37
- query ($id: Int, $name: String, $isModerator: Boolean, $search: String, $sort: [UserSort], $isHTML: Boolean, $animeStatLimit: Int, $mangaStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatSort: [UserStatisticsSort]) {
24
+ query ($id: Int, $name: String, $isModerator: Boolean, $search: String, $sort: [UserSort], $asHtml: Boolean, $animeStatLimit: Int, $mangaStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatSort: [UserStatisticsSort]) {
38
25
  User (id: $id, name: $name, isModerator: $isModerator, search: $search, sort: $sort) {
39
26
  ${User_1.UserSchema}
40
27
  }
41
28
  }
42
29
  `;
43
- const data = { query, variables: Object.assign({ isHTML }, rest) };
30
+ const data = { query, variables };
44
31
  return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
45
32
  });
46
33
  }
@@ -0,0 +1,35 @@
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.ViewerQuery = void 0;
13
+ const APIWrapper_1 = require("../../../base/APIWrapper");
14
+ const RequestHandler_1 = require("../../../base/RequestHandler");
15
+ const User_1 = require("../interfaces/responses/User");
16
+ class ViewerQuery extends APIWrapper_1.APIWrapper {
17
+ constructor(authToken) {
18
+ super('https://graphql.anilist.co');
19
+ this.authToken = authToken;
20
+ }
21
+ viewer(variables) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const query = `
24
+ query ($asHtml: Boolean, $animeStatLimit: Int, $mangaStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatSort: [UserStatisticsSort]) {
25
+ Viewer {
26
+ ${User_1.UserSchema}
27
+ }
28
+ }
29
+ `;
30
+ const data = { query, variables };
31
+ return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
32
+ });
33
+ }
34
+ }
35
+ exports.ViewerQuery = ViewerQuery;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "anilink-api-wrapper",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Anilist API Wrapper",
5
5
  "main": "dist/AniLink.js",
6
6
  "scripts": {
7
7
  "test": "jest",
8
- "build": "tsc"
8
+ "build": "tsc",
9
+ "prepublishOnly": "npm run build"
9
10
  },
10
11
  "keywords": [
11
12
  "anilist",
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- /__tests__/*
@@ -1,32 +0,0 @@
1
- ---
2
- name: Qodana
3
- on:
4
- workflow_dispatch:
5
- pull_request:
6
- push:
7
- branches:
8
- - master
9
- - 'releases/*'
10
-
11
- jobs:
12
- qodana:
13
- runs-on: ubuntu-latest
14
- permissions:
15
- contents: read
16
- pull-requests: write
17
- checks: write
18
- steps:
19
- - uses: actions/checkout@v4
20
- with:
21
- ref: ${{ github.event.pull_request.head.sha }}
22
- fetch-depth: 0
23
- - name: Setup Node.js environment
24
- uses: actions/setup-node@v4.0.2
25
- with:
26
- node-version: '21'
27
- cache: 'npm'
28
- - run: npm ci
29
- - name: 'Qodana Scan'
30
- uses: JetBrains/qodana-action@v2023.3.1
31
- env:
32
- QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
@@ -1,33 +0,0 @@
1
- ---
2
- name: "CodeQL"
3
- on:
4
- push:
5
- branches: ["master"]
6
- pull_request:
7
- branches: ["master"]
8
- schedule:
9
- - cron: '0 7 * * 1'
10
-
11
- jobs:
12
- analyze:
13
- name: Analyze
14
- runs-on: ubuntu-latest
15
- permissions:
16
- security-events: write
17
- actions: read
18
- contents: read
19
- strategy:
20
- fail-fast: false
21
- matrix:
22
- language: ['javascript-typescript']
23
- steps:
24
- - name: Checkout repository
25
- uses: actions/checkout@v4
26
- - name: Initialize CodeQL
27
- uses: github/codeql-action/init@v3
28
- with:
29
- languages: ${{ matrix.language }}
30
- - name: Perform CodeQL Analysis
31
- uses: github/codeql-action/analyze@v3
32
- with:
33
- category: "/language:${{matrix.language}}"
@@ -1,30 +0,0 @@
1
- name: Run Jest Tests
2
-
3
- on:
4
- push:
5
- branches: ["master"]
6
- pull_request:
7
- branches: ["master"]
8
-
9
- jobs:
10
- test:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - uses: actions/checkout@v4
15
-
16
- - name: Use Node.js
17
- uses: actions/setup-node@v4
18
- with:
19
- node-version: '21'
20
-
21
- - name: Install Dependencies
22
- run: npm ci
23
-
24
- - name: Build Project
25
- run: npm run build
26
-
27
- - name: Run Jest
28
- run: npm run test
29
- env:
30
- ANILIST_TOKEN: ${{ secrets.ANILIST_TOKEN }}