anilink-api-wrapper 1.8.0 → 1.9.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
@@ -19,6 +19,7 @@ const Activity_1 = require("./apis/anilist/query/Activity");
19
19
  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
+ const Thread_1 = require("./apis/anilist/query/Thread");
22
23
  class AniLink {
23
24
  constructor(authToken) {
24
25
  const userQueryInstance = new User_1.UserQuery(authToken);
@@ -39,6 +40,7 @@ class AniLink {
39
40
  const activityReplyQueryInstance = new ActivityReply_1.ActivityReplyQuery(authToken);
40
41
  const followingQueryInstance = new Following_1.FollowingQuery(authToken);
41
42
  const followerQueryInstance = new Follower_1.FollowerQuery(authToken);
43
+ const threadQueryInstance = new Thread_1.ThreadQuery(authToken);
42
44
  const updateUserMutationInstance = new UpdateUser_1.UpdateUserMutation(authToken);
43
45
  this.anilist = {
44
46
  query: {
@@ -59,7 +61,8 @@ class AniLink {
59
61
  activity: activityQueryInstance.activity.bind(activityQueryInstance),
60
62
  activityReply: activityReplyQueryInstance.activityReply.bind(activityReplyQueryInstance),
61
63
  following: followingQueryInstance.following.bind(followingQueryInstance),
62
- follower: followerQueryInstance.follower.bind(followerQueryInstance)
64
+ follower: followerQueryInstance.follower.bind(followerQueryInstance),
65
+ thread: threadQueryInstance.thread.bind(threadQueryInstance)
63
66
  },
64
67
  mutation: {
65
68
  updateUser: updateUserMutationInstance.updateUser.bind(updateUserMutationInstance)
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThreadSchema = void 0;
4
+ const Media_1 = require("./Media");
5
+ const BasicUser_1 = require("../BasicUser");
6
+ exports.ThreadSchema = `
7
+ id
8
+ title
9
+ body (asHtml: $asHtml)
10
+ userId
11
+ replyUserId
12
+ replyCommentId
13
+ replyCount
14
+ viewCount
15
+ isLocked
16
+ isSticky
17
+ isSubscribed
18
+ likeCount
19
+ isLiked
20
+ repliedAt
21
+ createdAt
22
+ updatedAt
23
+ user {
24
+ ${BasicUser_1.BasicUserSchema}
25
+ }
26
+ replyUser {
27
+ ${BasicUser_1.BasicUserSchema}
28
+ }
29
+ likes {
30
+ ${BasicUser_1.BasicUserSchema}
31
+ }
32
+ siteUrl
33
+ categories {
34
+ id
35
+ name
36
+ }
37
+ mediaCategories {
38
+ ${Media_1.MediaSchema}
39
+ }
40
+ `;
@@ -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.ThreadQuery = void 0;
13
+ const APIWrapper_1 = require("../../../base/APIWrapper");
14
+ const RequestHandler_1 = require("../../../base/RequestHandler");
15
+ const Thread_1 = require("../interfaces/responses/Thread");
16
+ class ThreadQuery extends APIWrapper_1.APIWrapper {
17
+ constructor(authToken) {
18
+ super('https://graphql.anilist.co');
19
+ this.authToken = authToken;
20
+ }
21
+ thread(variables) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const query = `
24
+ query ($id: Int, $userId: Int, $replyUserId: Int, $subscribed: Boolean, $categoryId: Int, $mediaCategoryId: Int, $search: String, $id_in: [Int], $sort: [ThreadSort], $asHtml: Boolean) {
25
+ Thread (id: $id, userId: $userId, replyUserId: $replyUserId, subscribed: $subscribed, categoryId: $categoryId, mediaCategoryId: $mediaCategoryId, search: $search, id_in: $id_in, sort: $sort) {
26
+ ${Thread_1.ThreadSchema}
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.ThreadQuery = ThreadQuery;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anilink-api-wrapper",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Anilist API Wrapper",
5
5
  "main": "dist/AniLink.js",
6
6
  "scripts": {