anilink-api-wrapper 1.9.0 → 1.11.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
@@ -20,6 +20,8 @@ const ActivityReply_1 = require("./apis/anilist/query/ActivityReply");
20
20
  const Following_1 = require("./apis/anilist/query/Following");
21
21
  const Follower_1 = require("./apis/anilist/query/Follower");
22
22
  const Thread_1 = require("./apis/anilist/query/Thread");
23
+ const ThreadComment_1 = require("./apis/anilist/query/ThreadComment");
24
+ const Recommendation_1 = require("./apis/anilist/query/Recommendation");
23
25
  class AniLink {
24
26
  constructor(authToken) {
25
27
  const userQueryInstance = new User_1.UserQuery(authToken);
@@ -41,6 +43,8 @@ class AniLink {
41
43
  const followingQueryInstance = new Following_1.FollowingQuery(authToken);
42
44
  const followerQueryInstance = new Follower_1.FollowerQuery(authToken);
43
45
  const threadQueryInstance = new Thread_1.ThreadQuery(authToken);
46
+ const threadCommentQueryInstance = new ThreadComment_1.ThreadCommentQuery(authToken);
47
+ const recommendationQueryInstance = new Recommendation_1.RecommendationQuery(authToken);
44
48
  const updateUserMutationInstance = new UpdateUser_1.UpdateUserMutation(authToken);
45
49
  this.anilist = {
46
50
  query: {
@@ -62,7 +66,9 @@ class AniLink {
62
66
  activityReply: activityReplyQueryInstance.activityReply.bind(activityReplyQueryInstance),
63
67
  following: followingQueryInstance.following.bind(followingQueryInstance),
64
68
  follower: followerQueryInstance.follower.bind(followerQueryInstance),
65
- thread: threadQueryInstance.thread.bind(threadQueryInstance)
69
+ thread: threadQueryInstance.thread.bind(threadQueryInstance),
70
+ threadComment: threadCommentQueryInstance.threadComment.bind(threadCommentQueryInstance),
71
+ recommendation: recommendationQueryInstance.recommmendation.bind(recommendationQueryInstance)
66
72
  },
67
73
  mutation: {
68
74
  updateUser: updateUserMutationInstance.updateUser.bind(updateUserMutationInstance)
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecommendationSchema = void 0;
4
+ const BasicUser_1 = require("../BasicUser");
5
+ const Media_1 = require("./Media");
6
+ exports.RecommendationSchema = `
7
+ id
8
+ rating
9
+ userRating
10
+ media {
11
+ ${Media_1.MediaSchema}
12
+ }
13
+ mediaRecommendation {
14
+ ${Media_1.MediaSchema}
15
+ }
16
+ user {
17
+ ${BasicUser_1.BasicUserSchema}
18
+ }
19
+ `;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThreadCommentSchema = void 0;
4
+ const Thread_1 = require("./Thread");
5
+ const BasicUser_1 = require("../BasicUser");
6
+ exports.ThreadCommentSchema = `
7
+ id
8
+ userId
9
+ threadId
10
+ comment (asHtml: $asHtml)
11
+ likeCount
12
+ isLiked
13
+ siteUrl
14
+ createdAt
15
+ updatedAt
16
+ thread {
17
+ ${Thread_1.ThreadSchema}
18
+ }
19
+ user {
20
+ ${BasicUser_1.BasicUserSchema}
21
+ }
22
+ likes {
23
+ ${BasicUser_1.BasicUserSchema}
24
+ }
25
+ childComments
26
+ isLocked
27
+ `;
@@ -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.RecommendationQuery = void 0;
13
+ const APIWrapper_1 = require("../../../base/APIWrapper");
14
+ const RequestHandler_1 = require("../../../base/RequestHandler");
15
+ const Recommendation_1 = require("../interfaces/responses/Recommendation");
16
+ class RecommendationQuery extends APIWrapper_1.APIWrapper {
17
+ constructor(authToken) {
18
+ super('https://graphql.anilist.co');
19
+ this.authToken = authToken;
20
+ }
21
+ recommmendation(variables) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const query = `
24
+ query ($id: Int, $mediaId: Int, $mediaRecommendationId: Int, $userId: Int, $rating: Int, $onList: Boolean, $rating_greater: Int, $rating_lesser: Int, $sort: [RecommendationSort], $asHtml: Boolean) {
25
+ Recommendation (id: $id, mediaId: $mediaId, mediaRecommendationId: $mediaRecommendationId, userId: $userId, rating: $rating, onList: $onList, rating_greater: $rating_greater, rating_lesser: $rating_lesser, sort: $sort) {
26
+ ${Recommendation_1.RecommendationSchema}
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.RecommendationQuery = RecommendationQuery;
@@ -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.ThreadCommentQuery = void 0;
13
+ const APIWrapper_1 = require("../../../base/APIWrapper");
14
+ const RequestHandler_1 = require("../../../base/RequestHandler");
15
+ const ThreadComment_1 = require("../interfaces/responses/ThreadComment");
16
+ class ThreadCommentQuery extends APIWrapper_1.APIWrapper {
17
+ constructor(authToken) {
18
+ super('https://graphql.anilist.co');
19
+ this.authToken = authToken;
20
+ }
21
+ threadComment(variables) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const query = `
24
+ query ($id: Int, $threadId: Int, $userId: Int, $sort: [ThreadCommentSort], $asHtml: Boolean) {
25
+ ThreadComment (id: $id, threadId: $threadId, userId: $userId, sort: $sort) {
26
+ ${ThreadComment_1.ThreadCommentSchema}
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.ThreadCommentQuery = ThreadCommentQuery;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anilink-api-wrapper",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Anilist API Wrapper",
5
5
  "main": "dist/AniLink.js",
6
6
  "scripts": {