anilink-api-wrapper 1.2.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.
- package/dist/AniLink.js +4 -1
- package/dist/apis/anilist/interfaces/Activity.js +19 -0
- package/dist/apis/anilist/interfaces/ActivityNotification.js +17 -0
- package/dist/apis/anilist/interfaces/BasicComment.js +8 -0
- package/dist/apis/anilist/interfaces/BasicThread.js +9 -0
- package/dist/apis/anilist/interfaces/BasicUser.js +10 -0
- package/dist/apis/anilist/interfaces/ThreadNotification.js +23 -0
- package/dist/apis/anilist/interfaces/responses/Notification.js +170 -0
- package/dist/apis/anilist/query/Notification.js +35 -0
- package/package.json +1 -1
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,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,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,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
|
+
`;
|
|
@@ -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;
|