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,75 +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.FollowersQuery = void 0;
|
|
13
|
-
const APIWrapper_1 = require("../../../../base/APIWrapper");
|
|
14
|
-
const RequestHandler_1 = require("../../../../base/RequestHandler");
|
|
15
|
-
const User_1 = require("../../interfaces/responses/query/User");
|
|
16
|
-
const Sort_1 = require("../../types/Sort");
|
|
17
|
-
const ValidateVariables_1 = require("../../../../base/ValidateVariables");
|
|
18
|
-
/**
|
|
19
|
-
* `FollowersQuery` is a class representing a query for followers.
|
|
20
|
-
* It includes a method to get followers.
|
|
21
|
-
*/
|
|
22
|
-
class FollowersQuery extends APIWrapper_1.APIWrapper {
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new `FollowersQuery` 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
|
-
* `followers` is a method that sends a query request to get followers.
|
|
34
|
-
*
|
|
35
|
-
* @param variables - The variables for the query.
|
|
36
|
-
* @returns The response from the query request.
|
|
37
|
-
*/
|
|
38
|
-
followers(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!variables.userId) {
|
|
41
|
-
throw new Error('userId is required');
|
|
42
|
-
}
|
|
43
|
-
const variableTypeMappings = {
|
|
44
|
-
page: 'number',
|
|
45
|
-
perPage: 'number',
|
|
46
|
-
userId: 'number',
|
|
47
|
-
sort: Sort_1.UserSortMappings,
|
|
48
|
-
animeStatLimit: 'number',
|
|
49
|
-
mangaStatLimit: 'number',
|
|
50
|
-
animeStatSort: Sort_1.UserStatisticSortMappings,
|
|
51
|
-
mangaStatSort: Sort_1.UserStatisticSortMappings
|
|
52
|
-
};
|
|
53
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
54
|
-
const query = `
|
|
55
|
-
query ($page: Int, $perPage: Int, $userId: Int!, $sort: [UserSort], $asHtml: Boolean, $animeStatLimit: Int, $mangaStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatSort: [UserStatisticsSort]) {
|
|
56
|
-
Page (page: $page, perPage: $perPage) {
|
|
57
|
-
pageInfo {
|
|
58
|
-
total
|
|
59
|
-
perPage
|
|
60
|
-
currentPage
|
|
61
|
-
lastPage
|
|
62
|
-
hasNextPage
|
|
63
|
-
}
|
|
64
|
-
followers (userId: $userId, sort: $sort) {
|
|
65
|
-
${User_1.UserSchema}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
const data = { query, variables };
|
|
71
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.FollowersQuery = FollowersQuery;
|
|
@@ -1,75 +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.FollowingsQuery = void 0;
|
|
13
|
-
const APIWrapper_1 = require("../../../../base/APIWrapper");
|
|
14
|
-
const RequestHandler_1 = require("../../../../base/RequestHandler");
|
|
15
|
-
const User_1 = require("../../interfaces/responses/query/User");
|
|
16
|
-
const Sort_1 = require("../../types/Sort");
|
|
17
|
-
const ValidateVariables_1 = require("../../../../base/ValidateVariables");
|
|
18
|
-
/**
|
|
19
|
-
* `FollowingsQuery` is a class representing a query for followings.
|
|
20
|
-
* It includes a method to get followings.
|
|
21
|
-
*/
|
|
22
|
-
class FollowingsQuery extends APIWrapper_1.APIWrapper {
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new `FollowingsQuery` 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
|
-
* `followings` is a method that sends a query request to get followings.
|
|
34
|
-
*
|
|
35
|
-
* @param variables - The variables for the query.
|
|
36
|
-
* @returns The response from the query request.
|
|
37
|
-
*/
|
|
38
|
-
followings(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!variables.userId) {
|
|
41
|
-
throw new Error('userId is required');
|
|
42
|
-
}
|
|
43
|
-
const variableTypeMappings = {
|
|
44
|
-
page: 'number',
|
|
45
|
-
perPage: 'number',
|
|
46
|
-
userId: 'number',
|
|
47
|
-
sort: Sort_1.UserSortMappings,
|
|
48
|
-
animeStatLimit: 'number',
|
|
49
|
-
mangaStatLimit: 'number',
|
|
50
|
-
animeStatSort: Sort_1.UserStatisticSortMappings,
|
|
51
|
-
mangaStatSort: Sort_1.UserStatisticSortMappings
|
|
52
|
-
};
|
|
53
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
54
|
-
const query = `
|
|
55
|
-
query ($page: Int, $perPage: Int, $userId: Int!, $sort: [UserSort], $asHtml: Boolean, $animeStatLimit: Int, $mangaStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatSort: [UserStatisticsSort]) {
|
|
56
|
-
Page (page: $page, perPage: $perPage) {
|
|
57
|
-
pageInfo {
|
|
58
|
-
total
|
|
59
|
-
perPage
|
|
60
|
-
currentPage
|
|
61
|
-
lastPage
|
|
62
|
-
hasNextPage
|
|
63
|
-
}
|
|
64
|
-
following (userId: $userId, sort: $sort) {
|
|
65
|
-
${User_1.UserSchema}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
const data = { query, variables };
|
|
71
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.FollowingsQuery = FollowingsQuery;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.LikesQuery = void 0;
|
|
13
|
-
const APIWrapper_1 = require("../../../../base/APIWrapper");
|
|
14
|
-
const RequestHandler_1 = require("../../../../base/RequestHandler");
|
|
15
|
-
const Type_1 = require("../../types/Type");
|
|
16
|
-
const ValidateVariables_1 = require("../../../../base/ValidateVariables");
|
|
17
|
-
const Basic_1 = require("../../interfaces/Basic");
|
|
18
|
-
/**
|
|
19
|
-
* `LikesQuery` is a class representing a query for likes.
|
|
20
|
-
* It includes a method to get likes.
|
|
21
|
-
*/
|
|
22
|
-
class LikesQuery extends APIWrapper_1.APIWrapper {
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new `LikesQuery` 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
|
-
* `likes` is a method that sends a query request to get likes.
|
|
34
|
-
*
|
|
35
|
-
* @param variables - The variables for the query.
|
|
36
|
-
* @returns The response from the query request.
|
|
37
|
-
*/
|
|
38
|
-
likes(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
|
-
likeableId: 'number',
|
|
45
|
-
type: Type_1.LikeableTypeMappings,
|
|
46
|
-
page: 'number',
|
|
47
|
-
perPage: 'number'
|
|
48
|
-
};
|
|
49
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
50
|
-
const query = `
|
|
51
|
-
query ($likeableId: Int, $type: LikeableType, $page: Int, $perPage: Int) {
|
|
52
|
-
Page (page: $page, perPage: $perPage) {
|
|
53
|
-
pageInfo {
|
|
54
|
-
total
|
|
55
|
-
perPage
|
|
56
|
-
currentPage
|
|
57
|
-
lastPage
|
|
58
|
-
hasNextPage
|
|
59
|
-
}
|
|
60
|
-
likes (likeableId: $likeableId, type: $type) {
|
|
61
|
-
${Basic_1.BasicUserSchema}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
const data = { query, variables };
|
|
67
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.LikesQuery = LikesQuery;
|
|
@@ -1,101 +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.MediaListsQuery = void 0;
|
|
13
|
-
const APIWrapper_1 = require("../../../../base/APIWrapper");
|
|
14
|
-
const RequestHandler_1 = require("../../../../base/RequestHandler");
|
|
15
|
-
const MediaList_1 = require("../../interfaces/responses/query/MediaList");
|
|
16
|
-
const Type_1 = require("../../types/Type");
|
|
17
|
-
const Status_1 = require("../../types/Status");
|
|
18
|
-
const FuzzyDate_1 = require("../../types/FuzzyDate");
|
|
19
|
-
const Sort_1 = require("../../types/Sort");
|
|
20
|
-
const Format_1 = require("../../types/Format");
|
|
21
|
-
const ValidateVariables_1 = require("../../../../base/ValidateVariables");
|
|
22
|
-
/**
|
|
23
|
-
* `MediaListsQuery` is a class representing a query for media lists.
|
|
24
|
-
* It includes a method to get media lists.
|
|
25
|
-
*/
|
|
26
|
-
class MediaListsQuery extends APIWrapper_1.APIWrapper {
|
|
27
|
-
/**
|
|
28
|
-
* Constructs a new `MediaListsQuery` 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
|
-
* `mediaLists` is a method that sends a query request to get media lists.
|
|
38
|
-
*
|
|
39
|
-
* @param variables - The variables for the query.
|
|
40
|
-
* @returns The response from the query request.
|
|
41
|
-
*/
|
|
42
|
-
mediaLists(variables) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
if (!variables) {
|
|
45
|
-
throw new Error('At least one variable must be set');
|
|
46
|
-
}
|
|
47
|
-
const variableTypeMappings = {
|
|
48
|
-
page: 'number',
|
|
49
|
-
perPage: 'number',
|
|
50
|
-
id: 'number',
|
|
51
|
-
userId: 'number',
|
|
52
|
-
userName: 'string',
|
|
53
|
-
type: Type_1.MediaTypeMappings,
|
|
54
|
-
status: Status_1.MediaListStatusMappings,
|
|
55
|
-
mediaId: 'number',
|
|
56
|
-
isFollowing: 'boolean',
|
|
57
|
-
notes: 'string',
|
|
58
|
-
startedAt: FuzzyDate_1.FuzzyDateMappings,
|
|
59
|
-
completedAt: FuzzyDate_1.FuzzyDateMappings,
|
|
60
|
-
compareWithAuthList: 'boolean',
|
|
61
|
-
userId_in: 'number[]',
|
|
62
|
-
status_in: Status_1.MediaListStatusMappings,
|
|
63
|
-
status_not_in: Status_1.MediaListStatusMappings,
|
|
64
|
-
status_not: Status_1.MediaListStatusMappings,
|
|
65
|
-
mediaId_in: 'number[]',
|
|
66
|
-
mediaId_not_in: 'number[]',
|
|
67
|
-
notes_like: 'string',
|
|
68
|
-
startedAt_greater: FuzzyDate_1.FuzzyDateMappings,
|
|
69
|
-
startedAt_lesser: FuzzyDate_1.FuzzyDateMappings,
|
|
70
|
-
startedAt_like: 'string',
|
|
71
|
-
completedAt_greater: FuzzyDate_1.FuzzyDateMappings,
|
|
72
|
-
completedAt_lesser: FuzzyDate_1.FuzzyDateMappings,
|
|
73
|
-
completedAt_like: 'string',
|
|
74
|
-
sort: Sort_1.MediaListSortMappings,
|
|
75
|
-
scoreFormat: Format_1.ScoreFormatMapping,
|
|
76
|
-
asArray: 'boolean',
|
|
77
|
-
asHtml: 'boolean'
|
|
78
|
-
};
|
|
79
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
80
|
-
const query = `
|
|
81
|
-
query ($page: Int, $perPage: Int, $id: Int, $userId: Int, $userName: String, $type: MediaType, $status: MediaListStatus, $mediaId: Int, $isFollowing: Boolean, $notes: String, $startedAt: FuzzyDateInt, $completedAt: FuzzyDateInt, $compareWithAuthList: Boolean, $userId_in: [Int], $status_in: [MediaListStatus], $status_not_in: [MediaListStatus], $status_not: MediaListStatus, $mediaId_in: [Int], $mediaId_not_in: [Int], $notes_like: String, $startedAt_greater: FuzzyDateInt, $startedAt_lesser: FuzzyDateInt, $startedAt_like: String, $completedAt_greater: FuzzyDateInt, $completedAt_lesser: FuzzyDateInt, $completedAt_like: String, $ScoreFormat: ScoreFormat, $asArray: Boolean, $asHtml: Boolean) {
|
|
82
|
-
Page (page: $page, perPage: $perPage) {
|
|
83
|
-
pageInfo {
|
|
84
|
-
total
|
|
85
|
-
perPage
|
|
86
|
-
currentPage
|
|
87
|
-
lastPage
|
|
88
|
-
hasNextPage
|
|
89
|
-
}
|
|
90
|
-
mediaList (id: $id, userId: $userId, userName: $userName, type: $type, status: $status, mediaId: $mediaId, isFollowing: $isFollowing, notes: $notes, startedAt: $startedAt, completedAt: $completedAt, compareWithAuthList: $compareWithAuthList, userId_in: $userId_in, status_in: $status_in, status_not_in: $status_not_in, status_not: $status_not, mediaId_in: $mediaId_in, mediaId_not_in: $mediaId_not_in, notes_like: $notes_like, startedAt_greater: $startedAt_greater, startedAt_lesser: $startedAt_lesser, startedAt_like: $startedAt_like, completedAt_greater: $completedAt_greater, completedAt_lesser: $completedAt_lesser, completedAt_like: $completedAt_like) {
|
|
91
|
-
${MediaList_1.MediaListSchema}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
`;
|
|
96
|
-
const data = { query, variables };
|
|
97
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.MediaListsQuery = MediaListsQuery;
|
|
@@ -1,95 +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.MediaTrendsQuery = void 0;
|
|
13
|
-
const APIWrapper_1 = require("../../../../base/APIWrapper");
|
|
14
|
-
const RequestHandler_1 = require("../../../../base/RequestHandler");
|
|
15
|
-
const MediaTrend_1 = require("../../interfaces/responses/query/MediaTrend");
|
|
16
|
-
const Sort_1 = require("../../types/Sort");
|
|
17
|
-
const ValidateVariables_1 = require("../../../../base/ValidateVariables");
|
|
18
|
-
/**
|
|
19
|
-
* `MediaTrendsQuery` is a class representing a query for media trends.
|
|
20
|
-
* It includes a method to get media trends.
|
|
21
|
-
*/
|
|
22
|
-
class MediaTrendsQuery extends APIWrapper_1.APIWrapper {
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new `MediaTrendsQuery` 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
|
-
* `mediaTrends` is a method that sends a query request to get media trends.
|
|
34
|
-
*
|
|
35
|
-
* @param variables - The variables for the query.
|
|
36
|
-
* @returns The response from the query request.
|
|
37
|
-
*/
|
|
38
|
-
mediaTrends(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!variables) {
|
|
41
|
-
throw new Error('At least one variable must be set');
|
|
42
|
-
}
|
|
43
|
-
const variableTypeMappings = {
|
|
44
|
-
page: 'number',
|
|
45
|
-
perPage: 'number',
|
|
46
|
-
mediaId: 'number',
|
|
47
|
-
date: 'number',
|
|
48
|
-
trending: 'number',
|
|
49
|
-
averageScore: 'number',
|
|
50
|
-
popularity: 'number',
|
|
51
|
-
episode: 'number',
|
|
52
|
-
releasing: 'boolean',
|
|
53
|
-
mediaId_not: 'number',
|
|
54
|
-
mediaId_in: 'number[]',
|
|
55
|
-
mediaId_not_in: 'number[]',
|
|
56
|
-
date_greater: 'number',
|
|
57
|
-
date_lesser: 'number',
|
|
58
|
-
trending_greater: 'number',
|
|
59
|
-
trending_lesser: 'number',
|
|
60
|
-
trending_not: 'number',
|
|
61
|
-
averageScore_greater: 'number',
|
|
62
|
-
averageScore_lesser: 'number',
|
|
63
|
-
averageScore_not: 'number',
|
|
64
|
-
popularity_greater: 'number',
|
|
65
|
-
popularity_lesser: 'number',
|
|
66
|
-
popularity_not: 'number',
|
|
67
|
-
episode_greater: 'number',
|
|
68
|
-
episode_lesser: 'number',
|
|
69
|
-
episode_not: 'number',
|
|
70
|
-
sort: Sort_1.MediaTrendSortMappings,
|
|
71
|
-
asHtml: 'boolean'
|
|
72
|
-
};
|
|
73
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
74
|
-
const query = `
|
|
75
|
-
query ($page: Int, $perPage: Int, $mediaId: Int, $date: Int, $trending: Int, $averageScore: Int, $popularity: Int, $episode: Int, $releasing: Boolean, $mediaId_not: Int, $mediaId_in: [Int], $mediaId_not_in: [Int], $date_greater: Int, $date_lesser: Int, $trending_greater: Int, $trending_lesser: Int, $trending_not: Int, $averageScore_greater: Int, $averageScore_lesser: Int, $averageScore_not: Int, $popularity_greater: Int, $popularity_lesser: Int, $popularity_not: Int, $episode_greater: Int, $episode_lesser: Int, $episode_not: Int, $sort: [MediaTrendSort], $asHtml: Boolean) {
|
|
76
|
-
Page (page: $page, perPage: $perPage) {
|
|
77
|
-
pageInfo {
|
|
78
|
-
total
|
|
79
|
-
perPage
|
|
80
|
-
currentPage
|
|
81
|
-
lastPage
|
|
82
|
-
hasNextPage
|
|
83
|
-
}
|
|
84
|
-
mediaTrends (mediaId: $mediaId, date: $date, trending: $trending, averageScore: $averageScore, popularity: $popularity, episode: $episode, releasing: $releasing, mediaId_not: $mediaId_not, mediaId_in: $mediaId_in, mediaId_not_in: $mediaId_not_in, date_greater: $date_greater, date_lesser: $date_lesser, trending_greater: $trending_greater, trending_lesser: $trending_lesser, trending_not: $trending_not, averageScore_greater: $averageScore_greater, averageScore_lesser: $averageScore_lesser, averageScore_not: $averageScore_not, popularity_greater: $popularity_greater, popularity_lesser: $popularity_lesser, popularity_not: $popularity_not, episode_greater: $episode_greater, episode_lesser: $episode_lesser, episode_not: $episode_not, sort: $sort) {
|
|
85
|
-
${MediaTrend_1.MediaTrendSchema}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
`;
|
|
90
|
-
const data = { query, variables };
|
|
91
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.MediaTrendsQuery = MediaTrendsQuery;
|
|
@@ -1,143 +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.MediasQuery = void 0;
|
|
13
|
-
const APIWrapper_1 = require("../../../../base/APIWrapper");
|
|
14
|
-
const RequestHandler_1 = require("../../../../base/RequestHandler");
|
|
15
|
-
const Media_1 = require("../../interfaces/responses/query/Media");
|
|
16
|
-
const FuzzyDate_1 = require("../../types/FuzzyDate");
|
|
17
|
-
const Season_1 = require("../../types/Season");
|
|
18
|
-
const Type_1 = require("../../types/Type");
|
|
19
|
-
const Format_1 = require("../../types/Format");
|
|
20
|
-
const Status_1 = require("../../types/Status");
|
|
21
|
-
const Source_1 = require("../../types/Source");
|
|
22
|
-
const Sort_1 = require("../../types/Sort");
|
|
23
|
-
const ValidateVariables_1 = require("../../../../base/ValidateVariables");
|
|
24
|
-
/**
|
|
25
|
-
* `MediasQuery` is a class that extends the `APIWrapper` class.
|
|
26
|
-
* It defines the `medias` method that returns a `MediaResponse`.
|
|
27
|
-
*/
|
|
28
|
-
class MediasQuery extends APIWrapper_1.APIWrapper {
|
|
29
|
-
/**
|
|
30
|
-
* Creates an instance of `MediasQuery`.
|
|
31
|
-
* @param authToken - A string representing the authentication token.
|
|
32
|
-
*/
|
|
33
|
-
constructor(authToken) {
|
|
34
|
-
super('https://graphql.anilist.co');
|
|
35
|
-
this.authToken = authToken;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Returns a `MediaResponse` object.
|
|
39
|
-
* @param variables - A `MediasVariables` object representing the variables for the query.
|
|
40
|
-
* @returns A `MediaResponse` object.
|
|
41
|
-
*/
|
|
42
|
-
medias(variables) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
if (!variables) {
|
|
45
|
-
throw new Error('At least one variable must be set');
|
|
46
|
-
}
|
|
47
|
-
const variableTypeMappings = {
|
|
48
|
-
page: 'number',
|
|
49
|
-
perPage: 'number',
|
|
50
|
-
id: 'number',
|
|
51
|
-
idMal: 'number',
|
|
52
|
-
startDate: FuzzyDate_1.FuzzyDateMappings,
|
|
53
|
-
endDate: FuzzyDate_1.FuzzyDateMappings,
|
|
54
|
-
season: Season_1.MediaSeasonMappings,
|
|
55
|
-
seasonYear: 'number',
|
|
56
|
-
type: Type_1.MediaTypeMappings,
|
|
57
|
-
format: Format_1.MediaFormatMappings,
|
|
58
|
-
status: Status_1.MediaStatusMappings,
|
|
59
|
-
episodes: 'number',
|
|
60
|
-
duration: 'number',
|
|
61
|
-
chapters: 'number',
|
|
62
|
-
volumes: 'number',
|
|
63
|
-
isAdult: 'boolean',
|
|
64
|
-
genre: 'string',
|
|
65
|
-
tag: 'string',
|
|
66
|
-
minimumTagRank: 'number',
|
|
67
|
-
tagCategory: 'string',
|
|
68
|
-
onList: 'boolean',
|
|
69
|
-
licensedBy: 'string',
|
|
70
|
-
licensedById: 'number',
|
|
71
|
-
averageScore: 'number',
|
|
72
|
-
popularity: 'number',
|
|
73
|
-
source: Source_1.MediaSourceMappings,
|
|
74
|
-
countryOfOrigin: 'CountryCode',
|
|
75
|
-
isLicensed: 'boolean',
|
|
76
|
-
search: 'string',
|
|
77
|
-
id_not: 'number',
|
|
78
|
-
id_in: 'number[]',
|
|
79
|
-
id_not_in: 'number[]',
|
|
80
|
-
idMal_not: 'number',
|
|
81
|
-
idMal_in: 'number[]',
|
|
82
|
-
idMal_not_in: 'number[]',
|
|
83
|
-
startDate_greater: FuzzyDate_1.FuzzyDateMappings,
|
|
84
|
-
startDate_lesser: FuzzyDate_1.FuzzyDateMappings,
|
|
85
|
-
startDate_like: 'string',
|
|
86
|
-
endDate_greater: FuzzyDate_1.FuzzyDateMappings,
|
|
87
|
-
endDate_lesser: FuzzyDate_1.FuzzyDateMappings,
|
|
88
|
-
endDate_like: 'string',
|
|
89
|
-
format_in: Format_1.MediaFormatMappings,
|
|
90
|
-
format_not: Format_1.MediaFormatMappings,
|
|
91
|
-
format_not_in: Format_1.MediaFormatMappings,
|
|
92
|
-
status_in: Status_1.MediaStatusMappings,
|
|
93
|
-
status_not: Status_1.MediaStatusMappings,
|
|
94
|
-
status_not_in: Status_1.MediaStatusMappings,
|
|
95
|
-
episodes_greater: 'number',
|
|
96
|
-
episodes_lesser: 'number',
|
|
97
|
-
duration_greater: 'number',
|
|
98
|
-
duration_lesser: 'number',
|
|
99
|
-
chapters_greater: 'number',
|
|
100
|
-
chapters_lesser: 'number',
|
|
101
|
-
volumes_greater: 'number',
|
|
102
|
-
volumes_lesser: 'number',
|
|
103
|
-
genre_in: 'string[]',
|
|
104
|
-
genre_not_in: 'string[]',
|
|
105
|
-
tag_in: 'string[]',
|
|
106
|
-
tag_not_in: 'string[]',
|
|
107
|
-
tagCategory_in: 'string[]',
|
|
108
|
-
tagCategory_not_in: 'string[]',
|
|
109
|
-
licensedBy_in: 'string[]',
|
|
110
|
-
licensedById_in: 'number[]',
|
|
111
|
-
averageScore_not: 'number',
|
|
112
|
-
averageScore_greater: 'number',
|
|
113
|
-
averageScore_lesser: 'number',
|
|
114
|
-
popularity_not: 'number',
|
|
115
|
-
popularity_greater: 'number',
|
|
116
|
-
popularity_lesser: 'number',
|
|
117
|
-
source_in: Source_1.MediaSourceMappings,
|
|
118
|
-
sort: Sort_1.MediaSortMappings,
|
|
119
|
-
asHtml: 'boolean'
|
|
120
|
-
};
|
|
121
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
122
|
-
const query = `
|
|
123
|
-
query ($page: Int, $perPage: Int, $id: Int, $idMal: Int, $startDate: FuzzyDateInt, $endDate: FuzzyDateInt, $season: MediaSeason, $seasonYear: Int, $type: MediaType, $format: MediaFormat, $status: MediaStatus, $episodes: Int, $duration: Int, $chapters: Int, $volumes: Int, $isAdult: Boolean, $genre: String, $tag: String, $minimumTagRank: Int, $tagCategory: String, $onList: Boolean, $licensedBy: String, $licensedById: Int, $averageScore: Int, $popularity: Int, $source: MediaSource, $countryOfOrigin: CountryCode, $isLicensed: Boolean, $search: String, $id_not: Int, $id_in: [Int], $id_not_in: [Int], $idMal_not: Int, $idMal_in: [Int], $idMal_not_in: [Int], $startDate_greater: FuzzyDateInt, $startDate_lesser: FuzzyDateInt, $startDate_like: String, $endDate_greater: FuzzyDateInt, $endDate_lesser: FuzzyDateInt, $endDate_like: String, $format_in: [MediaFormat], $format_not: MediaFormat, $format_not_in: [MediaFormat], $status_in: [MediaStatus], $status_not: MediaStatus, $status_not_in: [MediaStatus], $episodes_greater: Int, $episodes_lesser: Int, $duration_greater: Int, $duration_lesser: Int, $chapters_greater: Int, $chapters_lesser: Int, $volumes_greater: Int, $volumes_lesser: Int, $genre_in: [String], $genre_not_in: [String], $tag_in: [String], $tag_not_in: [String], $tagCategory_in: [String], $tagCategory_not_in: [String], $licensedBy_in: [String], $licensedById_in: [Int], $averageScore_not: Int, $averageScore_greater: Int, $averageScore_lesser: Int, $popularity_not: Int, $popularity_greater: Int, $popularity_lesser: Int, $source_in: [MediaSource], $sort: [MediaSort], $asHtml: Boolean) {
|
|
124
|
-
Page (page: $page, perPage: $perPage) {
|
|
125
|
-
pageInfo {
|
|
126
|
-
total
|
|
127
|
-
perPage
|
|
128
|
-
currentPage
|
|
129
|
-
lastPage
|
|
130
|
-
hasNextPage
|
|
131
|
-
}
|
|
132
|
-
media (id: $id, idMal: $idMal, startDate: $startDate, endDate: $endDate, season: $season, seasonYear: $seasonYear, type: $type, format: $format, status: $status, episodes: $episodes, duration: $duration, chapters: $chapters, volumes: $volumes, isAdult: $isAdult, genre: $genre, tag: $tag, minimumTagRank: $minimumTagRank, tagCategory: $tagCategory, onList: $onList, licensedBy: $licensedBy, licensedById: $licensedById, averageScore: $averageScore, popularity: $popularity, source: $source, countryOfOrigin: $countryOfOrigin, isLicensed: $isLicensed, search: $search, id_not: $id_not, id_in: $id_in, id_not_in: $id_not_in, idMal_not: $idMal_not, idMal_in: $idMal_in, idMal_not_in: $idMal_not_in, startDate_greater: $startDate_greater, startDate_lesser: $startDate_lesser, startDate_like: $startDate_like, endDate_greater: $endDate_greater, endDate_lesser: $endDate_lesser, endDate_like: $endDate_like, format_in: $format_in, format_not: $format_not, format_not_in: $format_not_in, status_in: $status_in, status_not: $status_not, status_not_in: $status_not_in, episodes_greater: $episodes_greater, episodes_lesser: $episodes_lesser, duration_greater: $duration_greater, duration_lesser: $duration_lesser, chapters_greater: $chapters_greater, chapters_lesser: $chapters_lesser, volumes_greater: $volumes_greater, volumes_lesser: $volumes_lesser, genre_in: $genre_in, genre_not_in: $genre_not_in, tag_in: $tag_in, tag_not_in: $tag_not_in, tagCategory_in: $tagCategory_in, tagCategory_not_in: $tagCategory_not_in, licensedBy_in: $licensedBy_in, licensedById_in: $licensedById_in, averageScore_not: $averageScore_not, averageScore_greater: $averageScore_greater, averageScore_lesser: $averageScore_lesser, popularity_not: $popularity_not, popularity_greater: $popularity_greater, popularity_lesser: $popularity_lesser, source_in: $source_in, sort: $sort) {
|
|
133
|
-
${Media_1.MediaWithRelationsSchema}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
`;
|
|
138
|
-
const data = { query, variables };
|
|
139
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
exports.MediasQuery = MediasQuery;
|
|
@@ -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.NotificationsQuery = void 0;
|
|
13
|
-
const APIWrapper_1 = require("../../../../base/APIWrapper");
|
|
14
|
-
const RequestHandler_1 = require("../../../../base/RequestHandler");
|
|
15
|
-
const Notification_1 = require("../../interfaces/responses/query/Notification");
|
|
16
|
-
const Type_1 = require("../../types/Type");
|
|
17
|
-
const ValidateVariables_1 = require("../../../../base/ValidateVariables");
|
|
18
|
-
/**
|
|
19
|
-
* `NotificationsQuery` is a class representing a query for notifications.
|
|
20
|
-
* It includes a method to get notifications.
|
|
21
|
-
*/
|
|
22
|
-
class NotificationsQuery extends APIWrapper_1.APIWrapper {
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new `NotificationsQuery` 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
|
-
* `notifications` is a method that sends a query request to get notifications.
|
|
34
|
-
*
|
|
35
|
-
* @param variables - The variables for the query.
|
|
36
|
-
* @returns The response from the query request.
|
|
37
|
-
*/
|
|
38
|
-
notifications(variables) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!variables) {
|
|
41
|
-
throw new Error('At least one variable must be set');
|
|
42
|
-
}
|
|
43
|
-
const variableTypeMappings = {
|
|
44
|
-
page: 'number',
|
|
45
|
-
perPage: 'number',
|
|
46
|
-
type: Type_1.NotificationTypeMappings,
|
|
47
|
-
resetNotificationCount: 'boolean',
|
|
48
|
-
type_in: Type_1.NotificationTypeMappings,
|
|
49
|
-
asHtml: 'boolean'
|
|
50
|
-
};
|
|
51
|
-
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
52
|
-
const query = `
|
|
53
|
-
query ($page: Int, $perPage: Int, $type: NotificationType, $resetNotificationCount: Boolean, $type_in: [NotificationType], $asHtml: Boolean) {
|
|
54
|
-
Page (page: $page, perPage: $perPage) {
|
|
55
|
-
pageInfo {
|
|
56
|
-
total
|
|
57
|
-
perPage
|
|
58
|
-
currentPage
|
|
59
|
-
lastPage
|
|
60
|
-
hasNextPage
|
|
61
|
-
}
|
|
62
|
-
notifications (type: $type, resetNotificationCount: $resetNotificationCount, type_in: $type_in) {
|
|
63
|
-
${Notification_1.NotificationSchema}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
68
|
-
const data = { query, variables };
|
|
69
|
-
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.NotificationsQuery = NotificationsQuery;
|