anilink-api-wrapper 1.24.0 → 1.26.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/README.md +3 -0
- package/dist/AniLink.js +10 -1
- package/dist/apis/anilist/interfaces/Activity.js +74 -40
- package/dist/apis/anilist/interfaces/Basic.js +33 -0
- package/dist/apis/anilist/interfaces/Distribution.js +21 -0
- package/dist/apis/anilist/interfaces/Media.js +11 -0
- package/dist/apis/anilist/interfaces/Notification.js +23 -0
- package/dist/apis/anilist/interfaces/SiteTrend.js +22 -1
- package/dist/apis/anilist/interfaces/responses/mutation/Favourites.js +83 -0
- package/dist/apis/anilist/interfaces/responses/query/Media.js +8 -9
- package/dist/apis/anilist/interfaces/responses/query/Notification.js +20 -22
- package/dist/apis/anilist/interfaces/responses/query/Recommendation.js +2 -2
- package/dist/apis/anilist/interfaces/responses/query/Review.js +2 -2
- package/dist/apis/anilist/interfaces/responses/query/SiteStatistics.js +8 -8
- package/dist/apis/anilist/interfaces/responses/query/Thread.js +4 -4
- package/dist/apis/anilist/interfaces/responses/query/ThreadComment.js +3 -3
- package/dist/apis/anilist/mutation/SaveActivityReply.js +2 -2
- package/dist/apis/anilist/mutation/ToggleFavourite.js +66 -0
- package/dist/apis/anilist/mutation/ToggleFollow.js +62 -0
- package/dist/apis/anilist/mutation/ToggleLike.js +2 -2
- package/dist/apis/anilist/mutation/UpdateFavouriteOrder.js +73 -0
- package/dist/apis/anilist/query/ActivityReply.js +2 -2
- package/dist/apis/anilist/query/AniChartUser.js +2 -2
- package/dist/apis/anilist/query/Markdown.js +2 -2
- package/dist/apis/anilist/query/page/ActivityReplies.js +2 -2
- package/dist/apis/anilist/query/page/Likes.js +2 -2
- package/package.json +45 -52
- package/dist/apis/anilist/interfaces/ActivityHistory.js +0 -2
- package/dist/apis/anilist/interfaces/ActivityNotification.js +0 -21
- package/dist/apis/anilist/interfaces/ActivityReply.js +0 -23
- package/dist/apis/anilist/interfaces/BasicComment.js +0 -12
- package/dist/apis/anilist/interfaces/BasicThread.js +0 -13
- package/dist/apis/anilist/interfaces/BasicUser.js +0 -14
- package/dist/apis/anilist/interfaces/MediaListEntry.js +0 -13
- package/dist/apis/anilist/interfaces/MediaStatistics.js +0 -2
- package/dist/apis/anilist/interfaces/MediaStats.js +0 -2
- package/dist/apis/anilist/interfaces/ScoreDistribution.js +0 -13
- package/dist/apis/anilist/interfaces/SiteTrendConnection.js +0 -25
- package/dist/apis/anilist/interfaces/StatusDistribution.js +0 -13
- package/dist/apis/anilist/interfaces/ThreadNotification.js +0 -27
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SiteStatisticsSchema = void 0;
|
|
4
|
-
const
|
|
4
|
+
const SiteTrend_1 = require("../../SiteTrend");
|
|
5
5
|
/**
|
|
6
6
|
* `SiteStatisticsSchema` is a constant representing the GraphQL schema for a site statistics query.
|
|
7
7
|
* It includes users, anime, manga, characters, staff, studios, and reviews of type `SiteTrendConnection`.
|
|
8
8
|
*/
|
|
9
9
|
exports.SiteStatisticsSchema = `
|
|
10
10
|
users (sort: $usersSort, page: $usersPage, perPage: $usersPerPage) {
|
|
11
|
-
${
|
|
11
|
+
${SiteTrend_1.SiteTrendConnectionSchema}
|
|
12
12
|
}
|
|
13
13
|
anime (sort: $animeSort, page: $animePage, perPage: $animePerPage) {
|
|
14
|
-
${
|
|
14
|
+
${SiteTrend_1.SiteTrendConnectionSchema}
|
|
15
15
|
}
|
|
16
16
|
manga (sort: $mangaSort, page: $mangaPage, perPage: $mangaPerPage) {
|
|
17
|
-
${
|
|
17
|
+
${SiteTrend_1.SiteTrendConnectionSchema}
|
|
18
18
|
}
|
|
19
19
|
characters (sort: $charactersSort, page: $charactersPage, perPage: $charactersPerPage) {
|
|
20
|
-
${
|
|
20
|
+
${SiteTrend_1.SiteTrendConnectionSchema}
|
|
21
21
|
}
|
|
22
22
|
staff (sort: $staffSort, page: $staffPage, perPage: $staffPerPage) {
|
|
23
|
-
${
|
|
23
|
+
${SiteTrend_1.SiteTrendConnectionSchema}
|
|
24
24
|
}
|
|
25
25
|
studios (sort: $studiosSort, page: $studiosPage, perPage: $studiosPerPage) {
|
|
26
|
-
${
|
|
26
|
+
${SiteTrend_1.SiteTrendConnectionSchema}
|
|
27
27
|
}
|
|
28
28
|
reviews (sort: $reviewsSort, page: $reviewsPage, perPage: $reviewsPerPage) {
|
|
29
|
-
${
|
|
29
|
+
${SiteTrend_1.SiteTrendConnectionSchema}
|
|
30
30
|
}
|
|
31
31
|
`;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ThreadSchema = void 0;
|
|
4
4
|
const Media_1 = require("./Media");
|
|
5
|
-
const
|
|
5
|
+
const Basic_1 = require("../../Basic");
|
|
6
6
|
/**
|
|
7
7
|
* `ThreadSchema` is a constant representing the GraphQL schema for a thread query.
|
|
8
8
|
* It includes the thread's id, title, body, userId, replyUserId, replyCommentId, replyCount, viewCount, isLocked status, isSticky status, isSubscribed status, likeCount, isLiked status, repliedAt, createdAt, updatedAt, user of type `BasicUser`, replyUser of type `BasicUser`, likes of type `BasicUser[]`, siteUrl, categories, and mediaCategories of type `MediaResponse[]`.
|
|
@@ -25,13 +25,13 @@ exports.ThreadSchema = `
|
|
|
25
25
|
createdAt
|
|
26
26
|
updatedAt
|
|
27
27
|
user {
|
|
28
|
-
${
|
|
28
|
+
${Basic_1.BasicUserSchema}
|
|
29
29
|
}
|
|
30
30
|
replyUser {
|
|
31
|
-
${
|
|
31
|
+
${Basic_1.BasicUserSchema}
|
|
32
32
|
}
|
|
33
33
|
likes {
|
|
34
|
-
${
|
|
34
|
+
${Basic_1.BasicUserSchema}
|
|
35
35
|
}
|
|
36
36
|
siteUrl
|
|
37
37
|
categories {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ThreadCommentSchema = void 0;
|
|
4
4
|
const Thread_1 = require("./Thread");
|
|
5
|
-
const
|
|
5
|
+
const Basic_1 = require("../../Basic");
|
|
6
6
|
/**
|
|
7
7
|
* `ThreadCommentSchema` is a constant representing the GraphQL schema for a thread comment query.
|
|
8
8
|
* It includes the comment's id, userId, threadId, comment, likeCount, isLiked status, siteUrl, createdAt, updatedAt, thread of type `ThreadResponse`, user of type `BasicUser`, likes of type `BasicUser[]`, childComments, and isLocked status.
|
|
@@ -21,10 +21,10 @@ exports.ThreadCommentSchema = `
|
|
|
21
21
|
${Thread_1.ThreadSchema}
|
|
22
22
|
}
|
|
23
23
|
user {
|
|
24
|
-
${
|
|
24
|
+
${Basic_1.BasicUserSchema}
|
|
25
25
|
}
|
|
26
26
|
likes {
|
|
27
|
-
${
|
|
27
|
+
${Basic_1.BasicUserSchema}
|
|
28
28
|
}
|
|
29
29
|
childComments
|
|
30
30
|
isLocked
|
|
@@ -13,7 +13,7 @@ exports.SaveActivityReplyMutation = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
|
-
const
|
|
16
|
+
const Activity_1 = require("../interfaces/Activity");
|
|
17
17
|
/**
|
|
18
18
|
* `SaveActivityReplyMutation` is a class representing a mutation to save an activity reply.
|
|
19
19
|
* It includes a method to save an activity reply
|
|
@@ -54,7 +54,7 @@ class SaveActivityReplyMutation extends APIWrapper_1.APIWrapper {
|
|
|
54
54
|
const mutation = `
|
|
55
55
|
mutation ($id: Int, $activityId: Int, $text: String, $asMod: Boolean, $asHtml: Boolean) {
|
|
56
56
|
SaveActivityReply (id: $id, activityId: $activityId, text: $text, asMod: $asMod) {
|
|
57
|
-
${
|
|
57
|
+
${Activity_1.ActivityReplySchema}
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
`;
|
|
@@ -0,0 +1,66 @@
|
|
|
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;
|
|
@@ -0,0 +1,62 @@
|
|
|
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;
|
|
@@ -14,7 +14,7 @@ const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
16
|
const Type_1 = require("../types/Type");
|
|
17
|
-
const
|
|
17
|
+
const Basic_1 = require("../interfaces/Basic");
|
|
18
18
|
/**
|
|
19
19
|
* `ToggleLikeMutation` is a class representing a mutation to toggle a like.
|
|
20
20
|
* It includes a method to delete an activity
|
|
@@ -52,7 +52,7 @@ class ToggleLikeMutation extends APIWrapper_1.APIWrapper {
|
|
|
52
52
|
const mutation = `
|
|
53
53
|
mutation ($id: Int, $type: LikeableType) {
|
|
54
54
|
ToggleLike (id: $id, type: $type) {
|
|
55
|
-
${
|
|
55
|
+
${Basic_1.BasicUserSchema}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
`;
|
|
@@ -0,0 +1,73 @@
|
|
|
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;
|
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ActivityReplyQuery = void 0;
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
-
const ActivityReply_1 = require("../interfaces/ActivityReply");
|
|
16
15
|
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
|
+
const Activity_1 = require("../interfaces/Activity");
|
|
17
17
|
/**
|
|
18
18
|
* `ActivityReplyQuery` is a class representing a query for activity replies.
|
|
19
19
|
* It includes a method to get activity replies.
|
|
@@ -48,7 +48,7 @@ class ActivityReplyQuery extends APIWrapper_1.APIWrapper {
|
|
|
48
48
|
const query = `
|
|
49
49
|
query ($id: Int, $activityId: Int, $asHtml: Boolean) {
|
|
50
50
|
ActivityReply (id: $id, activityId: $activityId) {
|
|
51
|
-
${
|
|
51
|
+
${Activity_1.ActivityReplySchema}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
`;
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.AniChartUserQuery = void 0;
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
-
const
|
|
15
|
+
const Basic_1 = require("../interfaces/Basic");
|
|
16
16
|
/**
|
|
17
17
|
* `AniChartUserQuery` is a class representing a query for AniChart users.
|
|
18
18
|
* It includes a method to get AniChart users.
|
|
@@ -41,7 +41,7 @@ class AniChartUserQuery extends APIWrapper_1.APIWrapper {
|
|
|
41
41
|
query {
|
|
42
42
|
AniChartUser {
|
|
43
43
|
user {
|
|
44
|
-
${
|
|
44
|
+
${Basic_1.BasicUserSchema}
|
|
45
45
|
}
|
|
46
46
|
settings
|
|
47
47
|
highlights
|
|
@@ -14,8 +14,8 @@ const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
16
|
/**
|
|
17
|
-
* `MarkdownQuery` is a class representing a query for converting
|
|
18
|
-
* It includes a method to send the
|
|
17
|
+
* `MarkdownQuery` is a class representing a query for converting Markdown text to HTML.
|
|
18
|
+
* It includes a method to send the Markdown text and receive the converted HTML.
|
|
19
19
|
*/
|
|
20
20
|
class MarkdownQuery extends APIWrapper_1.APIWrapper {
|
|
21
21
|
/**
|
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ActivityRepliesQuery = void 0;
|
|
13
13
|
const APIWrapper_1 = require("../../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../../base/RequestHandler");
|
|
15
|
-
const ActivityReply_1 = require("../../interfaces/ActivityReply");
|
|
16
15
|
const ValidateVariables_1 = require("../../../../base/ValidateVariables");
|
|
16
|
+
const Activity_1 = require("../../interfaces/Activity");
|
|
17
17
|
/**
|
|
18
18
|
* `ActivityRepliesQuery` is a class representing a query for activity replies.
|
|
19
19
|
* It includes a method to get activity replies.
|
|
@@ -58,7 +58,7 @@ class ActivityRepliesQuery extends APIWrapper_1.APIWrapper {
|
|
|
58
58
|
hasNextPage
|
|
59
59
|
}
|
|
60
60
|
activityReplies (id: $id, activityId: $activityId) {
|
|
61
|
-
${
|
|
61
|
+
${Activity_1.ActivityReplySchema}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -12,9 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.LikesQuery = void 0;
|
|
13
13
|
const APIWrapper_1 = require("../../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../../base/RequestHandler");
|
|
15
|
-
const BasicUser_1 = require("../../interfaces/BasicUser");
|
|
16
15
|
const Type_1 = require("../../types/Type");
|
|
17
16
|
const ValidateVariables_1 = require("../../../../base/ValidateVariables");
|
|
17
|
+
const Basic_1 = require("../../interfaces/Basic");
|
|
18
18
|
/**
|
|
19
19
|
* `LikesQuery` is a class representing a query for likes.
|
|
20
20
|
* It includes a method to get likes.
|
|
@@ -58,7 +58,7 @@ class LikesQuery extends APIWrapper_1.APIWrapper {
|
|
|
58
58
|
hasNextPage
|
|
59
59
|
}
|
|
60
60
|
likes (likeableId: $likeableId, type: $type) {
|
|
61
|
-
${
|
|
61
|
+
${Basic_1.BasicUserSchema}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
package/package.json
CHANGED
|
@@ -1,53 +1,46 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "anilink-api-wrapper",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "API wrapper for AniManga sites such as Anilist, MyAnimeList, Kitsu.",
|
|
5
|
-
"main": "dist/AniLink.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "jest",
|
|
8
|
-
"build": "rimraf dist && tsc",
|
|
9
|
-
"generate-docs": "typedoc --entryPoints ./src --entryPointStrategy expand --out docs --plugin typedoc-theme-hierarchy --theme hierarchy && node add-ga.js",
|
|
10
|
-
"prepublishOnly": "npm run build"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"anilist-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
"typedoc": "^0.25.13",
|
|
47
|
-
"typedoc-theme-hierarchy": "^4.1.2",
|
|
48
|
-
"typescript": "^5.4.5"
|
|
49
|
-
},
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"axios": "^1.6.8"
|
|
52
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "anilink-api-wrapper",
|
|
3
|
+
"version": "1.26.0",
|
|
4
|
+
"description": "API wrapper for AniManga sites such as Anilist, MyAnimeList, Kitsu.",
|
|
5
|
+
"main": "dist/AniLink.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "jest",
|
|
8
|
+
"build": "rimraf dist && tsc",
|
|
9
|
+
"generate-docs": "typedoc --entryPoints ./src --entryPointStrategy expand --out docs --plugin typedoc-theme-hierarchy --theme hierarchy && node add-ga.js",
|
|
10
|
+
"prepublishOnly": "npm run build"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"anilist",
|
|
14
|
+
"myanimelist",
|
|
15
|
+
"kitsu",
|
|
16
|
+
"api",
|
|
17
|
+
"wrapper",
|
|
18
|
+
"anilist-api",
|
|
19
|
+
"anilist-query",
|
|
20
|
+
"anilist-mutation",
|
|
21
|
+
"anilist-graphql"
|
|
22
|
+
],
|
|
23
|
+
"author": "RLAlpha49",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@babel/preset-typescript": "^7.24.1",
|
|
27
|
+
"@types/jest": "^29.5.12",
|
|
28
|
+
"babel-jest": "^29.7.0",
|
|
29
|
+
"dotenv": "^16.4.5",
|
|
30
|
+
"eslint": "^8.57.0",
|
|
31
|
+
"eslint-config-standard-with-typescript": "^43.0.1",
|
|
32
|
+
"eslint-plugin-import": "^2.29.1",
|
|
33
|
+
"eslint-plugin-n": "^15.7.0",
|
|
34
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
35
|
+
"jest": "^29.7.0",
|
|
36
|
+
"rimraf": "^5.0.5",
|
|
37
|
+
"standard": "^17.1.0",
|
|
38
|
+
"ts-jest": "^29.1.2",
|
|
39
|
+
"typedoc": "^0.25.13",
|
|
40
|
+
"typedoc-theme-hierarchy": "^4.1.2",
|
|
41
|
+
"typescript": "^5.4.5"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"axios": "^1.6.8"
|
|
45
|
+
}
|
|
53
46
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ActivityNotificationSchema = void 0;
|
|
4
|
-
const Activity_1 = require("./Activity");
|
|
5
|
-
const BasicUser_1 = require("./BasicUser");
|
|
6
|
-
/**
|
|
7
|
-
* `ActivityNotificationSchema` is a constant representing the GraphQL schema for an activity notification query.
|
|
8
|
-
* It includes the id of the notification, the user id, the type of the notification, the activity id, the context, the creation date, the activity details, and the user details.
|
|
9
|
-
*/
|
|
10
|
-
exports.ActivityNotificationSchema = `
|
|
11
|
-
id
|
|
12
|
-
userId
|
|
13
|
-
type
|
|
14
|
-
activityId
|
|
15
|
-
context
|
|
16
|
-
createdAt
|
|
17
|
-
${Activity_1.ActivitySchema}
|
|
18
|
-
user {
|
|
19
|
-
${BasicUser_1.BasicUserSchema}
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ActivityReplySchema = void 0;
|
|
4
|
-
const BasicUser_1 = require("./BasicUser");
|
|
5
|
-
/**
|
|
6
|
-
* `ActivityReplySchema` is a constant representing the GraphQL schema for an activity reply query.
|
|
7
|
-
* It includes the id of the reply, the user id, the activity id, the text of the reply, the like count, the like status, the creation date, the user details, and the likes details.
|
|
8
|
-
*/
|
|
9
|
-
exports.ActivityReplySchema = `
|
|
10
|
-
id
|
|
11
|
-
userId
|
|
12
|
-
activityId
|
|
13
|
-
text (asHtml: $asHtml)
|
|
14
|
-
likeCount
|
|
15
|
-
isLiked
|
|
16
|
-
createdAt
|
|
17
|
-
user {
|
|
18
|
-
${BasicUser_1.BasicUserSchema}
|
|
19
|
-
}
|
|
20
|
-
likes {
|
|
21
|
-
${BasicUser_1.BasicUserSchema}
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BasicCommentSchema = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* `BasicCommentSchema` is a string representing the GraphQL schema for a basic comment.
|
|
6
|
-
* It includes the id, user id, and thread id.
|
|
7
|
-
*/
|
|
8
|
-
exports.BasicCommentSchema = `
|
|
9
|
-
id
|
|
10
|
-
userId
|
|
11
|
-
threadId
|
|
12
|
-
`;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BasicThreadSchema = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* `BasicThreadSchema` is a string representing the GraphQL schema for a basic thread.
|
|
6
|
-
* It includes the id, title, body, and site url.
|
|
7
|
-
*/
|
|
8
|
-
exports.BasicThreadSchema = `
|
|
9
|
-
id
|
|
10
|
-
title
|
|
11
|
-
body (asHtml: $asHtml)
|
|
12
|
-
siteUrl
|
|
13
|
-
`;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BasicUserSchema = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* `BasicUserSchema` is a string representing the GraphQL schema for a basic user.
|
|
6
|
-
* It includes the id, name, and avatar with a large size.
|
|
7
|
-
*/
|
|
8
|
-
exports.BasicUserSchema = `
|
|
9
|
-
id
|
|
10
|
-
name
|
|
11
|
-
avatar {
|
|
12
|
-
large
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MediaListEntrySchema = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* `MediaListEntrySchema` is a string representing the GraphQL schema for a media list entry.
|
|
6
|
-
* It includes the id and status.
|
|
7
|
-
*/
|
|
8
|
-
exports.MediaListEntrySchema = `
|
|
9
|
-
mediaListEntry {
|
|
10
|
-
id
|
|
11
|
-
status
|
|
12
|
-
}
|
|
13
|
-
`;
|