anilink-api-wrapper 1.3.1 → 1.4.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
@@ -13,6 +13,7 @@ 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
15
  const Notification_1 = require("./apis/anilist/query/Notification");
16
+ const Studio_1 = require("./apis/anilist/query/Studio");
16
17
  class AniLink {
17
18
  constructor(authToken) {
18
19
  const userQueryInstance = new User_1.UserQuery(authToken);
@@ -27,6 +28,7 @@ class AniLink {
27
28
  const mediaTagCollectionQueryInstance = new MediaTagCollection_1.MediaTagCollectionQuery(authToken);
28
29
  const viewerQueryInstance = new Viewer_1.ViewerQuery(authToken);
29
30
  const notificationQueryInstance = new Notification_1.NotificationQuery(authToken);
31
+ const studioQueryInstance = new Studio_1.StudioQuery(authToken);
30
32
  const updateUserMutationInstance = new UpdateUser_1.UpdateUserMutation(authToken);
31
33
  this.anilist = {
32
34
  query: {
@@ -41,7 +43,8 @@ class AniLink {
41
43
  genreCollection: genreCollectionQueryInstance.genreCollection.bind(genreCollectionQueryInstance),
42
44
  mediaTagCollection: mediaTagCollectionQueryInstance.mediaTagCollection.bind(mediaTagCollectionQueryInstance),
43
45
  viewer: viewerQueryInstance.viewer.bind(viewerQueryInstance),
44
- notification: notificationQueryInstance.notification.bind(notificationQueryInstance)
46
+ notification: notificationQueryInstance.notification.bind(notificationQueryInstance),
47
+ studio: studioQueryInstance.studio.bind(studioQueryInstance)
45
48
  },
46
49
  mutation: {
47
50
  updateUser: updateUserMutationInstance.updateUser.bind(updateUserMutationInstance)
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StudioSchema = void 0;
4
+ const Character_1 = require("./Character");
5
+ const Staff_1 = require("./Staff");
6
+ const Media_1 = require("./Media");
7
+ const Name_1 = require("../Name");
8
+ const Image_1 = require("../Image");
9
+ exports.StudioSchema = `
10
+ id
11
+ name
12
+ isAnimationStudio
13
+ media (sort: $mediaSort, isMain: $mediaIsMain onList: $mediaOnList, page: $mediaPage, perPage: $mediaPerPage) {
14
+ edges {
15
+ id
16
+ relationType
17
+ isMainStudio
18
+ characters {
19
+ ${Character_1.CharacterSchema}
20
+ }
21
+ characterRole
22
+ characterName
23
+ roleNotes
24
+ dubGroup
25
+ voiceActors {
26
+ ${Staff_1.StaffSchema}
27
+ }
28
+ voiceActorRoles {
29
+ voiceActor {
30
+ id
31
+ ${Name_1.NameSchema}
32
+ ${Image_1.ImageSchema}
33
+ }
34
+ roleNotes
35
+ dubGroup
36
+ }
37
+ favouriteOrder
38
+ node {
39
+ ${Media_1.MediaSchema}
40
+ }
41
+ }
42
+ nodes {
43
+ ${Media_1.MediaSchema}
44
+ }
45
+ pageInfo {
46
+ total
47
+ perPage
48
+ currentPage
49
+ lastPage
50
+ hasNextPage
51
+ }
52
+ }
53
+ siteUrl
54
+ isFavourite
55
+ favourites
56
+ `;
@@ -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.StudioQuery = void 0;
13
+ const APIWrapper_1 = require("../../../base/APIWrapper");
14
+ const RequestHandler_1 = require("../../../base/RequestHandler");
15
+ const Studio_1 = require("../interfaces/responses/Studio");
16
+ class StudioQuery extends APIWrapper_1.APIWrapper {
17
+ constructor(authToken) {
18
+ super('https://graphql.anilist.co');
19
+ this.authToken = authToken;
20
+ }
21
+ studio(variables) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const query = `
24
+ query ($id: Int, $search: String, $id_not: Int, $id_in: [Int], $id_not_in: [Int], $sort: [StudioSort], $asHtml: Boolean, $mediaSort: [MediaSort], $mediaIsMain: Boolean, $mediaOnList: Boolean, $mediaPage: Int, $mediaPerPage: Int, $staffMediaSort: [MediaSort], $staffMediaType: MediaType, $staffMediaOnList: Boolean, $staffMediaPage: Int, $staffMediaPerPage: Int, $charactersSort: [CharacterSort], $charactersPage: Int, $charactersPerPage: Int, $characterMediaSort: [MediaSort], $characterMediaOnList: Boolean, $characterMediaPage: Int, $characterMediaPerPage: Int) {
25
+ Studio (id: $id, search: $search, id_not: $id_not, id_in: $id_in, id_not_in: $id_not_in, sort: $sort) {
26
+ ${Studio_1.StudioSchema}
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.StudioQuery = StudioQuery;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anilink-api-wrapper",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Anilist API Wrapper",
5
5
  "main": "dist/AniLink.js",
6
6
  "scripts": {