anilink-api-wrapper 1.29.2 → 2.1.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.
Files changed (142) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +71 -241
  3. package/dist/AniLink.d.ts +12329 -0
  4. package/dist/AniLink.mjs +7298 -0
  5. package/dist/anilist.d.ts +1 -0
  6. package/dist/anilist.mjs +5 -0
  7. package/dist/mal.d.ts +1 -0
  8. package/dist/mal.mjs +5 -0
  9. package/package.json +121 -46
  10. package/dist/AniLink.js +0 -248
  11. package/dist/apis/anilist/Custom.js +0 -42
  12. package/dist/apis/anilist/interfaces/Activity.js +0 -436
  13. package/dist/apis/anilist/interfaces/Basic.js +0 -33
  14. package/dist/apis/anilist/interfaces/CoverImage.js +0 -15
  15. package/dist/apis/anilist/interfaces/Distribution.js +0 -23
  16. package/dist/apis/anilist/interfaces/ExternalLink.js +0 -14
  17. package/dist/apis/anilist/interfaces/Favoured.js +0 -2
  18. package/dist/apis/anilist/interfaces/FuzzyDate.js +0 -12
  19. package/dist/apis/anilist/interfaces/Image.js +0 -13
  20. package/dist/apis/anilist/interfaces/ListScores.js +0 -2
  21. package/dist/apis/anilist/interfaces/Media.js +0 -13
  22. package/dist/apis/anilist/interfaces/Name.js +0 -15
  23. package/dist/apis/anilist/interfaces/NextAiringEpisode.js +0 -14
  24. package/dist/apis/anilist/interfaces/Notification.js +0 -25
  25. package/dist/apis/anilist/interfaces/Ranking.js +0 -19
  26. package/dist/apis/anilist/interfaces/SiteTrend.js +0 -33
  27. package/dist/apis/anilist/interfaces/Staff.js +0 -2
  28. package/dist/apis/anilist/interfaces/Stat.js +0 -2
  29. package/dist/apis/anilist/interfaces/Statistics.js +0 -2
  30. package/dist/apis/anilist/interfaces/StreamingEpisode.js +0 -15
  31. package/dist/apis/anilist/interfaces/Studio.js +0 -2
  32. package/dist/apis/anilist/interfaces/Tag.js +0 -18
  33. package/dist/apis/anilist/interfaces/Title.js +0 -15
  34. package/dist/apis/anilist/interfaces/Trailer.js +0 -14
  35. package/dist/apis/anilist/interfaces/UserStats.js +0 -23
  36. package/dist/apis/anilist/interfaces/responses/mutation/Favourites.js +0 -83
  37. package/dist/apis/anilist/interfaces/responses/query/AiringSchedule.js +0 -18
  38. package/dist/apis/anilist/interfaces/responses/query/AniChartUser.js +0 -2
  39. package/dist/apis/anilist/interfaces/responses/query/Character.js +0 -34
  40. package/dist/apis/anilist/interfaces/responses/query/ExternalLinkSourceCollection.js +0 -2
  41. package/dist/apis/anilist/interfaces/responses/query/Media.js +0 -217
  42. package/dist/apis/anilist/interfaces/responses/query/MediaList.js +0 -36
  43. package/dist/apis/anilist/interfaces/responses/query/MediaListCollectionResponse.js +0 -49
  44. package/dist/apis/anilist/interfaces/responses/query/MediaTagCollection.js +0 -2
  45. package/dist/apis/anilist/interfaces/responses/query/MediaTrend.js +0 -21
  46. package/dist/apis/anilist/interfaces/responses/query/Notification.js +0 -166
  47. package/dist/apis/anilist/interfaces/responses/query/Recommendation.js +0 -23
  48. package/dist/apis/anilist/interfaces/responses/query/Review.js +0 -30
  49. package/dist/apis/anilist/interfaces/responses/query/SiteStatistics.js +0 -31
  50. package/dist/apis/anilist/interfaces/responses/query/Staff.js +0 -59
  51. package/dist/apis/anilist/interfaces/responses/query/Studio.js +0 -60
  52. package/dist/apis/anilist/interfaces/responses/query/Thread.js +0 -44
  53. package/dist/apis/anilist/interfaces/responses/query/ThreadComment.js +0 -31
  54. package/dist/apis/anilist/interfaces/responses/query/User.js +0 -366
  55. package/dist/apis/anilist/mutation/DeleteActivity.js +0 -61
  56. package/dist/apis/anilist/mutation/DeleteActivityReply.js +0 -61
  57. package/dist/apis/anilist/mutation/DeleteCustomList.js +0 -63
  58. package/dist/apis/anilist/mutation/DeleteMediaListEntry.js +0 -61
  59. package/dist/apis/anilist/mutation/DeleteReview.js +0 -61
  60. package/dist/apis/anilist/mutation/DeleteThread.js +0 -61
  61. package/dist/apis/anilist/mutation/DeleteThreadComment.js +0 -61
  62. package/dist/apis/anilist/mutation/SaveActivityReply.js +0 -66
  63. package/dist/apis/anilist/mutation/SaveListActivity.js +0 -64
  64. package/dist/apis/anilist/mutation/SaveMediaListEntry.js +0 -97
  65. package/dist/apis/anilist/mutation/SaveMessageActivity.js +0 -68
  66. package/dist/apis/anilist/mutation/SaveRecommendation.js +0 -66
  67. package/dist/apis/anilist/mutation/SaveReview.js +0 -68
  68. package/dist/apis/anilist/mutation/SaveTextActivity.js +0 -65
  69. package/dist/apis/anilist/mutation/SaveThread.js +0 -69
  70. package/dist/apis/anilist/mutation/SaveThreadComment.js +0 -67
  71. package/dist/apis/anilist/mutation/ToggleActivityPin.js +0 -64
  72. package/dist/apis/anilist/mutation/ToggleActivitySubscription.js +0 -64
  73. package/dist/apis/anilist/mutation/ToggleFavourite.js +0 -66
  74. package/dist/apis/anilist/mutation/ToggleFollow.js +0 -62
  75. package/dist/apis/anilist/mutation/ToggleLike.js +0 -64
  76. package/dist/apis/anilist/mutation/ToggleLikeV2.js +0 -64
  77. package/dist/apis/anilist/mutation/ToggleThreadSubscription.js +0 -64
  78. package/dist/apis/anilist/mutation/UpdateAniChartHighlights.js +0 -58
  79. package/dist/apis/anilist/mutation/UpdateAniChartSettings.js +0 -58
  80. package/dist/apis/anilist/mutation/UpdateFavouriteOrder.js +0 -73
  81. package/dist/apis/anilist/mutation/UpdateMediaListEntries.js +0 -93
  82. package/dist/apis/anilist/mutation/UpdateUser.js +0 -127
  83. package/dist/apis/anilist/query/Activity.js +0 -86
  84. package/dist/apis/anilist/query/ActivityReply.js +0 -60
  85. package/dist/apis/anilist/query/AiringSchedule.js +0 -78
  86. package/dist/apis/anilist/query/AniChartUser.js +0 -56
  87. package/dist/apis/anilist/query/Character.js +0 -70
  88. package/dist/apis/anilist/query/ExternalLinkSourceCollection.js +0 -68
  89. package/dist/apis/anilist/query/Follower.js +0 -64
  90. package/dist/apis/anilist/query/Following.js +0 -64
  91. package/dist/apis/anilist/query/GenreCollection.js +0 -46
  92. package/dist/apis/anilist/query/Markdown.js +0 -57
  93. package/dist/apis/anilist/query/Media.js +0 -134
  94. package/dist/apis/anilist/query/MediaList.js +0 -90
  95. package/dist/apis/anilist/query/MediaListCollection.js +0 -76
  96. package/dist/apis/anilist/query/MediaTagCollection.js +0 -57
  97. package/dist/apis/anilist/query/MediaTrend.js +0 -84
  98. package/dist/apis/anilist/query/Notification.js +0 -65
  99. package/dist/apis/anilist/query/Recommendation.js +0 -68
  100. package/dist/apis/anilist/query/Review.js +0 -64
  101. package/dist/apis/anilist/query/SiteStatistics.js +0 -78
  102. package/dist/apis/anilist/query/Staff.js +0 -79
  103. package/dist/apis/anilist/query/Studio.js +0 -82
  104. package/dist/apis/anilist/query/Thread.js +0 -68
  105. package/dist/apis/anilist/query/ThreadComment.js +0 -63
  106. package/dist/apis/anilist/query/User.js +0 -68
  107. package/dist/apis/anilist/query/Viewer.js +0 -65
  108. package/dist/apis/anilist/query/page/Activities.js +0 -97
  109. package/dist/apis/anilist/query/page/ActivityReplies.js +0 -71
  110. package/dist/apis/anilist/query/page/AiringSchedules.js +0 -89
  111. package/dist/apis/anilist/query/page/Characters.js +0 -81
  112. package/dist/apis/anilist/query/page/Followers.js +0 -75
  113. package/dist/apis/anilist/query/page/Followings.js +0 -75
  114. package/dist/apis/anilist/query/page/Likes.js +0 -71
  115. package/dist/apis/anilist/query/page/MediaLists.js +0 -101
  116. package/dist/apis/anilist/query/page/MediaTrends.js +0 -95
  117. package/dist/apis/anilist/query/page/Medias.js +0 -143
  118. package/dist/apis/anilist/query/page/Notifications.js +0 -73
  119. package/dist/apis/anilist/query/page/Recommendations.js +0 -79
  120. package/dist/apis/anilist/query/page/Reviews.js +0 -75
  121. package/dist/apis/anilist/query/page/Staffs.js +0 -90
  122. package/dist/apis/anilist/query/page/Studios.js +0 -93
  123. package/dist/apis/anilist/query/page/ThreadCommments.js +0 -74
  124. package/dist/apis/anilist/query/page/Threads.js +0 -79
  125. package/dist/apis/anilist/query/page/Users.js +0 -79
  126. package/dist/apis/anilist/types/ActivityType.js +0 -14
  127. package/dist/apis/anilist/types/DisabledListActivity.js +0 -11
  128. package/dist/apis/anilist/types/Format.js +0 -30
  129. package/dist/apis/anilist/types/FuzzyDate.js +0 -12
  130. package/dist/apis/anilist/types/MediaListOptions.js +0 -16
  131. package/dist/apis/anilist/types/NotificationOptions.js +0 -29
  132. package/dist/apis/anilist/types/RecommendationRating.js +0 -12
  133. package/dist/apis/anilist/types/Season.js +0 -13
  134. package/dist/apis/anilist/types/Sort.js +0 -265
  135. package/dist/apis/anilist/types/Source.js +0 -25
  136. package/dist/apis/anilist/types/Status.js +0 -26
  137. package/dist/apis/anilist/types/Type.js +0 -44
  138. package/dist/apis/anilist/types/UserStaffNameLanguage.js +0 -15
  139. package/dist/apis/anilist/types/UserTitleLanguage.js +0 -15
  140. package/dist/base/APIWrapper.js +0 -17
  141. package/dist/base/RequestHandler.js +0 -48
  142. package/dist/base/ValidateVariables.js +0 -125
@@ -1,68 +0,0 @@
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/query/Thread");
16
- const Sort_1 = require("../types/Sort");
17
- const ValidateVariables_1 = require("../../../base/ValidateVariables");
18
- /**
19
- * `ThreadQuery` is a class representing a query for thread data.
20
- * It includes a method to send the thread query and receive the response.
21
- */
22
- class ThreadQuery extends APIWrapper_1.APIWrapper {
23
- /**
24
- * Constructs a new `ThreadQuery` instance.
25
- *
26
- * @param authToken - The authentication token.
27
- */
28
- constructor(authToken) {
29
- super('https://graphql.anilist.co');
30
- this.authToken = authToken;
31
- }
32
- /**
33
- * `thread` is a method that sends a query request to get thread data.
34
- *
35
- * @param variables - The variables for the query.
36
- * @returns The response from the query request.
37
- */
38
- thread(variables) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- if (!variables) {
41
- throw new Error('At least one variable must be provided');
42
- }
43
- const variableTypeMappings = {
44
- id: 'number',
45
- userId: 'number',
46
- replyUserId: 'number',
47
- subscribed: 'boolean',
48
- categoryId: 'number',
49
- mediaCategoryId: 'number',
50
- search: 'string',
51
- id_in: 'number[]',
52
- sort: Sort_1.ThreadSortMappings,
53
- asHtml: 'boolean'
54
- };
55
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
56
- const query = `
57
- query ($id: Int, $userId: Int, $replyUserId: Int, $subscribed: Boolean, $categoryId: Int, $mediaCategoryId: Int, $search: String, $id_in: [Int], $sort: [ThreadSort], $asHtml: Boolean) {
58
- Thread (id: $id, userId: $userId, replyUserId: $replyUserId, subscribed: $subscribed, categoryId: $categoryId, mediaCategoryId: $mediaCategoryId, search: $search, id_in: $id_in, sort: $sort) {
59
- ${Thread_1.ThreadSchema}
60
- }
61
- }
62
- `;
63
- const data = { query, variables };
64
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
65
- });
66
- }
67
- }
68
- exports.ThreadQuery = ThreadQuery;
@@ -1,63 +0,0 @@
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/query/ThreadComment");
16
- const Sort_1 = require("../types/Sort");
17
- const ValidateVariables_1 = require("../../../base/ValidateVariables");
18
- /**
19
- * `ThreadCommentQuery` is a class representing a query for thread comment data.
20
- * It includes a method to send the thread comment query and receive the response.
21
- */
22
- class ThreadCommentQuery extends APIWrapper_1.APIWrapper {
23
- /**
24
- * Constructs a new `ThreadCommentQuery` instance.
25
- *
26
- * @param authToken - The authentication token.
27
- */
28
- constructor(authToken) {
29
- super('https://graphql.anilist.co');
30
- this.authToken = authToken;
31
- }
32
- /**
33
- * `threadComment` is a method that sends a query request to get thread comment data.
34
- *
35
- * @param variables - The variables for the query.
36
- * @returns The response from the query request.
37
- */
38
- threadComment(variables) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- if (!variables) {
41
- throw new Error('At least one variable must be provided');
42
- }
43
- const variableTypeMappings = {
44
- id: 'number',
45
- threadId: 'number',
46
- userId: 'number',
47
- sort: Sort_1.ThreadSortMappings,
48
- asHtml: 'boolean'
49
- };
50
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
51
- const query = `
52
- query ($id: Int, $threadId: Int, $userId: Int, $sort: [ThreadCommentSort], $asHtml: Boolean) {
53
- ThreadComment (id: $id, threadId: $threadId, userId: $userId, sort: $sort) {
54
- ${ThreadComment_1.ThreadCommentSchema}
55
- }
56
- }
57
- `;
58
- const data = { query, variables };
59
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
60
- });
61
- }
62
- }
63
- exports.ThreadCommentQuery = ThreadCommentQuery;
@@ -1,68 +0,0 @@
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.UserQuery = void 0;
13
- const APIWrapper_1 = require("../../../base/APIWrapper");
14
- const RequestHandler_1 = require("../../../base/RequestHandler");
15
- const User_1 = require("../interfaces/responses/query/User");
16
- const Sort_1 = require("../types/Sort");
17
- const ValidateVariables_1 = require("../../../base/ValidateVariables");
18
- /**
19
- * `UserQuery` is a class representing a query for user data.
20
- * It includes a method to send the user query and receive the response.
21
- */
22
- class UserQuery extends APIWrapper_1.APIWrapper {
23
- /**
24
- * Constructs a new `UserQuery` instance.
25
- *
26
- * @param authToken - The authentication token.
27
- */
28
- constructor(authToken) {
29
- super('https://graphql.anilist.co');
30
- this.authToken = authToken;
31
- }
32
- /**
33
- * `user` is a method that sends a query request to get user data.
34
- *
35
- * @param variables - The variables for the query.
36
- * @returns The response from the query request.
37
- */
38
- user(variables) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- if (!variables) {
41
- throw new Error('At least one variable must be provided');
42
- }
43
- const variableTypeMappings = {
44
- id: 'number',
45
- name: 'string',
46
- isModerator: 'boolean',
47
- search: 'string',
48
- sort: Sort_1.UserSortMappings,
49
- asHtml: 'boolean',
50
- animeStatLimit: 'number',
51
- mangaStatLimit: 'number',
52
- animeStatSort: Sort_1.UserStatisticSortMappings,
53
- mangaStatSort: Sort_1.UserStatisticSortMappings
54
- };
55
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
56
- const query = `
57
- query ($id: Int, $name: String, $isModerator: Boolean, $search: String, $sort: [UserSort], $asHtml: Boolean, $animeStatLimit: Int, $mangaStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatSort: [UserStatisticsSort]) {
58
- User (id: $id, name: $name, isModerator: $isModerator, search: $search, sort: $sort) {
59
- ${User_1.UserSchema}
60
- }
61
- }
62
- `;
63
- const data = { query, variables };
64
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
65
- });
66
- }
67
- }
68
- exports.UserQuery = UserQuery;
@@ -1,65 +0,0 @@
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.ViewerQuery = void 0;
13
- const APIWrapper_1 = require("../../../base/APIWrapper");
14
- const RequestHandler_1 = require("../../../base/RequestHandler");
15
- const User_1 = require("../interfaces/responses/query/User");
16
- const Sort_1 = require("../types/Sort");
17
- const ValidateVariables_1 = require("../../../base/ValidateVariables");
18
- /**
19
- * `ViewerQuery` is a class representing a query for viewer data.
20
- * It includes a method to send the viewer query and receive the response.
21
- */
22
- class ViewerQuery extends APIWrapper_1.APIWrapper {
23
- /**
24
- * Constructs a new `ViewerQuery` instance.
25
- *
26
- * @param authToken - The authentication token.
27
- */
28
- constructor(authToken) {
29
- super('https://graphql.anilist.co');
30
- this.authToken = authToken;
31
- }
32
- /**
33
- * `viewer` is a method that sends a query request to get viewer data.
34
- *
35
- * @param variables - The variables for the query.
36
- * @returns The response from the query request.
37
- */
38
- viewer() {
39
- return __awaiter(this, arguments, void 0, function* (variables = {}) {
40
- if (!this.authToken) {
41
- throw new Error('ViewerQuery requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
42
- }
43
- const variableTypeMappings = {
44
- asHtml: 'boolean',
45
- animeStatLimit: 'number',
46
- mangaStatLimit: 'number',
47
- animeStatSort: Sort_1.UserStatisticSortMappings,
48
- mangaStatSort: Sort_1.UserStatisticSortMappings
49
- };
50
- if (Object(variables).length > 0) {
51
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
52
- }
53
- const query = `
54
- query ($asHtml: Boolean, $animeStatLimit: Int, $mangaStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatSort: [UserStatisticsSort]) {
55
- Viewer {
56
- ${User_1.UserSchema}
57
- }
58
- }
59
- `;
60
- const data = { query, variables };
61
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
62
- });
63
- }
64
- }
65
- exports.ViewerQuery = ViewerQuery;
@@ -1,97 +0,0 @@
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.ActivitiesQuery = void 0;
13
- const APIWrapper_1 = require("../../../../base/APIWrapper");
14
- const RequestHandler_1 = require("../../../../base/RequestHandler");
15
- const Activity_1 = require("../../interfaces/Activity");
16
- const ActivityType_1 = require("../../types/ActivityType");
17
- const Sort_1 = require("../../types/Sort");
18
- const ValidateVariables_1 = require("../../../../base/ValidateVariables");
19
- /**
20
- * `ActivitiesQuery` is a class representing a query for activities.
21
- * It includes a method to get activities.
22
- */
23
- class ActivitiesQuery extends APIWrapper_1.APIWrapper {
24
- /**
25
- * Constructs a new `ActivitiesQuery` instance.
26
- *
27
- * @param authToken - The authentication token.
28
- */
29
- constructor(authToken) {
30
- super('https://graphql.anilist.co');
31
- this.authToken = authToken;
32
- }
33
- /**
34
- * `activities` is a method that sends a query request to get activities.
35
- *
36
- * @param variables - The variables for the query.
37
- * @returns The response from the query request.
38
- */
39
- activities(variables) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- if (!variables) {
42
- throw new Error('At least one variable must be set');
43
- }
44
- const variableTypeMappings = {
45
- page: 'number',
46
- perPage: 'number',
47
- id: 'number',
48
- userId: 'number',
49
- messengerId: 'number',
50
- mediaId: 'number',
51
- type: ActivityType_1.ActivityTypeMappings,
52
- isFollowing: 'boolean',
53
- hasReplies: 'boolean',
54
- hasRepliesOrTypeText: 'boolean',
55
- createdAt: 'number',
56
- id_not: 'number',
57
- id_in: 'number[]',
58
- id_not_in: 'number[]',
59
- userId_not: 'number',
60
- userId_in: 'number[]',
61
- userId_not_in: 'number[]',
62
- messengerId_not: 'number',
63
- messengerId_in: 'number[]',
64
- messengerId_not_in: 'number[]',
65
- mediaId_not: 'number',
66
- mediaId_in: 'number[]',
67
- mediaId_not_in: 'number[]',
68
- type_not: ActivityType_1.ActivityTypeMappings,
69
- type_in: ActivityType_1.ActivityTypeMappings,
70
- type_not_in: ActivityType_1.ActivityTypeMappings,
71
- createdAt_greater: 'number',
72
- sort: Sort_1.ActivitySortMappings,
73
- asHtml: 'boolean'
74
- };
75
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
76
- const query = `
77
- query ($page: Int, $perPage: Int, $id: Int, $userId: Int, $messengerId: Int, $mediaId: Int, $type: ActivityType, $isFollowing: Boolean, $hasReplies: Boolean, $hasRepliesOrTypeText: Boolean, $createdAt: Int, $id_not: Int, $id_in: [Int], $id_not_in: [Int], $userId_not: Int, $userId_in: [Int], $userId_not_in: [Int], $messengerId_not: Int, $messengerId_in: [Int], $messengerId_not_in: [Int], $mediaId_not: Int, $mediaId_in: [Int], $mediaId_not_in: [Int], $type_not: ActivityType, $type_in: [ActivityType], $type_not_in: [ActivityType], $createdAt_greater: Int, $sort: [ActivitySort], $asHtml: Boolean) {
78
- Page (page: $page, perPage: $perPage) {
79
- pageInfo {
80
- total
81
- perPage
82
- currentPage
83
- lastPage
84
- hasNextPage
85
- }
86
- activities (id: $id, userId: $userId, messengerId: $messengerId, mediaId: $mediaId, type: $type, isFollowing: $isFollowing, hasReplies: $hasReplies, hasRepliesOrTypeText: $hasRepliesOrTypeText, createdAt: $createdAt, id_not: $id_not, id_in: $id_in, id_not_in: $id_not_in, userId_not: $userId_not, userId_in: $userId_in, userId_not_in: $userId_not_in, messengerId_not: $messengerId_not, messengerId_in: $messengerId_in, messengerId_not_in: $messengerId_not_in, mediaId_not: $mediaId_not, mediaId_in: $mediaId_in, mediaId_not_in: $mediaId_not_in, type_not: $type_not, type_in: $type_in, type_not_in: $type_not_in, createdAt_greater: $createdAt_greater, sort: $sort) {
87
- ${Activity_1.ActivityWithRepliesSchema}
88
- }
89
- }
90
- }
91
- `;
92
- const data = { query, variables };
93
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
94
- });
95
- }
96
- }
97
- exports.ActivitiesQuery = ActivitiesQuery;
@@ -1,71 +0,0 @@
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.ActivityRepliesQuery = void 0;
13
- const APIWrapper_1 = require("../../../../base/APIWrapper");
14
- const RequestHandler_1 = require("../../../../base/RequestHandler");
15
- const ValidateVariables_1 = require("../../../../base/ValidateVariables");
16
- const Activity_1 = require("../../interfaces/Activity");
17
- /**
18
- * `ActivityRepliesQuery` is a class representing a query for activity replies.
19
- * It includes a method to get activity replies.
20
- */
21
- class ActivityRepliesQuery extends APIWrapper_1.APIWrapper {
22
- /**
23
- * Constructs a new `ActivityRepliesQuery` instance.
24
- *
25
- * @param authToken - The authentication token.
26
- */
27
- constructor(authToken) {
28
- super('https://graphql.anilist.co');
29
- this.authToken = authToken;
30
- }
31
- /**
32
- * `activityReplies` is a method that sends a query request to get activity replies.
33
- *
34
- * @param variables - The variables for the query.
35
- * @returns The response from the query request.
36
- */
37
- activityReplies(variables) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- if (!variables.id) {
40
- throw new Error('The id is required');
41
- }
42
- const variableTypeMappings = {
43
- page: 'number',
44
- perPage: 'number',
45
- id: 'number',
46
- activityId: 'number',
47
- asHtml: 'boolean'
48
- };
49
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
50
- const query = `
51
- query ($page: Int, $perPage: Int, $id: Int, $activityId: Int, $asHtml: Boolean) {
52
- Page (page: $page, perPage: $perPage) {
53
- pageInfo {
54
- total
55
- perPage
56
- currentPage
57
- lastPage
58
- hasNextPage
59
- }
60
- activityReplies (id: $id, activityId: $activityId) {
61
- ${Activity_1.ActivityReplySchema}
62
- }
63
- }
64
- }
65
- `;
66
- const data = { query, variables };
67
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
68
- });
69
- }
70
- }
71
- exports.ActivityRepliesQuery = ActivityRepliesQuery;
@@ -1,89 +0,0 @@
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.AiringSchedulesQuery = void 0;
13
- const APIWrapper_1 = require("../../../../base/APIWrapper");
14
- const RequestHandler_1 = require("../../../../base/RequestHandler");
15
- const AiringSchedule_1 = require("../../interfaces/responses/query/AiringSchedule");
16
- const Sort_1 = require("../../types/Sort");
17
- const ValidateVariables_1 = require("../../../../base/ValidateVariables");
18
- /**
19
- * `AiringSchedulesQuery` is a class representing a query for airing schedules.
20
- * It includes a method to get airing schedules.
21
- */
22
- class AiringSchedulesQuery extends APIWrapper_1.APIWrapper {
23
- /**
24
- * Constructs a new `AiringSchedulesQuery` instance.
25
- *
26
- * @param authToken - The authentication token.
27
- */
28
- constructor(authToken) {
29
- super('https://graphql.anilist.co');
30
- this.authToken = authToken;
31
- }
32
- /**
33
- * `airingSchedules` is a method that sends a query request to get airing schedules.
34
- *
35
- * @param variables - The variables for the query.
36
- * @returns The response from the query request.
37
- */
38
- airingSchedules(variables) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- if (!variables) {
41
- throw new Error('At least one variable must be set');
42
- }
43
- const variableTypeMappings = {
44
- page: 'number',
45
- perPage: 'number',
46
- id: 'number',
47
- mediaId: 'number',
48
- episode: 'number',
49
- airingAt: 'number',
50
- notYetAired: 'boolean',
51
- id_not: 'number',
52
- id_in: 'number[]',
53
- id_not_in: 'number[]',
54
- mediaId_not: 'number',
55
- mediaId_in: 'number[]',
56
- mediaId_not_in: 'number[]',
57
- episode_not: 'number',
58
- episode_in: 'number[]',
59
- episode_not_in: 'number[]',
60
- episode_greater: 'number',
61
- episode_lesser: 'number',
62
- airingAt_greater: 'number',
63
- airingAt_lesser: 'number',
64
- sort: Sort_1.AiringSortMappings,
65
- asHtml: 'boolean'
66
- };
67
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
68
- const query = `
69
- query ($page: Int, $perPage: Int, $id: Int, $mediaId: Int, $episode: Int, $airingAt: Int, $notYetAired: Boolean, $id_not: Int, $id_in: [Int], $id_not_in: [Int], $mediaId_not: Int, $mediaId_in: [Int], $mediaId_not_in: [Int], $episode_not: Int, $episode_in: [Int], $episode_not_in: [Int], $episode_greater: Int, $episode_lesser: Int, $airingAt_greater: Int, $airingAt_lesser: Int, $sort: [AiringSort], $asHtml: Boolean) {
70
- Page (page: $page, perPage: $perPage) {
71
- pageInfo {
72
- total
73
- perPage
74
- currentPage
75
- lastPage
76
- hasNextPage
77
- }
78
- airingSchedules (id: $id, mediaId: $mediaId, episode: $episode, airingAt: $airingAt, notYetAired: $notYetAired, id_not: $id_not, id_in: $id_in, id_not_in: $id_not_in, mediaId_not: $mediaId_not, mediaId_in: $mediaId_in, mediaId_not_in: $mediaId_not_in, episode_not: $episode_not, episode_in: $episode_in, episode_not_in: $episode_not_in, episode_greater: $episode_greater, episode_lesser: $episode_lesser, airingAt_greater: $airingAt_greater, airingAt_lesser: $airingAt_lesser, sort: $sort) {
79
- ${AiringSchedule_1.AiringScheduleSchema}
80
- }
81
- }
82
- }
83
- `;
84
- const data = { query, variables };
85
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
86
- });
87
- }
88
- }
89
- exports.AiringSchedulesQuery = AiringSchedulesQuery;
@@ -1,81 +0,0 @@
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.CharactersQuery = void 0;
13
- const APIWrapper_1 = require("../../../../base/APIWrapper");
14
- const RequestHandler_1 = require("../../../../base/RequestHandler");
15
- const Character_1 = require("../../interfaces/responses/query/Character");
16
- const Sort_1 = require("../../types/Sort");
17
- const ValidateVariables_1 = require("../../../../base/ValidateVariables");
18
- /**
19
- * `CharactersQuery` is a class representing a query for characters.
20
- * It includes a method to get characters.
21
- */
22
- class CharactersQuery extends APIWrapper_1.APIWrapper {
23
- /**
24
- * Constructs a new `CharactersQuery` instance.
25
- *
26
- * @param authToken - The authentication token.
27
- */
28
- constructor(authToken) {
29
- super('https://graphql.anilist.co');
30
- this.authToken = authToken;
31
- }
32
- /**
33
- * `characters` is a method that sends a query request to get characters.
34
- *
35
- * @param variables - The variables for the query.
36
- * @returns The response from the query request.
37
- */
38
- characters(variables) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- if (!variables) {
41
- throw new Error('At least one variable must be set');
42
- }
43
- const variableTypeMappings = {
44
- page: 'number',
45
- perPage: 'number',
46
- id: 'number',
47
- isBirthday: 'boolean',
48
- search: 'string',
49
- id_not: 'number',
50
- id_in: 'number[]',
51
- id_not_in: 'number[]',
52
- sort: Sort_1.CharacterSortMappings,
53
- asHtml: 'boolean',
54
- mediaSort: Sort_1.MediaSortMappings,
55
- mediaOnList: 'boolean',
56
- mediaPage: 'number',
57
- mediaPerPage: 'number'
58
- };
59
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
60
- const query = `
61
- query ($page: Int, $perPage: Int, $id: Int, $isBirthday: Boolean, $search: String, $id_not: Int, $id_in: [Int], $id_not_in: [Int], $sort: [CharacterSort], $asHtml: Boolean, $mediaSort: [MediaSort], $mediaOnList: Boolean, $mediaPage: Int, $mediaPerPage: Int) {
62
- Page (page: $page, perPage: $perPage) {
63
- pageInfo {
64
- total
65
- perPage
66
- currentPage
67
- lastPage
68
- hasNextPage
69
- }
70
- characters (id: $id, isBirthday: $isBirthday, search: $search, id_not: $id_not, id_in: $id_in, id_not_in: $id_not_in, sort: $sort) {
71
- ${Character_1.CharacterSchema}
72
- }
73
- }
74
- }
75
- `;
76
- const data = { query, variables };
77
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
78
- });
79
- }
80
- }
81
- exports.CharactersQuery = CharactersQuery;