anilink-api-wrapper 1.29.2 → 2.0.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 (140) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +523 -241
  3. package/dist/AniLink.d.ts +11397 -0
  4. package/dist/AniLink.mjs +6664 -0
  5. package/dist/anilist.d.ts +1 -0
  6. package/dist/anilist.mjs +5 -0
  7. package/package.json +111 -46
  8. package/dist/AniLink.js +0 -248
  9. package/dist/apis/anilist/Custom.js +0 -42
  10. package/dist/apis/anilist/interfaces/Activity.js +0 -436
  11. package/dist/apis/anilist/interfaces/Basic.js +0 -33
  12. package/dist/apis/anilist/interfaces/CoverImage.js +0 -15
  13. package/dist/apis/anilist/interfaces/Distribution.js +0 -23
  14. package/dist/apis/anilist/interfaces/ExternalLink.js +0 -14
  15. package/dist/apis/anilist/interfaces/Favoured.js +0 -2
  16. package/dist/apis/anilist/interfaces/FuzzyDate.js +0 -12
  17. package/dist/apis/anilist/interfaces/Image.js +0 -13
  18. package/dist/apis/anilist/interfaces/ListScores.js +0 -2
  19. package/dist/apis/anilist/interfaces/Media.js +0 -13
  20. package/dist/apis/anilist/interfaces/Name.js +0 -15
  21. package/dist/apis/anilist/interfaces/NextAiringEpisode.js +0 -14
  22. package/dist/apis/anilist/interfaces/Notification.js +0 -25
  23. package/dist/apis/anilist/interfaces/Ranking.js +0 -19
  24. package/dist/apis/anilist/interfaces/SiteTrend.js +0 -33
  25. package/dist/apis/anilist/interfaces/Staff.js +0 -2
  26. package/dist/apis/anilist/interfaces/Stat.js +0 -2
  27. package/dist/apis/anilist/interfaces/Statistics.js +0 -2
  28. package/dist/apis/anilist/interfaces/StreamingEpisode.js +0 -15
  29. package/dist/apis/anilist/interfaces/Studio.js +0 -2
  30. package/dist/apis/anilist/interfaces/Tag.js +0 -18
  31. package/dist/apis/anilist/interfaces/Title.js +0 -15
  32. package/dist/apis/anilist/interfaces/Trailer.js +0 -14
  33. package/dist/apis/anilist/interfaces/UserStats.js +0 -23
  34. package/dist/apis/anilist/interfaces/responses/mutation/Favourites.js +0 -83
  35. package/dist/apis/anilist/interfaces/responses/query/AiringSchedule.js +0 -18
  36. package/dist/apis/anilist/interfaces/responses/query/AniChartUser.js +0 -2
  37. package/dist/apis/anilist/interfaces/responses/query/Character.js +0 -34
  38. package/dist/apis/anilist/interfaces/responses/query/ExternalLinkSourceCollection.js +0 -2
  39. package/dist/apis/anilist/interfaces/responses/query/Media.js +0 -217
  40. package/dist/apis/anilist/interfaces/responses/query/MediaList.js +0 -36
  41. package/dist/apis/anilist/interfaces/responses/query/MediaListCollectionResponse.js +0 -49
  42. package/dist/apis/anilist/interfaces/responses/query/MediaTagCollection.js +0 -2
  43. package/dist/apis/anilist/interfaces/responses/query/MediaTrend.js +0 -21
  44. package/dist/apis/anilist/interfaces/responses/query/Notification.js +0 -166
  45. package/dist/apis/anilist/interfaces/responses/query/Recommendation.js +0 -23
  46. package/dist/apis/anilist/interfaces/responses/query/Review.js +0 -30
  47. package/dist/apis/anilist/interfaces/responses/query/SiteStatistics.js +0 -31
  48. package/dist/apis/anilist/interfaces/responses/query/Staff.js +0 -59
  49. package/dist/apis/anilist/interfaces/responses/query/Studio.js +0 -60
  50. package/dist/apis/anilist/interfaces/responses/query/Thread.js +0 -44
  51. package/dist/apis/anilist/interfaces/responses/query/ThreadComment.js +0 -31
  52. package/dist/apis/anilist/interfaces/responses/query/User.js +0 -366
  53. package/dist/apis/anilist/mutation/DeleteActivity.js +0 -61
  54. package/dist/apis/anilist/mutation/DeleteActivityReply.js +0 -61
  55. package/dist/apis/anilist/mutation/DeleteCustomList.js +0 -63
  56. package/dist/apis/anilist/mutation/DeleteMediaListEntry.js +0 -61
  57. package/dist/apis/anilist/mutation/DeleteReview.js +0 -61
  58. package/dist/apis/anilist/mutation/DeleteThread.js +0 -61
  59. package/dist/apis/anilist/mutation/DeleteThreadComment.js +0 -61
  60. package/dist/apis/anilist/mutation/SaveActivityReply.js +0 -66
  61. package/dist/apis/anilist/mutation/SaveListActivity.js +0 -64
  62. package/dist/apis/anilist/mutation/SaveMediaListEntry.js +0 -97
  63. package/dist/apis/anilist/mutation/SaveMessageActivity.js +0 -68
  64. package/dist/apis/anilist/mutation/SaveRecommendation.js +0 -66
  65. package/dist/apis/anilist/mutation/SaveReview.js +0 -68
  66. package/dist/apis/anilist/mutation/SaveTextActivity.js +0 -65
  67. package/dist/apis/anilist/mutation/SaveThread.js +0 -69
  68. package/dist/apis/anilist/mutation/SaveThreadComment.js +0 -67
  69. package/dist/apis/anilist/mutation/ToggleActivityPin.js +0 -64
  70. package/dist/apis/anilist/mutation/ToggleActivitySubscription.js +0 -64
  71. package/dist/apis/anilist/mutation/ToggleFavourite.js +0 -66
  72. package/dist/apis/anilist/mutation/ToggleFollow.js +0 -62
  73. package/dist/apis/anilist/mutation/ToggleLike.js +0 -64
  74. package/dist/apis/anilist/mutation/ToggleLikeV2.js +0 -64
  75. package/dist/apis/anilist/mutation/ToggleThreadSubscription.js +0 -64
  76. package/dist/apis/anilist/mutation/UpdateAniChartHighlights.js +0 -58
  77. package/dist/apis/anilist/mutation/UpdateAniChartSettings.js +0 -58
  78. package/dist/apis/anilist/mutation/UpdateFavouriteOrder.js +0 -73
  79. package/dist/apis/anilist/mutation/UpdateMediaListEntries.js +0 -93
  80. package/dist/apis/anilist/mutation/UpdateUser.js +0 -127
  81. package/dist/apis/anilist/query/Activity.js +0 -86
  82. package/dist/apis/anilist/query/ActivityReply.js +0 -60
  83. package/dist/apis/anilist/query/AiringSchedule.js +0 -78
  84. package/dist/apis/anilist/query/AniChartUser.js +0 -56
  85. package/dist/apis/anilist/query/Character.js +0 -70
  86. package/dist/apis/anilist/query/ExternalLinkSourceCollection.js +0 -68
  87. package/dist/apis/anilist/query/Follower.js +0 -64
  88. package/dist/apis/anilist/query/Following.js +0 -64
  89. package/dist/apis/anilist/query/GenreCollection.js +0 -46
  90. package/dist/apis/anilist/query/Markdown.js +0 -57
  91. package/dist/apis/anilist/query/Media.js +0 -134
  92. package/dist/apis/anilist/query/MediaList.js +0 -90
  93. package/dist/apis/anilist/query/MediaListCollection.js +0 -76
  94. package/dist/apis/anilist/query/MediaTagCollection.js +0 -57
  95. package/dist/apis/anilist/query/MediaTrend.js +0 -84
  96. package/dist/apis/anilist/query/Notification.js +0 -65
  97. package/dist/apis/anilist/query/Recommendation.js +0 -68
  98. package/dist/apis/anilist/query/Review.js +0 -64
  99. package/dist/apis/anilist/query/SiteStatistics.js +0 -78
  100. package/dist/apis/anilist/query/Staff.js +0 -79
  101. package/dist/apis/anilist/query/Studio.js +0 -82
  102. package/dist/apis/anilist/query/Thread.js +0 -68
  103. package/dist/apis/anilist/query/ThreadComment.js +0 -63
  104. package/dist/apis/anilist/query/User.js +0 -68
  105. package/dist/apis/anilist/query/Viewer.js +0 -65
  106. package/dist/apis/anilist/query/page/Activities.js +0 -97
  107. package/dist/apis/anilist/query/page/ActivityReplies.js +0 -71
  108. package/dist/apis/anilist/query/page/AiringSchedules.js +0 -89
  109. package/dist/apis/anilist/query/page/Characters.js +0 -81
  110. package/dist/apis/anilist/query/page/Followers.js +0 -75
  111. package/dist/apis/anilist/query/page/Followings.js +0 -75
  112. package/dist/apis/anilist/query/page/Likes.js +0 -71
  113. package/dist/apis/anilist/query/page/MediaLists.js +0 -101
  114. package/dist/apis/anilist/query/page/MediaTrends.js +0 -95
  115. package/dist/apis/anilist/query/page/Medias.js +0 -143
  116. package/dist/apis/anilist/query/page/Notifications.js +0 -73
  117. package/dist/apis/anilist/query/page/Recommendations.js +0 -79
  118. package/dist/apis/anilist/query/page/Reviews.js +0 -75
  119. package/dist/apis/anilist/query/page/Staffs.js +0 -90
  120. package/dist/apis/anilist/query/page/Studios.js +0 -93
  121. package/dist/apis/anilist/query/page/ThreadCommments.js +0 -74
  122. package/dist/apis/anilist/query/page/Threads.js +0 -79
  123. package/dist/apis/anilist/query/page/Users.js +0 -79
  124. package/dist/apis/anilist/types/ActivityType.js +0 -14
  125. package/dist/apis/anilist/types/DisabledListActivity.js +0 -11
  126. package/dist/apis/anilist/types/Format.js +0 -30
  127. package/dist/apis/anilist/types/FuzzyDate.js +0 -12
  128. package/dist/apis/anilist/types/MediaListOptions.js +0 -16
  129. package/dist/apis/anilist/types/NotificationOptions.js +0 -29
  130. package/dist/apis/anilist/types/RecommendationRating.js +0 -12
  131. package/dist/apis/anilist/types/Season.js +0 -13
  132. package/dist/apis/anilist/types/Sort.js +0 -265
  133. package/dist/apis/anilist/types/Source.js +0 -25
  134. package/dist/apis/anilist/types/Status.js +0 -26
  135. package/dist/apis/anilist/types/Type.js +0 -44
  136. package/dist/apis/anilist/types/UserStaffNameLanguage.js +0 -15
  137. package/dist/apis/anilist/types/UserTitleLanguage.js +0 -15
  138. package/dist/base/APIWrapper.js +0 -17
  139. package/dist/base/RequestHandler.js +0 -48
  140. package/dist/base/ValidateVariables.js +0 -125
@@ -1,58 +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.UpdateAniChartSettingsMutation = void 0;
13
- const RequestHandler_1 = require("../../../base/RequestHandler");
14
- const ValidateVariables_1 = require("../../../base/ValidateVariables");
15
- const APIWrapper_1 = require("../../../base/APIWrapper");
16
- /**
17
- * `UpdateAniChartSettingsMutation` is a class that represents a mutation to update the AniChart settings.
18
- */
19
- class UpdateAniChartSettingsMutation extends APIWrapper_1.APIWrapper {
20
- /**
21
- * Constructs a new `UpdateAniChartSettingsMutation` instance.
22
- *
23
- * @param authToken - The authentication token.
24
- */
25
- constructor(authToken) {
26
- super('https://graphql.anilist.co');
27
- this.authToken = authToken;
28
- }
29
- /**
30
- * `updateAniChartSettings` is a method that sends a mutation request to update the AniChart settings.
31
- *
32
- * @param variables - An object of type `UpdateAniChartSettingsVariables` representing the variables for the mutation.
33
- * @returns A Promise that resolves to the response from the mutation request.
34
- * @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
35
- */
36
- updateAniChartSettings(variables) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- if (!this.authToken) {
39
- throw new Error('UpdateAniChartSettingsMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
40
- }
41
- const variableTypeMappings = {
42
- titleLanguage: 'string',
43
- outgoingLinkProvider: 'string',
44
- theme: 'string',
45
- sort: 'string'
46
- };
47
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
48
- const mutation = `
49
- mutation ($titleLanguage: String, $outgoingLinkProvider: String, $theme: String, $sort: String) {
50
- UpdateAniChartSettings (titleLanguage: $titleLanguage, outgoingLinkProvider: $outgoingLinkProvider, theme: $theme, sort: $sort)
51
- }
52
- `;
53
- const data = { query: mutation, variables };
54
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
55
- });
56
- }
57
- }
58
- exports.UpdateAniChartSettingsMutation = UpdateAniChartSettingsMutation;
@@ -1,73 +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.UpdateFavouriteOrderMutation = void 0;
13
- /**
14
- * `UpdateFavouriteOrderVariables` is an interface that contains the variables that are required to update the order of the favourite anime/manga.
15
- */
16
- const RequestHandler_1 = require("../../../base/RequestHandler");
17
- const APIWrapper_1 = require("../../../base/APIWrapper");
18
- const Favourites_1 = require("../interfaces/responses/mutation/Favourites");
19
- const ValidateVariables_1 = require("../../../base/ValidateVariables");
20
- /**
21
- * `UpdateFavouriteOrderMutation` is a class that contains the method to update the order of the favourites.
22
- * It includes a method to update the order of the favourites.
23
- */
24
- class UpdateFavouriteOrderMutation extends APIWrapper_1.APIWrapper {
25
- /**
26
- * Constructs a new `UpdateFavouriteOrderMutation` instance.
27
- *
28
- * @param authToken - The authentication token.
29
- */
30
- constructor(authToken) {
31
- super('https://graphql.anilist.co');
32
- this.authToken = authToken;
33
- }
34
- /**
35
- * `updateFavouriteOrder` is a method that sends a mutation request to update the order of the favourites.
36
- *
37
- * @param variables - An object of type `UpdateFavouriteOrderVariables` representing the variables for the mutation.
38
- * @returns A Promise that resolves to the response from the mutation request.
39
- */
40
- updateFavouriteOrder(variables) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- if (!this.authToken) {
43
- throw new Error('ToggleFavouriteMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
44
- }
45
- if ((!variables.animeIds && variables.animeOrder) || (!variables.mangaIds && variables.mangaOrder) || (!variables.characterIds && variables.characterOrder) || (!variables.staffIds && variables.staffOrder) || (!variables.studioIds && variables.studioOrder)) {
46
- throw new Error('The order array requires the corresponding id array to be present.');
47
- }
48
- const variableTypeMappings = {
49
- animeIds: 'number[]',
50
- mangaIds: 'number[]',
51
- characterIds: 'number[]',
52
- staffIds: 'number[]',
53
- studioIds: 'number[]',
54
- animeOrder: 'number[]',
55
- mangaOrder: 'number[]',
56
- characterOrder: 'number[]',
57
- staffOrder: 'number[]',
58
- studioOrder: 'number[]'
59
- };
60
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
61
- const mutation = `
62
- mutation ($animeIds: [Int], $mangaIds: [Int], $characterIds: [Int], $staffIds: [Int], $studioIds: [Int], $animeOrder: [Int], $mangaOrder: [Int], $characterOrder: [Int], $staffOrder: [Int], $studioOrder: [Int]) {
63
- UpdateFavouriteOrder (animeIds: $animeIds, mangaIds: $mangaIds, characterIds: $characterIds, staffIds: $staffIds, studioIds: $studioIds, animeOrder: $animeOrder, mangaOrder: $mangaOrder, characterOrder: $characterOrder, staffOrder: $staffOrder, studioOrder: $studioOrder) {
64
- ${Favourites_1.FavouritesSchema}
65
- }
66
- }
67
- `;
68
- const data = { query: mutation, variables };
69
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
70
- });
71
- }
72
- }
73
- exports.UpdateFavouriteOrderMutation = UpdateFavouriteOrderMutation;
@@ -1,93 +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.UpdateMediaListEntriesMutation = void 0;
13
- const APIWrapper_1 = require("../../../base/APIWrapper");
14
- const RequestHandler_1 = require("../../../base/RequestHandler");
15
- const FuzzyDate_1 = require("../interfaces/FuzzyDate");
16
- const ValidateVariables_1 = require("../../../base/ValidateVariables");
17
- const FuzzyDate_2 = require("../types/FuzzyDate");
18
- const Status_1 = require("../types/Status");
19
- /**
20
- * `UpdateMediaListEntriesMutation` is a class representing a mutation to update media list entries.
21
- * It includes a method to update media list entries.
22
- */
23
- class UpdateMediaListEntriesMutation extends APIWrapper_1.APIWrapper {
24
- /**
25
- * Constructs a new `UpdateMediaListEntriesMutation` 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
- * `updateMediaListEntries` is a method that sends a mutation request to update media list entries.
35
- *
36
- * @param variables - An object of type `UpdateMediaListEntriesVariables` representing the variables for the mutation.
37
- * @returns A Promise that resolves to the response from the mutation request.
38
- * @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
39
- * */
40
- updateMediaListEntries(variables) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- if (!this.authToken) {
43
- throw new Error('UpdateMediaListEntriesMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
44
- }
45
- if (!variables.ids || variables.ids.length === 0) {
46
- throw new Error('ids must be an array of at least one number');
47
- }
48
- const variableTypeMappings = {
49
- status: Status_1.MediaListStatusMappings,
50
- score: 'number',
51
- scoreRaw: 'number',
52
- progress: 'number',
53
- progressVolumes: 'number',
54
- repeat: 'number',
55
- priority: 'number',
56
- private: 'boolean',
57
- notes: 'string',
58
- hiddenFromStatusLists: 'boolean',
59
- advancedScores: 'number[]',
60
- startedAt: FuzzyDate_2.FuzzyDateMappings,
61
- completedAt: FuzzyDate_2.FuzzyDateMappings,
62
- ids: 'number[]'
63
- };
64
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
65
- const mutation = `
66
- mutation ($status: MediaListStatus, $score: Float, $scoreRaw: Int, $progress: Int, $progressVolumes: Int, $repeat: Int, $priority: Int, $private: Boolean, $notes: String, $hiddenFromStatusLists: Boolean, $advancedScores: [Float], $startedAt: FuzzyDateInput, $completedAt: FuzzyDateInput, $ids: [Int]) {
67
- UpdateMediaListEntries(status: $status, score: $score, scoreRaw: $scoreRaw, progress: $progress, progressVolumes: $progressVolumes, repeat: $repeat, priority: $priority, private: $private, notes: $notes, hiddenFromStatusLists: $hiddenFromStatusLists, advancedScores: $advancedScores, startedAt: $startedAt, completedAt: $completedAt, ids: $ids) {
68
- id
69
- status
70
- score
71
- progress
72
- progressVolumes
73
- repeat
74
- priority
75
- private
76
- notes
77
- hiddenFromStatusLists
78
- advancedScores
79
- startedAt {
80
- ${FuzzyDate_1.FuzzyDateSchema}
81
- }
82
- completedAt {
83
- ${FuzzyDate_1.FuzzyDateSchema}
84
- }
85
- }
86
- }
87
- `;
88
- const data = { query: mutation, variables };
89
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
90
- });
91
- }
92
- }
93
- exports.UpdateMediaListEntriesMutation = UpdateMediaListEntriesMutation;
@@ -1,127 +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.UpdateUserMutation = void 0;
13
- const APIWrapper_1 = require("../../../base/APIWrapper");
14
- const RequestHandler_1 = require("../../../base/RequestHandler");
15
- const UserStaffNameLanguage_1 = require("../types/UserStaffNameLanguage");
16
- const UserTitleLanguage_1 = require("../types/UserTitleLanguage");
17
- const ValidateVariables_1 = require("../../../base/ValidateVariables");
18
- const NotificationOptions_1 = require("../types/NotificationOptions");
19
- const MediaListOptions_1 = require("../types/MediaListOptions");
20
- const DisabledListActivity_1 = require("../types/DisabledListActivity");
21
- const Format_1 = require("../types/Format");
22
- /**
23
- * `UpdateUserMutation` is a class representing a mutation to update a user.
24
- * It includes a method to update a user.
25
- */
26
- class UpdateUserMutation extends APIWrapper_1.APIWrapper {
27
- /**
28
- * Constructs a new `UpdateUserMutation` instance.
29
- *
30
- * @param authToken - The authentication token.
31
- */
32
- constructor(authToken) {
33
- super('https://graphql.anilist.co');
34
- this.authToken = authToken;
35
- }
36
- /**
37
- * `updateUser` is a method that sends a mutation request to update a user.
38
- *
39
- * @param variables - An object of type `UpdateUserVariables` representing the variables for the mutation.
40
- * @returns A Promise that resolves to an object of type `UpdateUserResponse`. This object includes the updated user details
41
- * @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
42
- */
43
- updateUser(variables) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- if (!this.authToken) {
46
- throw new Error('UpdateUserMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
47
- }
48
- const variableTypeMappings = {
49
- about: 'string',
50
- titleLanguage: UserTitleLanguage_1.UserTitleLanguageMapping,
51
- displayAdultContent: 'boolean',
52
- airingNotifications: 'boolean',
53
- scoreFormat: Format_1.ScoreFormatMapping,
54
- rowOrder: 'string',
55
- profileColor: 'string',
56
- donatorBadge: 'string',
57
- notificationOptions: NotificationOptions_1.NotificationOptionsMapping,
58
- timezone: 'string',
59
- activityMergeTime: 'number',
60
- animeListOptions: MediaListOptions_1.MediaListOptionsMapping,
61
- mangaListOptions: MediaListOptions_1.MediaListOptionsMapping,
62
- staffNameLanguage: UserStaffNameLanguage_1.UserStaffNameLanguageMapping,
63
- restrictMessagesToFollowing: 'boolean',
64
- disabledListActivity: DisabledListActivity_1.DisabledListActivityMapping
65
- };
66
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
67
- const mutation = `
68
- mutation ($about: String, $titleLanguage: UserTitleLanguage, $displayAdultContent: Boolean, $airingNotifications: Boolean, $scoreFormat: ScoreFormat, $rowOrder: String, $profileColor: String, $donatorBadge: String, $notificationOptions: [NotificationOptionInput], $timezone: String, $activityMergeTime: Int, $animeListOptions: MediaListOptionsInput, $mangaListOptions: MediaListOptionsInput, $staffNameLanguage: UserStaffNameLanguage, $restrictMessagesToFollowing: Boolean, $disabledListActivity: [ListActivityOptionInput]) {
69
- UpdateUser(about: $about, titleLanguage: $titleLanguage, displayAdultContent: $displayAdultContent, airingNotifications: $airingNotifications, scoreFormat: $scoreFormat, rowOrder: $rowOrder, profileColor: $profileColor, donatorBadge: $donatorBadge, notificationOptions: $notificationOptions, timezone: $timezone, activityMergeTime: $activityMergeTime, animeListOptions: $animeListOptions, mangaListOptions: $mangaListOptions, staffNameLanguage: $staffNameLanguage, restrictMessagesToFollowing: $restrictMessagesToFollowing, disabledListActivity: $disabledListActivity) {
70
- id
71
- name
72
- about
73
- avatar {
74
- large
75
- medium
76
- }
77
- bannerImage
78
- isFollowing
79
- isFollower
80
- isBlocked
81
- bans
82
- options {
83
- titleLanguage
84
- displayAdultContent
85
- airingNotifications
86
- profileColor
87
- notificationOptions {
88
- type
89
- enabled
90
- }
91
- timezone
92
- activityMergeTime
93
- staffNameLanguage
94
- restrictMessagesToFollowing
95
- }
96
- mediaListOptions {
97
- scoreFormat
98
- rowOrder
99
- animeList {
100
- sectionOrder
101
- customLists
102
- advancedScoring
103
- advancedScoringEnabled
104
- }
105
- mangaList {
106
- sectionOrder
107
- customLists
108
- advancedScoring
109
- advancedScoringEnabled
110
- }
111
- }
112
- unreadNotificationCount
113
- siteUrl
114
- donatorTier
115
- donatorBadge
116
- moderatorRoles
117
- createdAt
118
- updatedAt
119
- }
120
- }
121
- `;
122
- const data = { query: mutation, variables };
123
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
124
- });
125
- }
126
- }
127
- exports.UpdateUserMutation = UpdateUserMutation;
@@ -1,86 +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.ActivityQuery = 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 ValidateVariables_1 = require("../../../base/ValidateVariables");
17
- const Sort_1 = require("../types/Sort");
18
- const ActivityType_1 = require("../types/ActivityType");
19
- /**
20
- * `ActivityQuery` is a class representing a query for activities.
21
- * It includes a method to get activities.
22
- */
23
- class ActivityQuery extends APIWrapper_1.APIWrapper {
24
- /**
25
- * Constructs a new `ActivityQuery` 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
- * `activity` 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
- activity(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
- id: 'number',
46
- userId: 'number',
47
- messengerId: 'number',
48
- mediaId: 'number',
49
- type: ActivityType_1.ActivityTypeMappings,
50
- isFollowing: 'boolean',
51
- hasReplies: 'boolean',
52
- hasRepliesOrTypeText: 'boolean',
53
- createdAt: 'number',
54
- id_not: 'number',
55
- id_in: 'number[]',
56
- id_not_in: 'number[]',
57
- userId_not: 'number',
58
- userId_in: 'number[]',
59
- userId_not_in: 'number[]',
60
- messengerId_not: 'number',
61
- messengerId_in: 'number[]',
62
- messengerId_not_in: 'number[]',
63
- mediaId_not: 'number',
64
- mediaId_in: 'number[]',
65
- mediaId_not_in: 'number[]',
66
- type_not: ActivityType_1.ActivityTypeMappings,
67
- type_in: ActivityType_1.ActivityTypeMappings,
68
- type_not_in: ActivityType_1.ActivityTypeMappings,
69
- createdAt_greater: 'number',
70
- sort: Sort_1.ActivitySortMappings,
71
- asHtml: 'boolean'
72
- };
73
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
74
- const query = `
75
- query ($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) {
76
- Activity (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) {
77
- ${Activity_1.ActivityWithRepliesSchema}
78
- }
79
- }
80
- `;
81
- const data = { query, variables };
82
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
83
- });
84
- }
85
- }
86
- exports.ActivityQuery = ActivityQuery;
@@ -1,60 +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.ActivityReplyQuery = 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
- * `ActivityReplyQuery` is a class representing a query for activity replies.
19
- * It includes a method to get activity replies.
20
- */
21
- class ActivityReplyQuery extends APIWrapper_1.APIWrapper {
22
- /**
23
- * Constructs a new `ActivityReplyQuery` 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
- * `activityReply` 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
- activityReply(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
- id: 'number',
44
- activityId: 'number',
45
- asHtml: 'boolean'
46
- };
47
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
48
- const query = `
49
- query ($id: Int, $activityId: Int, $asHtml: Boolean) {
50
- ActivityReply (id: $id, activityId: $activityId) {
51
- ${Activity_1.ActivityReplySchema}
52
- }
53
- }
54
- `;
55
- const data = { query, variables };
56
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
57
- });
58
- }
59
- }
60
- exports.ActivityReplyQuery = ActivityReplyQuery;
@@ -1,78 +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.AiringScheduleQuery = 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
- * `AiringScheduleQuery` is a class representing a query for airing schedules.
20
- * It includes a method to get airing schedules.
21
- */
22
- class AiringScheduleQuery extends APIWrapper_1.APIWrapper {
23
- /**
24
- * Constructs a new `AiringScheduleQuery` 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
- * `airingSchedule` 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
- airingSchedule(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
- id: 'number',
45
- mediaId: 'number',
46
- episode: 'number',
47
- airingAt: 'number',
48
- notYetAired: 'boolean',
49
- id_not: 'number',
50
- id_in: 'number[]',
51
- id_not_in: 'number[]',
52
- mediaId_not: 'number',
53
- mediaId_in: 'number[]',
54
- mediaId_not_in: 'number[]',
55
- episode_not: 'number',
56
- episode_in: 'number[]',
57
- episode_not_in: 'number[]',
58
- episode_greater: 'number',
59
- episode_lesser: 'number',
60
- airingAt_greater: 'number',
61
- airingAt_lesser: 'number',
62
- sort: Sort_1.AiringSortMappings,
63
- asHtml: 'boolean'
64
- };
65
- (0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
66
- const query = `
67
- query ($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) {
68
- AiringSchedule (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) {
69
- ${AiringSchedule_1.AiringScheduleSchema}
70
- }
71
- }
72
- `;
73
- const data = { query, variables };
74
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
75
- });
76
- }
77
- }
78
- exports.AiringScheduleQuery = AiringScheduleQuery;
@@ -1,56 +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.AniChartUserQuery = void 0;
13
- const APIWrapper_1 = require("../../../base/APIWrapper");
14
- const RequestHandler_1 = require("../../../base/RequestHandler");
15
- const Basic_1 = require("../interfaces/Basic");
16
- /**
17
- * `AniChartUserQuery` is a class representing a query for AniChart users.
18
- * It includes a method to get AniChart users.
19
- */
20
- class AniChartUserQuery extends APIWrapper_1.APIWrapper {
21
- /**
22
- * Constructs a new `AniChartUserQuery` instance.
23
- *
24
- * @param authToken - The authentication token.
25
- */
26
- constructor(authToken) {
27
- super('https://graphql.anilist.co');
28
- this.authToken = authToken;
29
- }
30
- /**
31
- * `aniChartUser` is a method that sends a query request to get AniChart users.
32
- *
33
- * @returns The response from the query request.
34
- */
35
- aniChartUser() {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- if (!this.authToken) {
38
- throw new Error('AniChartUserQuery requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
39
- }
40
- const query = `
41
- query {
42
- AniChartUser {
43
- user {
44
- ${Basic_1.BasicUserSchema}
45
- }
46
- settings
47
- highlights
48
- }
49
- }
50
- `;
51
- const data = { query };
52
- return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
53
- });
54
- }
55
- }
56
- exports.AniChartUserQuery = AniChartUserQuery;