anilink-api-wrapper 1.2.0 → 1.3.1

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/dist/AniLink.js CHANGED
@@ -12,6 +12,7 @@ const GenreCollection_1 = require("./apis/anilist/query/GenreCollection");
12
12
  const UpdateUser_1 = require("./apis/anilist/mutation/UpdateUser");
13
13
  const MediaTagCollection_1 = require("./apis/anilist/query/MediaTagCollection");
14
14
  const Viewer_1 = require("./apis/anilist/query/Viewer");
15
+ const Notification_1 = require("./apis/anilist/query/Notification");
15
16
  class AniLink {
16
17
  constructor(authToken) {
17
18
  const userQueryInstance = new User_1.UserQuery(authToken);
@@ -25,6 +26,7 @@ class AniLink {
25
26
  const genreCollectionQueryInstance = new GenreCollection_1.GenreCollectionQuery(authToken);
26
27
  const mediaTagCollectionQueryInstance = new MediaTagCollection_1.MediaTagCollectionQuery(authToken);
27
28
  const viewerQueryInstance = new Viewer_1.ViewerQuery(authToken);
29
+ const notificationQueryInstance = new Notification_1.NotificationQuery(authToken);
28
30
  const updateUserMutationInstance = new UpdateUser_1.UpdateUserMutation(authToken);
29
31
  this.anilist = {
30
32
  query: {
@@ -38,7 +40,8 @@ class AniLink {
38
40
  mediaListCollection: mediaListCollectionQueryInstance.mediaListCollection.bind(mediaListQueryInstance),
39
41
  genreCollection: genreCollectionQueryInstance.genreCollection.bind(genreCollectionQueryInstance),
40
42
  mediaTagCollection: mediaTagCollectionQueryInstance.mediaTagCollection.bind(mediaTagCollectionQueryInstance),
41
- viewer: viewerQueryInstance.viewer.bind(viewerQueryInstance)
43
+ viewer: viewerQueryInstance.viewer.bind(viewerQueryInstance),
44
+ notification: notificationQueryInstance.notification.bind(notificationQueryInstance)
42
45
  },
43
46
  mutation: {
44
47
  updateUser: updateUserMutationInstance.updateUser.bind(updateUserMutationInstance)
@@ -0,0 +1,58 @@
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
+ userId
9
+ type
10
+ replyCount
11
+ text (asHtml: $asHtml)
12
+ siteUrl
13
+ isLocked
14
+ isSubscribed
15
+ likeCount
16
+ isLiked
17
+ isPinned
18
+ createdAt
19
+ }
20
+ ... on ListActivity {
21
+ id
22
+ userId
23
+ type
24
+ replyCount
25
+ status
26
+ progress
27
+ isLocked
28
+ isSubscribed
29
+ likeCount
30
+ isLiked
31
+ isPinned
32
+ siteUrl
33
+ createdAt
34
+ media {
35
+ id
36
+ title {
37
+ romaji
38
+ english
39
+ }
40
+ }
41
+ }
42
+ ... on MessageActivity {
43
+ id
44
+ recipientId
45
+ messengerId
46
+ type
47
+ replyCount
48
+ message (asHtml: $asHtml)
49
+ isLocked
50
+ isSubscribed
51
+ likeCount
52
+ isLiked
53
+ isPrivate
54
+ siteUrl
55
+ createdAt
56
+ }
57
+ }
58
+ `;
@@ -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
+ `;
@@ -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,164 @@
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
+ replies {
55
+ id
56
+ userId
57
+ activityId
58
+ text (asHtml: $asHtml)
59
+ createdAt
60
+ likeCount
61
+ isLiked
62
+ user {
63
+ ${BasicUser_1.BasicUserSchema}
64
+ }
65
+ likes {
66
+ ${BasicUser_1.BasicUserSchema}
67
+ }
68
+ }
69
+ likes {
70
+ ${BasicUser_1.BasicUserSchema}
71
+ }
72
+ }
73
+ user {
74
+ ${BasicUser_1.BasicUserSchema}
75
+ }
76
+ }
77
+ ... on ActivityMentionNotification {
78
+ ${ActivityNotification_1.ActivityNotificationSchema}
79
+ }
80
+ ... on ActivityReplyNotification {
81
+ ${ActivityNotification_1.ActivityNotificationSchema}
82
+ }
83
+ ... on ActivityReplySubscribedNotification {
84
+ ${ActivityNotification_1.ActivityNotificationSchema}
85
+ }
86
+ ... on ActivityLikeNotification {
87
+ ${ActivityNotification_1.ActivityNotificationSchema}
88
+ }
89
+ ... on ActivityReplyLikeNotification {
90
+ ${ActivityNotification_1.ActivityNotificationSchema}
91
+ }
92
+ ... on ThreadCommentMentionNotification {
93
+ ${ThreadNotification_1.ThreadNotificationSchema}
94
+ }
95
+ ... on ThreadCommentReplyNotification {
96
+ ${ThreadNotification_1.ThreadNotificationSchema}
97
+ }
98
+ ... on ThreadCommentSubscribedNotification {
99
+ ${ThreadNotification_1.ThreadNotificationSchema}
100
+ }
101
+ ... on ThreadCommentLikeNotification {
102
+ ${ThreadNotification_1.ThreadNotificationSchema}
103
+ }
104
+ ... on ThreadLikeNotification {
105
+ id
106
+ userId
107
+ type
108
+ context
109
+ createdAt
110
+ thread {
111
+ ${BasicThread_1.BasicThreadSchema}
112
+ }
113
+ comment {
114
+ ${BasicComment_1.BasicCommentSchema}
115
+ }
116
+ user {
117
+ ${BasicUser_1.BasicUserSchema}
118
+ }
119
+ }
120
+ ... on RelatedMediaAdditionNotification {
121
+ id
122
+ type
123
+ mediaId
124
+ context
125
+ createdAt
126
+ media {
127
+ id
128
+ ${Title_1.TitleSchema}
129
+ }
130
+ }
131
+ ... on MediaDataChangeNotification {
132
+ id
133
+ type
134
+ mediaId
135
+ context
136
+ reason
137
+ createdAt
138
+ media {
139
+ id
140
+ ${Title_1.TitleSchema}
141
+ }
142
+ }
143
+ ... on MediaMergeNotification {
144
+ id
145
+ type
146
+ mediaId
147
+ deletedMediaTitles
148
+ context
149
+ reason
150
+ createdAt
151
+ media {
152
+ id
153
+ ${Title_1.TitleSchema}
154
+ }
155
+ }
156
+ ... on MediaDeletionNotification {
157
+ id
158
+ type
159
+ deletedMediaTitle
160
+ context
161
+ reason
162
+ createdAt
163
+ }
164
+ `;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anilink-api-wrapper",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Anilist API Wrapper",
5
5
  "main": "dist/AniLink.js",
6
6
  "scripts": {