anilink-api-wrapper 1.4.0 → 1.5.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
@@ -14,6 +14,7 @@ const MediaTagCollection_1 = require("./apis/anilist/query/MediaTagCollection");
14
14
  const Viewer_1 = require("./apis/anilist/query/Viewer");
15
15
  const Notification_1 = require("./apis/anilist/query/Notification");
16
16
  const Studio_1 = require("./apis/anilist/query/Studio");
17
+ const Review_1 = require("./apis/anilist/query/Review");
17
18
  class AniLink {
18
19
  constructor(authToken) {
19
20
  const userQueryInstance = new User_1.UserQuery(authToken);
@@ -29,6 +30,7 @@ class AniLink {
29
30
  const viewerQueryInstance = new Viewer_1.ViewerQuery(authToken);
30
31
  const notificationQueryInstance = new Notification_1.NotificationQuery(authToken);
31
32
  const studioQueryInstance = new Studio_1.StudioQuery(authToken);
33
+ const reviewQueryInstance = new Review_1.ReviewQuery(authToken);
32
34
  const updateUserMutationInstance = new UpdateUser_1.UpdateUserMutation(authToken);
33
35
  this.anilist = {
34
36
  query: {
@@ -44,7 +46,8 @@ class AniLink {
44
46
  mediaTagCollection: mediaTagCollectionQueryInstance.mediaTagCollection.bind(mediaTagCollectionQueryInstance),
45
47
  viewer: viewerQueryInstance.viewer.bind(viewerQueryInstance),
46
48
  notification: notificationQueryInstance.notification.bind(notificationQueryInstance),
47
- studio: studioQueryInstance.studio.bind(studioQueryInstance)
49
+ studio: studioQueryInstance.studio.bind(studioQueryInstance),
50
+ review: reviewQueryInstance.review.bind(reviewQueryInstance)
48
51
  },
49
52
  mutation: {
50
53
  updateUser: updateUserMutationInstance.updateUser.bind(updateUserMutationInstance)
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReviewSchema = void 0;
4
+ const Media_1 = require("./Media");
5
+ const BasicUser_1 = require("../BasicUser");
6
+ exports.ReviewSchema = `
7
+ id
8
+ mediaId
9
+ userId
10
+ mediaType
11
+ summary
12
+ body (asHtml: $asHtml)
13
+ rating
14
+ ratingAmount
15
+ score
16
+ private
17
+ siteUrl
18
+ createdAt
19
+ updatedAt
20
+ user {
21
+ ${BasicUser_1.BasicUserSchema}
22
+ }
23
+ media {
24
+ ${Media_1.MediaSchema}
25
+ }
26
+ `;
@@ -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.ReviewQuery = void 0;
13
+ const APIWrapper_1 = require("../../../base/APIWrapper");
14
+ const RequestHandler_1 = require("../../../base/RequestHandler");
15
+ const Review_1 = require("../interfaces/responses/Review");
16
+ class ReviewQuery extends APIWrapper_1.APIWrapper {
17
+ constructor(authToken) {
18
+ super('https://graphql.anilist.co');
19
+ this.authToken = authToken;
20
+ }
21
+ review(variables) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const query = `
24
+ query ($id: Int, $mediaId: Int, $userId: Int, $mediaType: MediaType, $sort: [ReviewSort], $asHtml: Boolean) {
25
+ Review (id: $id, mediaId: $mediaId, userId: $userId, mediaType: $mediaType, sort: $sort) {
26
+ ${Review_1.ReviewSchema}
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.ReviewQuery = ReviewQuery;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anilink-api-wrapper",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Anilist API Wrapper",
5
5
  "main": "dist/AniLink.js",
6
6
  "scripts": {