anilink-api-wrapper 1.11.0 → 1.12.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
CHANGED
|
@@ -22,6 +22,7 @@ const Follower_1 = require("./apis/anilist/query/Follower");
|
|
|
22
22
|
const Thread_1 = require("./apis/anilist/query/Thread");
|
|
23
23
|
const ThreadComment_1 = require("./apis/anilist/query/ThreadComment");
|
|
24
24
|
const Recommendation_1 = require("./apis/anilist/query/Recommendation");
|
|
25
|
+
const Likes_1 = require("./apis/anilist/query/page/Likes");
|
|
25
26
|
class AniLink {
|
|
26
27
|
constructor(authToken) {
|
|
27
28
|
const userQueryInstance = new User_1.UserQuery(authToken);
|
|
@@ -45,6 +46,7 @@ class AniLink {
|
|
|
45
46
|
const threadQueryInstance = new Thread_1.ThreadQuery(authToken);
|
|
46
47
|
const threadCommentQueryInstance = new ThreadComment_1.ThreadCommentQuery(authToken);
|
|
47
48
|
const recommendationQueryInstance = new Recommendation_1.RecommendationQuery(authToken);
|
|
49
|
+
const likesQueryInstance = new Likes_1.LikesQuery(authToken);
|
|
48
50
|
const updateUserMutationInstance = new UpdateUser_1.UpdateUserMutation(authToken);
|
|
49
51
|
this.anilist = {
|
|
50
52
|
query: {
|
|
@@ -68,7 +70,10 @@ class AniLink {
|
|
|
68
70
|
follower: followerQueryInstance.follower.bind(followerQueryInstance),
|
|
69
71
|
thread: threadQueryInstance.thread.bind(threadQueryInstance),
|
|
70
72
|
threadComment: threadCommentQueryInstance.threadComment.bind(threadCommentQueryInstance),
|
|
71
|
-
recommendation: recommendationQueryInstance.recommmendation.bind(recommendationQueryInstance)
|
|
73
|
+
recommendation: recommendationQueryInstance.recommmendation.bind(recommendationQueryInstance),
|
|
74
|
+
page: {
|
|
75
|
+
likes: likesQueryInstance.likes.bind(likesQueryInstance)
|
|
76
|
+
}
|
|
72
77
|
},
|
|
73
78
|
mutation: {
|
|
74
79
|
updateUser: updateUserMutationInstance.updateUser.bind(updateUserMutationInstance)
|
|
@@ -0,0 +1,44 @@
|
|
|
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.LikeQuery = void 0;
|
|
13
|
+
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
|
+
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
const BasicUser_1 = require("../interfaces/BasicUser");
|
|
16
|
+
class LikeQuery extends APIWrapper_1.APIWrapper {
|
|
17
|
+
constructor(authToken) {
|
|
18
|
+
super('https://graphql.anilist.co');
|
|
19
|
+
this.authToken = authToken;
|
|
20
|
+
}
|
|
21
|
+
like(variables) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const query = `
|
|
24
|
+
query ($likeableId: Int, $type: LikeableType, $page: Int, $perPage: Int) {
|
|
25
|
+
Page (page: $page, perPage: $perPage) {
|
|
26
|
+
pageInfo {
|
|
27
|
+
total
|
|
28
|
+
perPage
|
|
29
|
+
currentPage
|
|
30
|
+
lastPage
|
|
31
|
+
hasNextPage
|
|
32
|
+
}
|
|
33
|
+
likes (likeableId: $likeableId, type: $type) {
|
|
34
|
+
${BasicUser_1.BasicUserSchema}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
const data = { query, variables };
|
|
40
|
+
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.LikeQuery = LikeQuery;
|
|
@@ -0,0 +1,44 @@
|
|
|
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.LikesQuery = void 0;
|
|
13
|
+
const APIWrapper_1 = require("../../../../base/APIWrapper");
|
|
14
|
+
const RequestHandler_1 = require("../../../../base/RequestHandler");
|
|
15
|
+
const BasicUser_1 = require("../../interfaces/BasicUser");
|
|
16
|
+
class LikesQuery extends APIWrapper_1.APIWrapper {
|
|
17
|
+
constructor(authToken) {
|
|
18
|
+
super('https://graphql.anilist.co');
|
|
19
|
+
this.authToken = authToken;
|
|
20
|
+
}
|
|
21
|
+
likes(variables) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const query = `
|
|
24
|
+
query ($likeableId: Int, $type: LikeableType, $page: Int, $perPage: Int) {
|
|
25
|
+
Page (page: $page, perPage: $perPage) {
|
|
26
|
+
pageInfo {
|
|
27
|
+
total
|
|
28
|
+
perPage
|
|
29
|
+
currentPage
|
|
30
|
+
lastPage
|
|
31
|
+
hasNextPage
|
|
32
|
+
}
|
|
33
|
+
likes (likeableId: $likeableId, type: $type) {
|
|
34
|
+
${BasicUser_1.BasicUserSchema}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
const data = { query, variables };
|
|
40
|
+
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.LikesQuery = LikesQuery;
|