anilink-api-wrapper 1.18.5 → 1.19.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 +7 -1
- package/dist/AniLink.js +1 -1
- package/dist/apis/anilist/mutation/SaveMediaListEntry.js +2 -2
- package/dist/apis/anilist/mutation/UpdateMediaListEntries.js +2 -2
- package/dist/apis/anilist/mutation/UpdateUser.js +2 -2
- package/dist/apis/anilist/query/Activity.js +2 -2
- package/dist/apis/anilist/query/ActivityReply.js +1 -1
- package/dist/apis/anilist/query/AiringSchedule.js +2 -2
- package/dist/apis/anilist/query/AniChartUser.js +3 -0
- package/dist/apis/anilist/query/Character.js +20 -0
- package/dist/apis/anilist/query/ExternalLinkSourceCollection.js +10 -0
- package/dist/apis/anilist/query/Follower.js +14 -0
- package/dist/apis/anilist/query/Following.js +14 -0
- package/dist/apis/anilist/query/Markdown.js +9 -1
- package/dist/apis/anilist/query/Media.js +84 -0
- package/dist/apis/anilist/query/MediaList.js +40 -0
- package/dist/apis/anilist/query/MediaListCollection.js +32 -0
- package/dist/apis/anilist/query/MediaTagCollection.js +7 -0
- package/dist/apis/anilist/query/MediaTrend.js +34 -0
- package/dist/apis/anilist/query/Notification.js +12 -0
- package/dist/apis/anilist/query/Recommendation.js +20 -2
- package/dist/apis/anilist/query/Review.js +14 -0
- package/dist/apis/anilist/query/SiteStatistics.js +28 -0
- package/dist/apis/anilist/query/Staff.js +29 -0
- package/dist/apis/anilist/query/Studio.js +32 -0
- package/dist/apis/anilist/query/Thread.js +18 -0
- package/dist/apis/anilist/query/ThreadComment.js +13 -0
- package/dist/apis/anilist/query/User.js +18 -0
- package/dist/apis/anilist/query/Viewer.js +14 -2
- package/dist/apis/anilist/query/page/Activities.js +38 -0
- package/dist/apis/anilist/query/page/ActivityReplies.js +12 -0
- package/dist/apis/anilist/query/page/AiringSchedules.js +30 -0
- package/dist/apis/anilist/query/page/Characters.js +22 -0
- package/dist/apis/anilist/query/page/Followers.js +16 -0
- package/dist/apis/anilist/query/page/Followings.js +16 -0
- package/dist/apis/anilist/query/page/Likes.js +12 -0
- package/dist/apis/anilist/query/page/MediaLists.js +42 -0
- package/dist/apis/anilist/query/page/MediaTrends.js +36 -0
- package/dist/apis/anilist/query/page/Medias.js +86 -0
- package/dist/apis/anilist/query/page/Notifications.js +14 -0
- package/dist/apis/anilist/query/page/Recommendations.js +20 -0
- package/dist/apis/anilist/query/page/Reviews.js +16 -0
- package/dist/apis/anilist/query/page/Staffs.js +31 -0
- package/dist/apis/anilist/query/page/Studios.js +34 -0
- package/dist/apis/anilist/query/page/ThreadCommments.js +15 -0
- package/dist/apis/anilist/query/page/Threads.js +20 -0
- package/dist/apis/anilist/query/page/Users.js +20 -0
- package/dist/apis/anilist/types/Format.js +30 -0
- package/dist/apis/anilist/types/Season.js +13 -0
- package/dist/apis/anilist/types/Sort.js +240 -1
- package/dist/apis/anilist/types/Source.js +25 -0
- package/dist/apis/anilist/types/Status.js +26 -0
- package/dist/apis/anilist/types/Type.js +44 -0
- package/package.json +1 -1
- package/.eslintrc.js +0 -16
- package/.gitattributes +0 -1
package/README.md
CHANGED
|
@@ -6,12 +6,18 @@ AniLink is a TypeScript library for interacting with the AniList API. It provide
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
To install AniLink, you can use npm
|
|
9
|
+
To install AniLink, you can use npm or yarn.:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npm install anilink-api-wrapper
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
or
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
yarn add anilink-api-wrapper
|
|
19
|
+
```
|
|
20
|
+
|
|
15
21
|
## Initialization
|
|
16
22
|
|
|
17
23
|
### AniList
|
package/dist/AniLink.js
CHANGED
|
@@ -125,7 +125,7 @@ class AniLink {
|
|
|
125
125
|
follower: followerQueryInstance.follower.bind(followerQueryInstance),
|
|
126
126
|
thread: threadQueryInstance.thread.bind(threadQueryInstance),
|
|
127
127
|
threadComment: threadCommentQueryInstance.threadComment.bind(threadCommentQueryInstance),
|
|
128
|
-
recommendation: recommendationQueryInstance.
|
|
128
|
+
recommendation: recommendationQueryInstance.recommendation.bind(recommendationQueryInstance),
|
|
129
129
|
markdown: markdownQueryInstance.markdown.bind(markdownQueryInstance),
|
|
130
130
|
aniChartUser: aniChartUserQueryInstance.aniChartUser.bind(aniChartUserQueryInstance),
|
|
131
131
|
siteStatistics: siteStatisticsQueryInstance.siteStatistics.bind(siteStatisticsQueryInstance),
|
|
@@ -13,9 +13,9 @@ exports.SaveMediaListEntryMutation = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const FuzzyDate_1 = require("../interfaces/FuzzyDate");
|
|
16
|
-
const MediaListStatus_1 = require("../types/MediaListStatus");
|
|
17
16
|
const FuzzyDate_2 = require("../types/FuzzyDate");
|
|
18
17
|
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
18
|
+
const Status_1 = require("../types/Status");
|
|
19
19
|
/**
|
|
20
20
|
* `SaveMediaListEntryMutation` is a class representing a mutation to save a media list entry.
|
|
21
21
|
* It includes a method to save a media list entry.
|
|
@@ -45,7 +45,7 @@ class SaveMediaListEntryMutation extends APIWrapper_1.APIWrapper {
|
|
|
45
45
|
const variableTypeMappings = {
|
|
46
46
|
id: 'number',
|
|
47
47
|
mediaId: 'number',
|
|
48
|
-
status:
|
|
48
|
+
status: Status_1.MediaListStatusMappings,
|
|
49
49
|
score: 'number',
|
|
50
50
|
scoreRaw: 'number',
|
|
51
51
|
progress: 'number',
|
|
@@ -13,9 +13,9 @@ exports.UpdateMediaListEntriesMutation = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const FuzzyDate_1 = require("../interfaces/FuzzyDate");
|
|
16
|
-
const MediaListStatus_1 = require("../types/MediaListStatus");
|
|
17
16
|
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
18
17
|
const FuzzyDate_2 = require("../types/FuzzyDate");
|
|
18
|
+
const Status_1 = require("../types/Status");
|
|
19
19
|
/**
|
|
20
20
|
* `UpdateMediaListEntriesMutation` is a class representing a mutation to update media list entries.
|
|
21
21
|
* It includes a method to update media list entries.
|
|
@@ -43,7 +43,7 @@ class UpdateMediaListEntriesMutation extends APIWrapper_1.APIWrapper {
|
|
|
43
43
|
throw new Error('ids must be an array of at least one number');
|
|
44
44
|
}
|
|
45
45
|
const variableTypeMappings = {
|
|
46
|
-
status:
|
|
46
|
+
status: Status_1.MediaListStatusMappings,
|
|
47
47
|
score: 'number',
|
|
48
48
|
scoreRaw: 'number',
|
|
49
49
|
progress: 'number',
|
|
@@ -12,13 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.UpdateUserMutation = void 0;
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
-
const ScoreFormat_1 = require("../types/ScoreFormat");
|
|
16
15
|
const UserStaffNameLanguage_1 = require("../types/UserStaffNameLanguage");
|
|
17
16
|
const UserTitleLanguage_1 = require("../types/UserTitleLanguage");
|
|
18
17
|
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
19
18
|
const NotificationOptions_1 = require("../types/NotificationOptions");
|
|
20
19
|
const MediaListOptions_1 = require("../types/MediaListOptions");
|
|
21
20
|
const DisabledListActivity_1 = require("../types/DisabledListActivity");
|
|
21
|
+
const Format_1 = require("../types/Format");
|
|
22
22
|
/**
|
|
23
23
|
* `UpdateUserMutation` is a class representing a mutation to update a user.
|
|
24
24
|
* It includes a method to update a user.
|
|
@@ -47,7 +47,7 @@ class UpdateUserMutation extends APIWrapper_1.APIWrapper {
|
|
|
47
47
|
titleLanguage: UserTitleLanguage_1.UserTitleLanguageMapping,
|
|
48
48
|
displayAdultContent: 'boolean',
|
|
49
49
|
airingNotifications: 'boolean',
|
|
50
|
-
scoreFormat:
|
|
50
|
+
scoreFormat: Format_1.ScoreFormatMapping,
|
|
51
51
|
rowOrder: 'string',
|
|
52
52
|
profileColor: 'string',
|
|
53
53
|
donatorBadge: 'string',
|
|
@@ -38,8 +38,8 @@ class ActivityQuery extends APIWrapper_1.APIWrapper {
|
|
|
38
38
|
*/
|
|
39
39
|
activity(variables) {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
if (variables
|
|
42
|
-
throw new Error('
|
|
41
|
+
if (!variables) {
|
|
42
|
+
throw new Error('At least one variable must be set');
|
|
43
43
|
}
|
|
44
44
|
const variableTypeMappings = {
|
|
45
45
|
id: 'number',
|
|
@@ -36,7 +36,7 @@ class ActivityReplyQuery extends APIWrapper_1.APIWrapper {
|
|
|
36
36
|
*/
|
|
37
37
|
activityReply(variables) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
if (variables.id
|
|
39
|
+
if (!variables.id) {
|
|
40
40
|
throw new Error('The id is required');
|
|
41
41
|
}
|
|
42
42
|
const variableTypeMappings = {
|
|
@@ -37,8 +37,8 @@ class AiringScheduleQuery extends APIWrapper_1.APIWrapper {
|
|
|
37
37
|
*/
|
|
38
38
|
airingSchedule(variables) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!variables
|
|
41
|
-
throw new Error('
|
|
40
|
+
if (!variables) {
|
|
41
|
+
throw new Error('At least one variable must be set');
|
|
42
42
|
}
|
|
43
43
|
const variableTypeMappings = {
|
|
44
44
|
id: 'number',
|
|
@@ -26,6 +26,9 @@ class AniChartUserQuery extends APIWrapper_1.APIWrapper {
|
|
|
26
26
|
constructor(authToken) {
|
|
27
27
|
super('https://graphql.anilist.co');
|
|
28
28
|
this.authToken = authToken;
|
|
29
|
+
if (!this.authToken) {
|
|
30
|
+
throw new Error('AniChartUserQuery requires an authentication token. Create a new instance of AniLink and pass the token as an argument.');
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
34
|
* `aniChartUser` is a method that sends a query request to get AniChart users.
|
|
@@ -13,6 +13,8 @@ exports.CharacterQuery = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const Character_1 = require("../interfaces/responses/query/Character");
|
|
16
|
+
const Sort_1 = require("../types/Sort");
|
|
17
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
18
|
/**
|
|
17
19
|
* `CharacterQuery` is a class representing a query for characters.
|
|
18
20
|
* It includes a method to get characters.
|
|
@@ -35,6 +37,24 @@ class CharacterQuery extends APIWrapper_1.APIWrapper {
|
|
|
35
37
|
*/
|
|
36
38
|
character(variables) {
|
|
37
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (!variables) {
|
|
41
|
+
throw new Error('At least one variable must be set');
|
|
42
|
+
}
|
|
43
|
+
const variableTypeMappings = {
|
|
44
|
+
id: 'number',
|
|
45
|
+
isBirthday: 'boolean',
|
|
46
|
+
search: 'string',
|
|
47
|
+
id_not: 'number',
|
|
48
|
+
id_in: 'number[]',
|
|
49
|
+
id_not_in: 'number[]',
|
|
50
|
+
sort: Sort_1.CharacterSortMappings,
|
|
51
|
+
asHtml: 'boolean',
|
|
52
|
+
mediaSort: Sort_1.MediaSortMappings,
|
|
53
|
+
mediaOnList: 'boolean',
|
|
54
|
+
mediaPage: 'number',
|
|
55
|
+
mediaPerPage: 'number'
|
|
56
|
+
};
|
|
57
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
38
58
|
const query = `
|
|
39
59
|
query ($id: Int, $isBirthday: Boolean, $search: String, $id_not: Int, $id_in: [Int], $id_not_in: [Int], $sort: [CharacterSort], $asHtml: Boolean, $mediaSort: [MediaSort], $mediaOnList: Boolean, $mediaPage: Int, $mediaPerPage: Int) {
|
|
40
60
|
Character (id: $id, isBirthday: $isBirthday, search: $search, id_not: $id_not, id_in: $id_in, id_not_in: $id_not_in, sort: $sort) {
|
|
@@ -12,6 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ExternalLinkSourceCollectionQuery = void 0;
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
|
+
const Type_1 = require("../types/Type");
|
|
15
17
|
/**
|
|
16
18
|
* `ExternalLinkSourceCollectionQuery` is a class representing a query for external link source collections.
|
|
17
19
|
* It includes a method to get external link source collections.
|
|
@@ -34,6 +36,14 @@ class ExternalLinkSourceCollectionQuery extends APIWrapper_1.APIWrapper {
|
|
|
34
36
|
*/
|
|
35
37
|
externalLinkSourceCollection() {
|
|
36
38
|
return __awaiter(this, arguments, void 0, function* (variables = {}) {
|
|
39
|
+
const variableTypeMappings = {
|
|
40
|
+
id: 'number',
|
|
41
|
+
type: 'string',
|
|
42
|
+
mediaType: Type_1.MediaTypeMappings
|
|
43
|
+
};
|
|
44
|
+
if (Object(variables).length > 0) {
|
|
45
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
46
|
+
}
|
|
37
47
|
const query = `
|
|
38
48
|
query ($id: Int, $type: ExternalLinkType, $mediaType: ExternalLinkMediaType) {
|
|
39
49
|
ExternalLinkSourceCollection (id: $id, type: $type, mediaType: $mediaType) {
|
|
@@ -13,6 +13,8 @@ exports.FollowerQuery = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const User_1 = require("../interfaces/responses/query/User");
|
|
16
|
+
const Sort_1 = require("../types/Sort");
|
|
17
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
18
|
/**
|
|
17
19
|
* `FollowerQuery` is a class representing a query for followers.
|
|
18
20
|
* It includes a method to get followers.
|
|
@@ -35,6 +37,18 @@ class FollowerQuery extends APIWrapper_1.APIWrapper {
|
|
|
35
37
|
*/
|
|
36
38
|
follower(variables) {
|
|
37
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
|
+
userId: 'number',
|
|
45
|
+
sort: Sort_1.UserSortMappings,
|
|
46
|
+
animeStatLimit: 'number',
|
|
47
|
+
mangaStatLimit: 'number',
|
|
48
|
+
animeStatSort: Sort_1.UserStatisticSortMappings,
|
|
49
|
+
mangaStatSort: Sort_1.UserStatisticSortMappings
|
|
50
|
+
};
|
|
51
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
38
52
|
const query = `
|
|
39
53
|
query ($userId: Int!, $sort: [UserSort], $asHtml: Boolean, $animeStatLimit: Int, $mangaStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatSort: [UserStatisticsSort]) {
|
|
40
54
|
Follower (userId: $userId, sort: $sort) {
|
|
@@ -13,6 +13,8 @@ exports.FollowingQuery = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const User_1 = require("../interfaces/responses/query/User");
|
|
16
|
+
const Sort_1 = require("../types/Sort");
|
|
17
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
18
|
/**
|
|
17
19
|
* `FollowingQuery` is a class representing a query for following users.
|
|
18
20
|
* It includes a method to get following users.
|
|
@@ -35,6 +37,18 @@ class FollowingQuery extends APIWrapper_1.APIWrapper {
|
|
|
35
37
|
*/
|
|
36
38
|
following(variables) {
|
|
37
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
|
+
userId: 'number',
|
|
45
|
+
sort: Sort_1.UserSortMappings,
|
|
46
|
+
animeStatLimit: 'number',
|
|
47
|
+
mangaStatLimit: 'number',
|
|
48
|
+
animeStatSort: Sort_1.UserStatisticSortMappings,
|
|
49
|
+
mangaStatSort: Sort_1.UserStatisticSortMappings
|
|
50
|
+
};
|
|
51
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
38
52
|
const query = `
|
|
39
53
|
query ($userId: Int!, $sort: [UserSort], $asHtml: Boolean, $animeStatLimit: Int, $mangaStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatSort: [UserStatisticsSort]) {
|
|
40
54
|
Following (userId: $userId, sort: $sort) {
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MarkdownQuery = void 0;
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
15
16
|
/**
|
|
16
17
|
* `MarkdownQuery` is a class representing a query for converting markdown text to HTML.
|
|
17
18
|
* It includes a method to send the markdown text and receive the converted HTML.
|
|
@@ -27,13 +28,20 @@ class MarkdownQuery extends APIWrapper_1.APIWrapper {
|
|
|
27
28
|
this.authToken = authToken;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
|
-
* `markdown` is a method that sends a query request to convert
|
|
31
|
+
* `markdown` is a method that sends a query request to convert Markdown text to HTML.
|
|
31
32
|
*
|
|
32
33
|
* @param variables - The variables for the query.
|
|
33
34
|
* @returns The response from the query request.
|
|
34
35
|
*/
|
|
35
36
|
markdown(variables) {
|
|
36
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if (!variables.markdown) {
|
|
39
|
+
throw new Error('Markdown variable is required.');
|
|
40
|
+
}
|
|
41
|
+
const variableTypeMapppings = {
|
|
42
|
+
markdown: 'string'
|
|
43
|
+
};
|
|
44
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMapppings);
|
|
37
45
|
const query = `
|
|
38
46
|
query ($markdown: String!) {
|
|
39
47
|
Markdown (markdown: $markdown) {
|
|
@@ -13,6 +13,14 @@ exports.MediaQuery = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const Media_1 = require("../interfaces/responses/query/Media");
|
|
16
|
+
const FuzzyDate_1 = require("../types/FuzzyDate");
|
|
17
|
+
const Type_1 = require("../types/Type");
|
|
18
|
+
const Season_1 = require("../types/Season");
|
|
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");
|
|
16
24
|
/**
|
|
17
25
|
* `MediaQuery` is a class representing a query for media data.
|
|
18
26
|
* It includes a method to send the media query and receive the response.
|
|
@@ -35,6 +43,82 @@ class MediaQuery extends APIWrapper_1.APIWrapper {
|
|
|
35
43
|
*/
|
|
36
44
|
media(variables) {
|
|
37
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
if (!variables) {
|
|
47
|
+
throw new Error('At least one variable must be set');
|
|
48
|
+
}
|
|
49
|
+
const variableTypeMappings = {
|
|
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);
|
|
38
122
|
const query = `
|
|
39
123
|
query ($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) {
|
|
40
124
|
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) {
|
|
@@ -13,6 +13,12 @@ exports.MediaListQuery = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
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");
|
|
16
22
|
/**
|
|
17
23
|
* `MediaListQuery` is a class representing a query for media list data.
|
|
18
24
|
* It includes a method to send the media list query and receive the response.
|
|
@@ -35,6 +41,40 @@ class MediaListQuery extends APIWrapper_1.APIWrapper {
|
|
|
35
41
|
*/
|
|
36
42
|
mediaList(variables) {
|
|
37
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
|
+
id: 'number',
|
|
49
|
+
userId: 'number',
|
|
50
|
+
userName: 'string',
|
|
51
|
+
type: Type_1.MediaTypeMappings,
|
|
52
|
+
status: Status_1.MediaListStatusMappings,
|
|
53
|
+
mediaId: 'number',
|
|
54
|
+
isFollowing: 'boolean',
|
|
55
|
+
notes: 'string',
|
|
56
|
+
startedAt: FuzzyDate_1.FuzzyDateMappings,
|
|
57
|
+
completedAt: FuzzyDate_1.FuzzyDateMappings,
|
|
58
|
+
compareWithAuthList: 'boolean',
|
|
59
|
+
userId_in: 'number[]',
|
|
60
|
+
status_in: Status_1.MediaListStatusMappings,
|
|
61
|
+
status_not_in: Status_1.MediaListStatusMappings,
|
|
62
|
+
status_not: Status_1.MediaListStatusMappings,
|
|
63
|
+
mediaId_in: 'number[]',
|
|
64
|
+
mediaId_not_in: 'number[]',
|
|
65
|
+
notes_like: 'string',
|
|
66
|
+
startedAt_greater: FuzzyDate_1.FuzzyDateMappings,
|
|
67
|
+
startedAt_lesser: FuzzyDate_1.FuzzyDateMappings,
|
|
68
|
+
startedAt_like: 'string',
|
|
69
|
+
completedAt_greater: FuzzyDate_1.FuzzyDateMappings,
|
|
70
|
+
completedAt_lesser: FuzzyDate_1.FuzzyDateMappings,
|
|
71
|
+
completedAt_like: 'string',
|
|
72
|
+
sort: Sort_1.MediaListSortMappings,
|
|
73
|
+
scoreFormat: Format_1.ScoreFormatMapping,
|
|
74
|
+
asArray: 'boolean',
|
|
75
|
+
asHtml: 'boolean'
|
|
76
|
+
};
|
|
77
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
38
78
|
const query = `
|
|
39
79
|
query ($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) {
|
|
40
80
|
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) {
|
|
@@ -13,6 +13,11 @@ exports.MediaListCollectionQuery = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const MediaListCollectionResponse_1 = require("../interfaces/responses/query/MediaListCollectionResponse");
|
|
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 ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
21
|
/**
|
|
17
22
|
* `MediaListCollectionQuery` is a class representing a query for media list collection data.
|
|
18
23
|
* It includes a method to send the media list collection query and receive the response.
|
|
@@ -35,6 +40,33 @@ class MediaListCollectionQuery extends APIWrapper_1.APIWrapper {
|
|
|
35
40
|
*/
|
|
36
41
|
mediaListCollection(variables) {
|
|
37
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (!variables) {
|
|
44
|
+
throw new Error('At least one variable must be set');
|
|
45
|
+
}
|
|
46
|
+
const variableTypeMappings = {
|
|
47
|
+
userId: 'number',
|
|
48
|
+
userName: 'string',
|
|
49
|
+
type: Type_1.MediaTypeMappings,
|
|
50
|
+
status: 'string',
|
|
51
|
+
notes: 'string',
|
|
52
|
+
startedAt: FuzzyDate_1.FuzzyDateMappings,
|
|
53
|
+
completedAt: FuzzyDate_1.FuzzyDateMappings,
|
|
54
|
+
forceSingleCompletedList: 'boolean',
|
|
55
|
+
chunk: 'number',
|
|
56
|
+
perChunk: 'number',
|
|
57
|
+
status_in: Status_1.MediaListStatusMappings,
|
|
58
|
+
status_not_in: Status_1.MediaListStatusMappings,
|
|
59
|
+
status_not: Status_1.MediaListStatusMappings,
|
|
60
|
+
notes_like: 'string',
|
|
61
|
+
startedAt_greater: FuzzyDate_1.FuzzyDateMappings,
|
|
62
|
+
startedAt_lesser: FuzzyDate_1.FuzzyDateMappings,
|
|
63
|
+
startedAt_like: 'string',
|
|
64
|
+
completedAt_greater: FuzzyDate_1.FuzzyDateMappings,
|
|
65
|
+
completedAt_lesser: FuzzyDate_1.FuzzyDateMappings,
|
|
66
|
+
completedAt_like: 'string',
|
|
67
|
+
sort: Sort_1.MediaListSortMappings
|
|
68
|
+
};
|
|
69
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
38
70
|
const query = MediaListCollectionResponse_1.MediaListCollectionQuerySchema;
|
|
39
71
|
const data = { query, variables };
|
|
40
72
|
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
@@ -13,6 +13,7 @@ exports.MediaTagCollectionQuery = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const Tag_1 = require("../interfaces/Tag");
|
|
16
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
17
|
/**
|
|
17
18
|
* `MediaTagCollectionQuery` is a class representing a query for media tag collection data.
|
|
18
19
|
* It includes a method to send the media tag collection query and receive the response.
|
|
@@ -35,6 +36,12 @@ class MediaTagCollectionQuery extends APIWrapper_1.APIWrapper {
|
|
|
35
36
|
*/
|
|
36
37
|
mediaTagCollection() {
|
|
37
38
|
return __awaiter(this, arguments, void 0, function* (variables = {}) {
|
|
39
|
+
const variableTypeMappings = {
|
|
40
|
+
status: 'number'
|
|
41
|
+
};
|
|
42
|
+
if (Object(variables).length > 0) {
|
|
43
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
44
|
+
}
|
|
38
45
|
const query = `
|
|
39
46
|
query ($status: Int) {
|
|
40
47
|
MediaTagCollection (status: $status) {
|
|
@@ -13,6 +13,8 @@ exports.MediaTrendQuery = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const MediaTrend_1 = require("../interfaces/responses/query/MediaTrend");
|
|
16
|
+
const Sort_1 = require("../types/Sort");
|
|
17
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
18
|
/**
|
|
17
19
|
* `MediaTrendQuery` is a class representing a query for media trend data.
|
|
18
20
|
* It includes a method to send the media trend query and receive the response.
|
|
@@ -35,6 +37,38 @@ class MediaTrendQuery extends APIWrapper_1.APIWrapper {
|
|
|
35
37
|
*/
|
|
36
38
|
mediaTrend(variables) {
|
|
37
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
|
+
mediaId: 'number',
|
|
45
|
+
date: 'number',
|
|
46
|
+
trending: 'number',
|
|
47
|
+
averageScore: 'number',
|
|
48
|
+
popularity: 'number',
|
|
49
|
+
episode: 'number',
|
|
50
|
+
releasing: 'boolean',
|
|
51
|
+
mediaId_not: 'number',
|
|
52
|
+
mediaId_in: 'number[]',
|
|
53
|
+
mediaId_not_in: 'number[]',
|
|
54
|
+
date_greater: 'number',
|
|
55
|
+
date_lesser: 'number',
|
|
56
|
+
trending_greater: 'number',
|
|
57
|
+
trending_lesser: 'number',
|
|
58
|
+
trending_not: 'number',
|
|
59
|
+
averageScore_greater: 'number',
|
|
60
|
+
averageScore_lesser: 'number',
|
|
61
|
+
averageScore_not: 'number',
|
|
62
|
+
popularity_greater: 'number',
|
|
63
|
+
popularity_lesser: 'number',
|
|
64
|
+
popularity_not: 'number',
|
|
65
|
+
episode_greater: 'number',
|
|
66
|
+
episode_lesser: 'number',
|
|
67
|
+
episode_not: 'number',
|
|
68
|
+
sort: Sort_1.MediaTrendSortMappings,
|
|
69
|
+
asHtml: 'boolean'
|
|
70
|
+
};
|
|
71
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
38
72
|
const query = `
|
|
39
73
|
query ($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) {
|
|
40
74
|
MediaTrend (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) {
|
|
@@ -13,6 +13,8 @@ exports.NotificationQuery = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const Notification_1 = require("../interfaces/responses/query/Notification");
|
|
16
|
+
const Type_1 = require("../types/Type");
|
|
17
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
18
|
/**
|
|
17
19
|
* `NotificationQuery` is a class representing a query for notification data.
|
|
18
20
|
* It includes a method to send the notification query and receive the response.
|
|
@@ -35,6 +37,16 @@ class NotificationQuery extends APIWrapper_1.APIWrapper {
|
|
|
35
37
|
*/
|
|
36
38
|
notification(variables) {
|
|
37
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
|
+
type: Type_1.NotificationTypeMappings,
|
|
45
|
+
resetNotificationCount: 'boolean',
|
|
46
|
+
type_in: Type_1.NotificationTypeMappings,
|
|
47
|
+
asHtml: 'boolean'
|
|
48
|
+
};
|
|
49
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
38
50
|
const query = `
|
|
39
51
|
query ($type: NotificationType, $resetNotificationCount: Boolean, $type_in: [NotificationType], $asHtml: Boolean) {
|
|
40
52
|
Notification (type: $type, resetNotificationCount: $resetNotificationCount, type_in: $type_in) {
|
|
@@ -13,6 +13,8 @@ exports.RecommendationQuery = void 0;
|
|
|
13
13
|
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
14
|
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
15
|
const Recommendation_1 = require("../interfaces/responses/query/Recommendation");
|
|
16
|
+
const Sort_1 = require("../types/Sort");
|
|
17
|
+
const ValidateVariables_1 = require("../../../base/ValidateVariables");
|
|
16
18
|
/**
|
|
17
19
|
* `RecommendationQuery` is a class representing a query for recommendation data.
|
|
18
20
|
* It includes a method to send the recommendation query and receive the response.
|
|
@@ -28,13 +30,29 @@ class RecommendationQuery extends APIWrapper_1.APIWrapper {
|
|
|
28
30
|
this.authToken = authToken;
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
|
-
* `
|
|
33
|
+
* `recommendation` is a method that sends a query request to get recommendation data.
|
|
32
34
|
*
|
|
33
35
|
* @param variables - The variables for the query.
|
|
34
36
|
* @returns The response from the query request.
|
|
35
37
|
*/
|
|
36
|
-
|
|
38
|
+
recommendation(variables) {
|
|
37
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (!variables) {
|
|
41
|
+
throw new Error('At least one variable must be set');
|
|
42
|
+
}
|
|
43
|
+
const variableTypeMappings = {
|
|
44
|
+
id: 'number',
|
|
45
|
+
mediaId: 'number',
|
|
46
|
+
mediaRecommendationId: 'number',
|
|
47
|
+
userId: 'number',
|
|
48
|
+
rating: 'number',
|
|
49
|
+
onList: 'boolean',
|
|
50
|
+
rating_greater: 'number',
|
|
51
|
+
rating_lesser: 'number',
|
|
52
|
+
sort: Sort_1.RecommendationSortMappings,
|
|
53
|
+
asHtml: 'boolean'
|
|
54
|
+
};
|
|
55
|
+
(0, ValidateVariables_1.validateVariables)(variables, variableTypeMappings);
|
|
38
56
|
const query = `
|
|
39
57
|
query ($id: Int, $mediaId: Int, $mediaRecommendationId: Int, $userId: Int, $rating: Int, $onList: Boolean, $rating_greater: Int, $rating_lesser: Int, $sort: [RecommendationSort], $asHtml: Boolean) {
|
|
40
58
|
Recommendation (id: $id, mediaId: $mediaId, mediaRecommendationId: $mediaRecommendationId, userId: $userId, rating: $rating, onList: $onList, rating_greater: $rating_greater, rating_lesser: $rating_lesser, sort: $sort) {
|