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.
- package/LICENSE +21 -21
- package/README.md +523 -241
- package/dist/AniLink.d.ts +11397 -0
- package/dist/AniLink.mjs +6664 -0
- package/dist/anilist.d.ts +1 -0
- package/dist/anilist.mjs +5 -0
- package/package.json +111 -46
- package/dist/AniLink.js +0 -248
- package/dist/apis/anilist/Custom.js +0 -42
- package/dist/apis/anilist/interfaces/Activity.js +0 -436
- package/dist/apis/anilist/interfaces/Basic.js +0 -33
- package/dist/apis/anilist/interfaces/CoverImage.js +0 -15
- package/dist/apis/anilist/interfaces/Distribution.js +0 -23
- package/dist/apis/anilist/interfaces/ExternalLink.js +0 -14
- package/dist/apis/anilist/interfaces/Favoured.js +0 -2
- package/dist/apis/anilist/interfaces/FuzzyDate.js +0 -12
- package/dist/apis/anilist/interfaces/Image.js +0 -13
- package/dist/apis/anilist/interfaces/ListScores.js +0 -2
- package/dist/apis/anilist/interfaces/Media.js +0 -13
- package/dist/apis/anilist/interfaces/Name.js +0 -15
- package/dist/apis/anilist/interfaces/NextAiringEpisode.js +0 -14
- package/dist/apis/anilist/interfaces/Notification.js +0 -25
- package/dist/apis/anilist/interfaces/Ranking.js +0 -19
- package/dist/apis/anilist/interfaces/SiteTrend.js +0 -33
- package/dist/apis/anilist/interfaces/Staff.js +0 -2
- package/dist/apis/anilist/interfaces/Stat.js +0 -2
- package/dist/apis/anilist/interfaces/Statistics.js +0 -2
- package/dist/apis/anilist/interfaces/StreamingEpisode.js +0 -15
- package/dist/apis/anilist/interfaces/Studio.js +0 -2
- package/dist/apis/anilist/interfaces/Tag.js +0 -18
- package/dist/apis/anilist/interfaces/Title.js +0 -15
- package/dist/apis/anilist/interfaces/Trailer.js +0 -14
- package/dist/apis/anilist/interfaces/UserStats.js +0 -23
- package/dist/apis/anilist/interfaces/responses/mutation/Favourites.js +0 -83
- package/dist/apis/anilist/interfaces/responses/query/AiringSchedule.js +0 -18
- package/dist/apis/anilist/interfaces/responses/query/AniChartUser.js +0 -2
- package/dist/apis/anilist/interfaces/responses/query/Character.js +0 -34
- package/dist/apis/anilist/interfaces/responses/query/ExternalLinkSourceCollection.js +0 -2
- package/dist/apis/anilist/interfaces/responses/query/Media.js +0 -217
- package/dist/apis/anilist/interfaces/responses/query/MediaList.js +0 -36
- package/dist/apis/anilist/interfaces/responses/query/MediaListCollectionResponse.js +0 -49
- package/dist/apis/anilist/interfaces/responses/query/MediaTagCollection.js +0 -2
- package/dist/apis/anilist/interfaces/responses/query/MediaTrend.js +0 -21
- package/dist/apis/anilist/interfaces/responses/query/Notification.js +0 -166
- package/dist/apis/anilist/interfaces/responses/query/Recommendation.js +0 -23
- package/dist/apis/anilist/interfaces/responses/query/Review.js +0 -30
- package/dist/apis/anilist/interfaces/responses/query/SiteStatistics.js +0 -31
- package/dist/apis/anilist/interfaces/responses/query/Staff.js +0 -59
- package/dist/apis/anilist/interfaces/responses/query/Studio.js +0 -60
- package/dist/apis/anilist/interfaces/responses/query/Thread.js +0 -44
- package/dist/apis/anilist/interfaces/responses/query/ThreadComment.js +0 -31
- package/dist/apis/anilist/interfaces/responses/query/User.js +0 -366
- package/dist/apis/anilist/mutation/DeleteActivity.js +0 -61
- package/dist/apis/anilist/mutation/DeleteActivityReply.js +0 -61
- package/dist/apis/anilist/mutation/DeleteCustomList.js +0 -63
- package/dist/apis/anilist/mutation/DeleteMediaListEntry.js +0 -61
- package/dist/apis/anilist/mutation/DeleteReview.js +0 -61
- package/dist/apis/anilist/mutation/DeleteThread.js +0 -61
- package/dist/apis/anilist/mutation/DeleteThreadComment.js +0 -61
- package/dist/apis/anilist/mutation/SaveActivityReply.js +0 -66
- package/dist/apis/anilist/mutation/SaveListActivity.js +0 -64
- package/dist/apis/anilist/mutation/SaveMediaListEntry.js +0 -97
- package/dist/apis/anilist/mutation/SaveMessageActivity.js +0 -68
- package/dist/apis/anilist/mutation/SaveRecommendation.js +0 -66
- package/dist/apis/anilist/mutation/SaveReview.js +0 -68
- package/dist/apis/anilist/mutation/SaveTextActivity.js +0 -65
- package/dist/apis/anilist/mutation/SaveThread.js +0 -69
- package/dist/apis/anilist/mutation/SaveThreadComment.js +0 -67
- package/dist/apis/anilist/mutation/ToggleActivityPin.js +0 -64
- package/dist/apis/anilist/mutation/ToggleActivitySubscription.js +0 -64
- package/dist/apis/anilist/mutation/ToggleFavourite.js +0 -66
- package/dist/apis/anilist/mutation/ToggleFollow.js +0 -62
- package/dist/apis/anilist/mutation/ToggleLike.js +0 -64
- package/dist/apis/anilist/mutation/ToggleLikeV2.js +0 -64
- package/dist/apis/anilist/mutation/ToggleThreadSubscription.js +0 -64
- package/dist/apis/anilist/mutation/UpdateAniChartHighlights.js +0 -58
- package/dist/apis/anilist/mutation/UpdateAniChartSettings.js +0 -58
- package/dist/apis/anilist/mutation/UpdateFavouriteOrder.js +0 -73
- package/dist/apis/anilist/mutation/UpdateMediaListEntries.js +0 -93
- package/dist/apis/anilist/mutation/UpdateUser.js +0 -127
- package/dist/apis/anilist/query/Activity.js +0 -86
- package/dist/apis/anilist/query/ActivityReply.js +0 -60
- package/dist/apis/anilist/query/AiringSchedule.js +0 -78
- package/dist/apis/anilist/query/AniChartUser.js +0 -56
- package/dist/apis/anilist/query/Character.js +0 -70
- package/dist/apis/anilist/query/ExternalLinkSourceCollection.js +0 -68
- package/dist/apis/anilist/query/Follower.js +0 -64
- package/dist/apis/anilist/query/Following.js +0 -64
- package/dist/apis/anilist/query/GenreCollection.js +0 -46
- package/dist/apis/anilist/query/Markdown.js +0 -57
- package/dist/apis/anilist/query/Media.js +0 -134
- package/dist/apis/anilist/query/MediaList.js +0 -90
- package/dist/apis/anilist/query/MediaListCollection.js +0 -76
- package/dist/apis/anilist/query/MediaTagCollection.js +0 -57
- package/dist/apis/anilist/query/MediaTrend.js +0 -84
- package/dist/apis/anilist/query/Notification.js +0 -65
- package/dist/apis/anilist/query/Recommendation.js +0 -68
- package/dist/apis/anilist/query/Review.js +0 -64
- package/dist/apis/anilist/query/SiteStatistics.js +0 -78
- package/dist/apis/anilist/query/Staff.js +0 -79
- package/dist/apis/anilist/query/Studio.js +0 -82
- package/dist/apis/anilist/query/Thread.js +0 -68
- package/dist/apis/anilist/query/ThreadComment.js +0 -63
- package/dist/apis/anilist/query/User.js +0 -68
- package/dist/apis/anilist/query/Viewer.js +0 -65
- package/dist/apis/anilist/query/page/Activities.js +0 -97
- package/dist/apis/anilist/query/page/ActivityReplies.js +0 -71
- package/dist/apis/anilist/query/page/AiringSchedules.js +0 -89
- package/dist/apis/anilist/query/page/Characters.js +0 -81
- package/dist/apis/anilist/query/page/Followers.js +0 -75
- package/dist/apis/anilist/query/page/Followings.js +0 -75
- package/dist/apis/anilist/query/page/Likes.js +0 -71
- package/dist/apis/anilist/query/page/MediaLists.js +0 -101
- package/dist/apis/anilist/query/page/MediaTrends.js +0 -95
- package/dist/apis/anilist/query/page/Medias.js +0 -143
- package/dist/apis/anilist/query/page/Notifications.js +0 -73
- package/dist/apis/anilist/query/page/Recommendations.js +0 -79
- package/dist/apis/anilist/query/page/Reviews.js +0 -75
- package/dist/apis/anilist/query/page/Staffs.js +0 -90
- package/dist/apis/anilist/query/page/Studios.js +0 -93
- package/dist/apis/anilist/query/page/ThreadCommments.js +0 -74
- package/dist/apis/anilist/query/page/Threads.js +0 -79
- package/dist/apis/anilist/query/page/Users.js +0 -79
- package/dist/apis/anilist/types/ActivityType.js +0 -14
- package/dist/apis/anilist/types/DisabledListActivity.js +0 -11
- package/dist/apis/anilist/types/Format.js +0 -30
- package/dist/apis/anilist/types/FuzzyDate.js +0 -12
- package/dist/apis/anilist/types/MediaListOptions.js +0 -16
- package/dist/apis/anilist/types/NotificationOptions.js +0 -29
- package/dist/apis/anilist/types/RecommendationRating.js +0 -12
- package/dist/apis/anilist/types/Season.js +0 -13
- package/dist/apis/anilist/types/Sort.js +0 -265
- package/dist/apis/anilist/types/Source.js +0 -25
- package/dist/apis/anilist/types/Status.js +0 -26
- package/dist/apis/anilist/types/Type.js +0 -44
- package/dist/apis/anilist/types/UserStaffNameLanguage.js +0 -15
- package/dist/apis/anilist/types/UserTitleLanguage.js +0 -15
- package/dist/base/APIWrapper.js +0 -17
- package/dist/base/RequestHandler.js +0 -48
- package/dist/base/ValidateVariables.js +0 -125
|
@@ -1,69 +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.SaveThreadMutation = void 0;
|
|
13
|
-
const Thread_1 = require("../interfaces/responses/query/Thread");
|
|
14
|
-
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
15
|
-
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
16
|
-
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
17
|
-
/**
|
|
18
|
-
* `SaveThreadMutation` is a class representing a mutation to save a thread.
|
|
19
|
-
* It includes a method to save a thread
|
|
20
|
-
*/
|
|
21
|
-
class SaveThreadMutation extends APIWrapper_1.APIWrapper {
|
|
22
|
-
/**
|
|
23
|
-
* Constructs a new `SaveThreadMutation` 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
|
-
* `SaveThread` is a method that sends a mutation request to save a thread.
|
|
33
|
-
*
|
|
34
|
-
* @param variables - An object of type `SaveThreadVariables` representing the variables for the mutation.
|
|
35
|
-
* @returns A Promise that resolves to the response from the mutation request.
|
|
36
|
-
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
37
|
-
* */
|
|
38
|
-
saveThread(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!this.authToken) {
|
|
41
|
-
throw new Error('SaveThreadMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
-
}
|
|
43
|
-
if (!variables.id && !variables.title) {
|
|
44
|
-
throw new Error('id or title variable is required');
|
|
45
|
-
}
|
|
46
|
-
const variableTypeMappings = {
|
|
47
|
-
id: 'number',
|
|
48
|
-
title: 'string',
|
|
49
|
-
body: 'string',
|
|
50
|
-
categories: 'number[]',
|
|
51
|
-
mediaCategories: 'number[]',
|
|
52
|
-
sticky: 'boolean',
|
|
53
|
-
locked: 'boolean',
|
|
54
|
-
asHtml: 'boolean'
|
|
55
|
-
};
|
|
56
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
57
|
-
const mutation = `
|
|
58
|
-
mutation ($id: Int, $title: String, $body: String, $categories: [Int], $mediaCategories: [Int], $sticky: Boolean, $locked: Boolean, $asHtml: Boolean) {
|
|
59
|
-
SaveThread (id: $id, title: $title, body: $body, categories: $categories, mediaCategories: $mediaCategories, sticky: $sticky, locked: $locked) {
|
|
60
|
-
${Thread_1.ThreadSchema}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
`;
|
|
64
|
-
const data = { query: mutation, variables };
|
|
65
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.SaveThreadMutation = SaveThreadMutation;
|
|
@@ -1,67 +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.SaveThreadCommentMutation = void 0;
|
|
13
|
-
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
14
|
-
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
15
|
-
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
16
|
-
const ThreadComment_1 = require("../interfaces/responses/query/ThreadComment");
|
|
17
|
-
/**
|
|
18
|
-
* `SaveThreadCommentMutation` is a class representing a mutation to save a thread comment.
|
|
19
|
-
* It includes a method to save a thread
|
|
20
|
-
*/
|
|
21
|
-
class SaveThreadCommentMutation extends APIWrapper_1.APIWrapper {
|
|
22
|
-
/**
|
|
23
|
-
* Constructs a new `SaveThreadCommentMutation` 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
|
-
* `saveThreadComment` is a method that sends a mutation request to save a thread comment.
|
|
33
|
-
*
|
|
34
|
-
* @param variables - An object of type `SaveThreadCommentVariables` representing the variables for the mutation.
|
|
35
|
-
* @returns A Promise that resolves to the response from the mutation request.
|
|
36
|
-
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
37
|
-
* */
|
|
38
|
-
saveThreadComment(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!this.authToken) {
|
|
41
|
-
throw new Error('SaveThreadCommentMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
-
}
|
|
43
|
-
if (!variables.id && !variables.threadId) {
|
|
44
|
-
throw new Error('id or title variable is required');
|
|
45
|
-
}
|
|
46
|
-
const variableTypeMappings = {
|
|
47
|
-
id: 'number',
|
|
48
|
-
threadId: 'number',
|
|
49
|
-
parentCommentId: 'number',
|
|
50
|
-
comment: 'string',
|
|
51
|
-
locked: 'boolean',
|
|
52
|
-
asHtml: 'boolean'
|
|
53
|
-
};
|
|
54
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
55
|
-
const mutation = `
|
|
56
|
-
mutation ($id: Int, $threadId: Int, $parentCommentId: Int, $comment: String, $locked: Boolean, $asHtml: Boolean) {
|
|
57
|
-
SaveThreadComment (id: $id, threadId: $threadId, parentCommentId: $parentCommentId, comment: $comment, locked: $locked) {
|
|
58
|
-
${ThreadComment_1.ThreadCommentSchema}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
`;
|
|
62
|
-
const data = { query: mutation, variables };
|
|
63
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.SaveThreadCommentMutation = SaveThreadCommentMutation;
|
|
@@ -1,64 +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.ToggleActivityPinMutation = 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
|
-
* `ToggleActivityPinMutation` is a class representing a mutation to pin an activity.
|
|
19
|
-
* It includes a method to pin an activity
|
|
20
|
-
*/
|
|
21
|
-
class ToggleActivityPinMutation extends APIWrapper_1.APIWrapper {
|
|
22
|
-
/**
|
|
23
|
-
* Constructs a new `ToggleActivityPinMutation` 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
|
-
* `toggleActivityPin` is a method that sends a mutation request to pin an activity.
|
|
33
|
-
*
|
|
34
|
-
* @param variables - An object of type `ToggleActivityPinVariables` representing the variables for the mutation.
|
|
35
|
-
* @returns A Promise that resolves to the response from the mutation request.
|
|
36
|
-
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
37
|
-
* */
|
|
38
|
-
toggleActivityPin(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!this.authToken) {
|
|
41
|
-
throw new Error('ToggleActivityPinMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
-
}
|
|
43
|
-
if (!variables.id || !variables.pinned) {
|
|
44
|
-
throw new Error('id & pinned variables are required');
|
|
45
|
-
}
|
|
46
|
-
const variableTypeMappings = {
|
|
47
|
-
id: 'number',
|
|
48
|
-
pinned: 'boolean',
|
|
49
|
-
asHtml: 'boolean'
|
|
50
|
-
};
|
|
51
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
52
|
-
const mutation = `
|
|
53
|
-
mutation ($id: Int, $pinned: Boolean, $asHtml: Boolean) {
|
|
54
|
-
ToggleActivityPin(id: $id, pinned: $pinned) {
|
|
55
|
-
${Activity_1.ActivityWithRepliesSchema}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
const data = { query: mutation, variables };
|
|
60
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.ToggleActivityPinMutation = ToggleActivityPinMutation;
|
|
@@ -1,64 +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.ToggleActivitySubscriptionMutation = 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
|
-
* `ToggleActivitySubscriptionMutation` is a class representing a mutation to subscribe to an activity.
|
|
19
|
-
* It includes a method to subscribe to an activity
|
|
20
|
-
*/
|
|
21
|
-
class ToggleActivitySubscriptionMutation extends APIWrapper_1.APIWrapper {
|
|
22
|
-
/**
|
|
23
|
-
* Constructs a new `ToggleActivitySubscriptionMutation` 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
|
-
* `toggleActivitySubscription` is a method that sends a mutation request to subscribe to an activity.
|
|
33
|
-
*
|
|
34
|
-
* @param variables - An object of type `ToggleActivitySubscriptionVariables` representing the variables for the mutation.
|
|
35
|
-
* @returns A Promise that resolves to the response from the mutation request.
|
|
36
|
-
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
37
|
-
* */
|
|
38
|
-
toggleActivitySubscription(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!this.authToken) {
|
|
41
|
-
throw new Error('ToggleActivitySubscriptionMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
-
}
|
|
43
|
-
if (!variables.activityId || !variables.subscribe) {
|
|
44
|
-
throw new Error('activityId & subscribe variables are required');
|
|
45
|
-
}
|
|
46
|
-
const variableTypeMappings = {
|
|
47
|
-
activityId: 'number',
|
|
48
|
-
subscribe: 'boolean',
|
|
49
|
-
asHtml: 'boolean'
|
|
50
|
-
};
|
|
51
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
52
|
-
const mutation = `
|
|
53
|
-
mutation ($activityId: Int, $subscribe: Boolean, $asHtml: Boolean) {
|
|
54
|
-
ToggleActivitySubscription(activityId: $activityId, subscribe: $subscribe) {
|
|
55
|
-
${Activity_1.ActivityWithRepliesSchema}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
const data = { query: mutation, variables };
|
|
60
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.ToggleActivitySubscriptionMutation = ToggleActivitySubscriptionMutation;
|
|
@@ -1,66 +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.ToggleFavouriteMutation = void 0;
|
|
13
|
-
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
14
|
-
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
-
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
16
|
-
const Favourites_1 = require("../interfaces/responses/mutation/Favourites");
|
|
17
|
-
/**
|
|
18
|
-
* `ToggleFavouriteMutation` is a class that contains the method to toggle a favourite.
|
|
19
|
-
* It includes a method to toggle a favourite.
|
|
20
|
-
*/
|
|
21
|
-
class ToggleFavouriteMutation extends APIWrapper_1.APIWrapper {
|
|
22
|
-
/**
|
|
23
|
-
* Constructs a new `ToggleFavouriteMutation` 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
|
-
* `toggleFavourite` is a method that sends a mutation request to toggle a favourite.
|
|
33
|
-
*
|
|
34
|
-
* @param variables - An object of type `ToggleFavouriteVariables` representing the variables for the mutation.
|
|
35
|
-
* @returns A Promise that resolves to the response from the mutation request.
|
|
36
|
-
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
37
|
-
*/
|
|
38
|
-
toggleFavourite(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!this.authToken) {
|
|
41
|
-
throw new Error('ToggleFavouriteMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
-
}
|
|
43
|
-
if (!variables.animeId && !variables.mangaId && !variables.characterId && !variables.staffId && !variables.studioId) {
|
|
44
|
-
throw new Error('animeId, mangaId, characterId, staffId, or studioId variable is required');
|
|
45
|
-
}
|
|
46
|
-
const variableTypeMappings = {
|
|
47
|
-
animeId: 'number',
|
|
48
|
-
mangaId: 'number',
|
|
49
|
-
characterId: 'number',
|
|
50
|
-
staffId: 'number',
|
|
51
|
-
studioId: 'number'
|
|
52
|
-
};
|
|
53
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
54
|
-
const mutation = `
|
|
55
|
-
mutation ($animeId: Int, $mangaId: Int, $characterId: Int, $staffId: Int, $studioId: Int) {
|
|
56
|
-
ToggleFavourite (animeId: $animeId, mangaId: $mangaId, characterId: $characterId, staffId: $staffId, studioId: $studioId) {
|
|
57
|
-
${Favourites_1.FavouritesSchema}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
61
|
-
const data = { query: mutation, variables };
|
|
62
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.ToggleFavouriteMutation = ToggleFavouriteMutation;
|
|
@@ -1,62 +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.ToggleFollowMutation = 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 Basic_1 = require("../interfaces/Basic");
|
|
17
|
-
/**
|
|
18
|
-
* `ToggleFollowMutation` is a class representing a mutation to toggle a follow.
|
|
19
|
-
* It includes a method to toggle a follow.
|
|
20
|
-
*/
|
|
21
|
-
class ToggleFollowMutation extends APIWrapper_1.APIWrapper {
|
|
22
|
-
/**
|
|
23
|
-
* Constructs a new `ToggleFollowMutation` 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
|
-
* `ToggleFollow` is a method that sends a mutation request to toggle a follow.
|
|
33
|
-
*
|
|
34
|
-
* @param variables - An object of type `ToggleFollowVariables` representing the variables for the mutation.
|
|
35
|
-
* @returns A Promise that resolves to the response from the mutation request.
|
|
36
|
-
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
37
|
-
* */
|
|
38
|
-
toggleFollow(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!this.authToken) {
|
|
41
|
-
throw new Error('ToggleFollowMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
-
}
|
|
43
|
-
if (!variables.userId) {
|
|
44
|
-
throw new Error('userId variable is required');
|
|
45
|
-
}
|
|
46
|
-
const variableTypeMappings = {
|
|
47
|
-
userId: 'number'
|
|
48
|
-
};
|
|
49
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
50
|
-
const mutation = `
|
|
51
|
-
mutation ($userId: Int) {
|
|
52
|
-
ToggleFollow (userId: $userId) {
|
|
53
|
-
${Basic_1.BasicUserSchema}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
`;
|
|
57
|
-
const data = { query: mutation, variables };
|
|
58
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.ToggleFollowMutation = ToggleFollowMutation;
|
|
@@ -1,64 +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.ToggleLikeMutation = 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 Type_1 = require("../types/Type");
|
|
17
|
-
const Basic_1 = require("../interfaces/Basic");
|
|
18
|
-
/**
|
|
19
|
-
* `ToggleLikeMutation` is a class representing a mutation to toggle a like.
|
|
20
|
-
* It includes a method to delete an activity
|
|
21
|
-
*/
|
|
22
|
-
class ToggleLikeMutation extends APIWrapper_1.APIWrapper {
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new `ToggleLikeMutation` 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
|
-
* `ToggleLike` is a method that sends a mutation request to toggle a like.
|
|
34
|
-
*
|
|
35
|
-
* @param variables - An object of type `ToggleLikeVariables` representing the variables for the mutation.
|
|
36
|
-
* @returns A Promise that resolves to the response from the mutation request.
|
|
37
|
-
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
38
|
-
* */
|
|
39
|
-
toggleLike(variables) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
if (!this.authToken) {
|
|
42
|
-
throw new Error('ToggleLikeMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
43
|
-
}
|
|
44
|
-
if (!variables.id || !variables.type) {
|
|
45
|
-
throw new Error('id and type variables are required.');
|
|
46
|
-
}
|
|
47
|
-
const variableTypeMappings = {
|
|
48
|
-
id: 'number',
|
|
49
|
-
type: Type_1.LikeableTypeMappings
|
|
50
|
-
};
|
|
51
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
52
|
-
const mutation = `
|
|
53
|
-
mutation ($id: Int, $type: LikeableType) {
|
|
54
|
-
ToggleLike (id: $id, type: $type) {
|
|
55
|
-
${Basic_1.BasicUserSchema}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
const data = { query: mutation, variables };
|
|
60
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.ToggleLikeMutation = ToggleLikeMutation;
|
|
@@ -1,64 +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.ToggleLikeV2Mutation = 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 Type_1 = require("../types/Type");
|
|
17
|
-
const Activity_1 = require("../interfaces/Activity");
|
|
18
|
-
/**
|
|
19
|
-
* `ToggleLikeV2Mutation` is a class representing a mutation to toggle a like.
|
|
20
|
-
* It includes a method to delete an activity
|
|
21
|
-
*/
|
|
22
|
-
class ToggleLikeV2Mutation extends APIWrapper_1.APIWrapper {
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new `ToggleLikeV2Mutation` 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
|
-
* `ToggleLikeV2` is a method that sends a mutation request to toggle a like.
|
|
34
|
-
*
|
|
35
|
-
* @param variables - An object of type `ToggleLikeV2Variables` representing the variables for the mutation.
|
|
36
|
-
* @returns A Promise that resolves to the response from the mutation request.
|
|
37
|
-
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
38
|
-
* */
|
|
39
|
-
toggleLikeV2(variables) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
if (!this.authToken) {
|
|
42
|
-
throw new Error('ToggleLikeV2Mutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
43
|
-
}
|
|
44
|
-
if (!variables.id || !variables.type) {
|
|
45
|
-
throw new Error('id and type variables are required.');
|
|
46
|
-
}
|
|
47
|
-
const variableTypeMappings = {
|
|
48
|
-
id: 'number',
|
|
49
|
-
type: Type_1.LikeableTypeMappings
|
|
50
|
-
};
|
|
51
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
52
|
-
const mutation = `
|
|
53
|
-
mutation ($id: Int, $type: LikeableType, $asHtml: Boolean) {
|
|
54
|
-
ToggleLikeV2 (id: $id, type: $type) {
|
|
55
|
-
${Activity_1.ActivitySchemaV2}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
const data = { query: mutation, variables };
|
|
60
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.ToggleLikeV2Mutation = ToggleLikeV2Mutation;
|
|
@@ -1,64 +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.ToggleThreadSubscriptionMutation = 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 Thread_1 = require("../interfaces/responses/query/Thread");
|
|
17
|
-
/**
|
|
18
|
-
* `ToggleThreadSubscriptionMutation` is a class representing a mutation to subscribe to a thread.
|
|
19
|
-
* It includes a method to subscribe to a thread
|
|
20
|
-
*/
|
|
21
|
-
class ToggleThreadSubscriptionMutation extends APIWrapper_1.APIWrapper {
|
|
22
|
-
/**
|
|
23
|
-
* Constructs a new `ToggleThreadSubscriptionMutation` 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
|
-
* `toggleThreadSubscription` is a method that sends a mutation request to subscribe to an activity.
|
|
33
|
-
*
|
|
34
|
-
* @param variables - An object of type `ToggleThreadSubscriptionVariables` representing the variables for the mutation.
|
|
35
|
-
* @returns A Promise that resolves to the response from the mutation request.
|
|
36
|
-
* @throws Will throw an error if the mutation request fails or if the provided variables do not pass the validation checks.
|
|
37
|
-
* */
|
|
38
|
-
toggleThreadSubscription(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!this.authToken) {
|
|
41
|
-
throw new Error('ToggleThreadSubscriptionMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
42
|
-
}
|
|
43
|
-
if (!variables.threadId || !variables.subscribe) {
|
|
44
|
-
throw new Error('threadId & subscribe variables are required');
|
|
45
|
-
}
|
|
46
|
-
const variableTypeMappings = {
|
|
47
|
-
threadId: 'number',
|
|
48
|
-
subscribe: 'boolean',
|
|
49
|
-
asHtml: 'boolean'
|
|
50
|
-
};
|
|
51
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
52
|
-
const mutation = `
|
|
53
|
-
mutation ($threadId: Int, $subscribe: Boolean, $asHtml: Boolean) {
|
|
54
|
-
ToggleThreadSubscription (threadId: $threadId, subscribe: $subscribe) {
|
|
55
|
-
${Thread_1.ThreadSchema}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
const data = { query: mutation, variables };
|
|
60
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.ToggleThreadSubscriptionMutation = ToggleThreadSubscriptionMutation;
|
|
@@ -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.UpdateAniChartHighlightsMutation = 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
|
-
* `UpdateAniChartHighlightsMutation` is a class that represents a mutation to update the AniChart highlights.
|
|
18
|
-
*/
|
|
19
|
-
class UpdateAniChartHighlightsMutation extends APIWrapper_1.APIWrapper {
|
|
20
|
-
/**
|
|
21
|
-
* Constructs a new `UpdateAniChartHighlightsMutation` 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
|
-
* `updateAniChartHighlights` is a method that sends a mutation request to update the AniChart highlights.
|
|
31
|
-
*
|
|
32
|
-
* @param variables - An object of type `UpdateAniChartHighlightsVariables` 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
|
-
updateAniChartHighlights(variables) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
if (!this.authToken) {
|
|
39
|
-
throw new Error('UpdateAniChartHighlightsMutation requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
40
|
-
}
|
|
41
|
-
const variableTypeMappings = {
|
|
42
|
-
highlights: {
|
|
43
|
-
mediaId: 'number',
|
|
44
|
-
highlight: 'boolean'
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
48
|
-
const mutation = `
|
|
49
|
-
mutation ($highlights: [AniChartHighlightInput]) {
|
|
50
|
-
UpdateAniChartHighlights (highlights: $highlights)
|
|
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.UpdateAniChartHighlightsMutation = UpdateAniChartHighlightsMutation;
|