anilink-api-wrapper 1.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/.eslintignore +1 -0
- package/.github/workflows/code_quality.yml +32 -0
- package/.github/workflows/codeql.yml +33 -0
- package/.github/workflows/test.yml +30 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/__tests__/anilist.test.ts +268 -0
- package/babel.config.js +6 -0
- package/dist/AniLink.js +40 -0
- package/dist/apis/anilist/interfaces/ActivityHistory.js +2 -0
- package/dist/apis/anilist/interfaces/CoverImage.js +2 -0
- package/dist/apis/anilist/interfaces/Distribution.js +2 -0
- package/dist/apis/anilist/interfaces/ExternalLink.js +2 -0
- package/dist/apis/anilist/interfaces/Favoured.js +2 -0
- package/dist/apis/anilist/interfaces/FuzzyDate.js +2 -0
- package/dist/apis/anilist/interfaces/Image.js +2 -0
- package/dist/apis/anilist/interfaces/ListScores.js +2 -0
- package/dist/apis/anilist/interfaces/Media.js +2 -0
- package/dist/apis/anilist/interfaces/MediaListEntry.js +2 -0
- package/dist/apis/anilist/interfaces/MediaStatistics.js +2 -0
- package/dist/apis/anilist/interfaces/MediaStats.js +2 -0
- package/dist/apis/anilist/interfaces/Name.js +2 -0
- package/dist/apis/anilist/interfaces/NextAiringEpisode.js +2 -0
- package/dist/apis/anilist/interfaces/Ranking.js +2 -0
- package/dist/apis/anilist/interfaces/ScoreDistribution.js +2 -0
- package/dist/apis/anilist/interfaces/Staff.js +2 -0
- package/dist/apis/anilist/interfaces/Stat.js +2 -0
- package/dist/apis/anilist/interfaces/Statistics.js +2 -0
- package/dist/apis/anilist/interfaces/Stats.js +2 -0
- package/dist/apis/anilist/interfaces/StatusDistribution.js +2 -0
- package/dist/apis/anilist/interfaces/StreamingEpisode.js +2 -0
- package/dist/apis/anilist/interfaces/Studio.js +2 -0
- package/dist/apis/anilist/interfaces/Tag.js +2 -0
- package/dist/apis/anilist/interfaces/Title.js +2 -0
- package/dist/apis/anilist/interfaces/Trailer.js +2 -0
- package/dist/apis/anilist/interfaces/UserStats.js +2 -0
- package/dist/apis/anilist/interfaces/responses/AiringSchedule.js +2 -0
- package/dist/apis/anilist/interfaces/responses/Character.js +2 -0
- package/dist/apis/anilist/interfaces/responses/Media.js +2 -0
- package/dist/apis/anilist/interfaces/responses/MediaList.js +2 -0
- package/dist/apis/anilist/interfaces/responses/MediaListCollectionResponse.js +2 -0
- package/dist/apis/anilist/interfaces/responses/MediaTrend.js +2 -0
- package/dist/apis/anilist/interfaces/responses/Staff.js +2 -0
- package/dist/apis/anilist/interfaces/responses/User.js +2 -0
- package/dist/apis/anilist/mutation/UpdateUser.js +82 -0
- package/dist/apis/anilist/query/AiringSchedule.js +147 -0
- package/dist/apis/anilist/query/Character.js +69 -0
- package/dist/apis/anilist/query/Media.js +232 -0
- package/dist/apis/anilist/query/MediaList.js +170 -0
- package/dist/apis/anilist/query/MediaListCollection.js +650 -0
- package/dist/apis/anilist/query/MediaTrend.js +149 -0
- package/dist/apis/anilist/query/Staff.js +108 -0
- package/dist/apis/anilist/query/User.js +573 -0
- package/dist/base/APIWrapper.js +9 -0
- package/dist/base/RequestHandler.js +33 -0
- package/jest.config.js +11 -0
- package/package.json +31 -0
- package/src/AniLink.ts +80 -0
- package/src/apis/anilist/interfaces/ActivityHistory.ts +5 -0
- package/src/apis/anilist/interfaces/CoverImage.ts +6 -0
- package/src/apis/anilist/interfaces/Distribution.ts +4 -0
- package/src/apis/anilist/interfaces/ExternalLink.ts +5 -0
- package/src/apis/anilist/interfaces/Favoured.ts +15 -0
- package/src/apis/anilist/interfaces/FuzzyDate.ts +5 -0
- package/src/apis/anilist/interfaces/Image.ts +4 -0
- package/src/apis/anilist/interfaces/ListScores.ts +4 -0
- package/src/apis/anilist/interfaces/Media.ts +59 -0
- package/src/apis/anilist/interfaces/MediaListEntry.ts +4 -0
- package/src/apis/anilist/interfaces/MediaStatistics.ts +23 -0
- package/src/apis/anilist/interfaces/MediaStats.ts +7 -0
- package/src/apis/anilist/interfaces/Name.ts +8 -0
- package/src/apis/anilist/interfaces/NextAiringEpisode.ts +5 -0
- package/src/apis/anilist/interfaces/Ranking.ts +10 -0
- package/src/apis/anilist/interfaces/ScoreDistribution.ts +4 -0
- package/src/apis/anilist/interfaces/Staff.ts +6 -0
- package/src/apis/anilist/interfaces/Stat.ts +24 -0
- package/src/apis/anilist/interfaces/Statistics.ts +6 -0
- package/src/apis/anilist/interfaces/StatusDistribution.ts +4 -0
- package/src/apis/anilist/interfaces/StreamingEpisode.ts +6 -0
- package/src/apis/anilist/interfaces/Studio.ts +4 -0
- package/src/apis/anilist/interfaces/Tag.ts +10 -0
- package/src/apis/anilist/interfaces/Title.ts +6 -0
- package/src/apis/anilist/interfaces/Trailer.ts +5 -0
- package/src/apis/anilist/interfaces/UserStats.ts +25 -0
- package/src/apis/anilist/interfaces/responses/AiringSchedule.ts +10 -0
- package/src/apis/anilist/interfaces/responses/Character.ts +26 -0
- package/src/apis/anilist/interfaces/responses/Media.ts +118 -0
- package/src/apis/anilist/interfaces/responses/MediaList.ts +24 -0
- package/src/apis/anilist/interfaces/responses/MediaListCollectionResponse.ts +37 -0
- package/src/apis/anilist/interfaces/responses/MediaTrend.ts +13 -0
- package/src/apis/anilist/interfaces/responses/Staff.ts +53 -0
- package/src/apis/anilist/interfaces/responses/User.ts +72 -0
- package/src/apis/anilist/mutation/UpdateUser.ts +162 -0
- package/src/apis/anilist/query/AiringSchedule.ts +160 -0
- package/src/apis/anilist/query/Character.ts +75 -0
- package/src/apis/anilist/query/Media.ts +295 -0
- package/src/apis/anilist/query/MediaList.ts +192 -0
- package/src/apis/anilist/query/MediaListCollection.ts +673 -0
- package/src/apis/anilist/query/MediaTrend.ts +169 -0
- package/src/apis/anilist/query/Staff.ts +122 -0
- package/src/apis/anilist/query/User.ts +567 -0
- package/src/base/APIWrapper.ts +7 -0
- package/src/base/RequestHandler.ts +21 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateUserMutation = void 0;
|
|
13
|
+
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
|
+
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
class UpdateUserMutation extends APIWrapper_1.APIWrapper {
|
|
16
|
+
constructor(authToken) {
|
|
17
|
+
super('https://graphql.anilist.co');
|
|
18
|
+
this.authToken = authToken;
|
|
19
|
+
}
|
|
20
|
+
updateUser(variables) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const mutation = `
|
|
23
|
+
mutation ($about: String, $titleLanguage: UserTitleLanguage, $displayAdultContent: Boolean, $airingNotifications: Boolean, $scoreFormat: ScoreFormat, $rowOrder: String, $profileColor: String, $donatorBadge: String, $notificationOptions: [NotificationOptionInput], $timezone: String, $activityMergeTime: Int, $animeListOptions: MediaListOptionsInput, $mangaListOptions: MediaListOptionsInput, $staffNameLanguage: UserStaffNameLanguage, $restrictMessagesToFollowing: Boolean, $disabledListActivity: [ListActivityOptionInput]) {
|
|
24
|
+
UpdateUser(about: $about, titleLanguage: $titleLanguage, displayAdultContent: $displayAdultContent, airingNotifications: $airingNotifications, scoreFormat: $scoreFormat, rowOrder: $rowOrder, profileColor: $profileColor, donatorBadge: $donatorBadge, notificationOptions: $notificationOptions, timezone: $timezone, activityMergeTime: $activityMergeTime, animeListOptions: $animeListOptions, mangaListOptions: $mangaListOptions, staffNameLanguage: $staffNameLanguage, restrictMessagesToFollowing: $restrictMessagesToFollowing, disabledListActivity: $disabledListActivity) {
|
|
25
|
+
id
|
|
26
|
+
name
|
|
27
|
+
about
|
|
28
|
+
avatar {
|
|
29
|
+
large
|
|
30
|
+
medium
|
|
31
|
+
}
|
|
32
|
+
bannerImage
|
|
33
|
+
isFollowing
|
|
34
|
+
isFollower
|
|
35
|
+
isBlocked
|
|
36
|
+
bans
|
|
37
|
+
options {
|
|
38
|
+
titleLanguage
|
|
39
|
+
displayAdultContent
|
|
40
|
+
airingNotifications
|
|
41
|
+
profileColor
|
|
42
|
+
notificationOptions {
|
|
43
|
+
type
|
|
44
|
+
enabled
|
|
45
|
+
}
|
|
46
|
+
timezone
|
|
47
|
+
activityMergeTime
|
|
48
|
+
staffNameLanguage
|
|
49
|
+
restrictMessagesToFollowing
|
|
50
|
+
}
|
|
51
|
+
mediaListOptions {
|
|
52
|
+
scoreFormat
|
|
53
|
+
rowOrder
|
|
54
|
+
animeList {
|
|
55
|
+
sectionOrder
|
|
56
|
+
customLists
|
|
57
|
+
advancedScoring
|
|
58
|
+
advancedScoringEnabled
|
|
59
|
+
}
|
|
60
|
+
mangaList {
|
|
61
|
+
sectionOrder
|
|
62
|
+
customLists
|
|
63
|
+
advancedScoring
|
|
64
|
+
advancedScoringEnabled
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
unreadNotificationCount
|
|
68
|
+
siteUrl
|
|
69
|
+
donatorTier
|
|
70
|
+
donatorBadge
|
|
71
|
+
moderatorRoles
|
|
72
|
+
createdAt
|
|
73
|
+
updatedAt
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
const data = { query: mutation, variables };
|
|
78
|
+
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.UpdateUserMutation = UpdateUserMutation;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AiringScheduleQuery = void 0;
|
|
13
|
+
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
|
+
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
class AiringScheduleQuery extends APIWrapper_1.APIWrapper {
|
|
16
|
+
constructor(authToken) {
|
|
17
|
+
super('https://graphql.anilist.co');
|
|
18
|
+
this.authToken = authToken;
|
|
19
|
+
}
|
|
20
|
+
airingSchedule(variables) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const query = `
|
|
23
|
+
query ($id: Int, $mediaId: Int, $episode: Int, $airingAt: Int, $notYetAired: Boolean, $id_not: Int, $id_in: [Int], $id_not_in: [Int], $mediaId_not: Int, $mediaId_in: [Int], $mediaId_not_in: [Int], $episode_not: Int, $episode_in: [Int], $episode_not_in: [Int], $episode_greater: Int, $episode_lesser: Int, $airingAt_greater: Int, $airingAt_lesser: Int, $sort: [AiringSort]) {
|
|
24
|
+
AiringSchedule (id: $id, mediaId: $mediaId, episode: $episode, airingAt: $airingAt, notYetAired: $notYetAired, id_not: $id_not, id_in: $id_in, id_not_in: $id_not_in, mediaId_not: $mediaId_not, mediaId_in: $mediaId_in, mediaId_not_in: $mediaId_not_in, episode_not: $episode_not, episode_in: $episode_in, episode_not_in: $episode_not_in, episode_greater: $episode_greater, episode_lesser: $episode_lesser, airingAt_greater: $airingAt_greater, airingAt_lesser: $airingAt_lesser, sort: $sort) {
|
|
25
|
+
id
|
|
26
|
+
airingAt
|
|
27
|
+
timeUntilAiring
|
|
28
|
+
episode
|
|
29
|
+
mediaId
|
|
30
|
+
media {
|
|
31
|
+
id
|
|
32
|
+
idMal
|
|
33
|
+
title {
|
|
34
|
+
romaji
|
|
35
|
+
english
|
|
36
|
+
native
|
|
37
|
+
userPreferred
|
|
38
|
+
}
|
|
39
|
+
type
|
|
40
|
+
format
|
|
41
|
+
status
|
|
42
|
+
description
|
|
43
|
+
startDate {
|
|
44
|
+
year
|
|
45
|
+
month
|
|
46
|
+
day
|
|
47
|
+
}
|
|
48
|
+
endDate {
|
|
49
|
+
year
|
|
50
|
+
month
|
|
51
|
+
day
|
|
52
|
+
}
|
|
53
|
+
season
|
|
54
|
+
seasonYear
|
|
55
|
+
seasonInt
|
|
56
|
+
episodes
|
|
57
|
+
duration
|
|
58
|
+
countryOfOrigin
|
|
59
|
+
isLicensed
|
|
60
|
+
source
|
|
61
|
+
hashtag
|
|
62
|
+
trailer {
|
|
63
|
+
id
|
|
64
|
+
site
|
|
65
|
+
thumbnail
|
|
66
|
+
}
|
|
67
|
+
updatedAt
|
|
68
|
+
coverImage {
|
|
69
|
+
extraLarge
|
|
70
|
+
large
|
|
71
|
+
medium
|
|
72
|
+
color
|
|
73
|
+
}
|
|
74
|
+
bannerImage
|
|
75
|
+
genres
|
|
76
|
+
synonyms
|
|
77
|
+
averageScore
|
|
78
|
+
meanScore
|
|
79
|
+
popularity
|
|
80
|
+
isLocked
|
|
81
|
+
trending
|
|
82
|
+
favourites
|
|
83
|
+
tags {
|
|
84
|
+
id
|
|
85
|
+
name
|
|
86
|
+
description
|
|
87
|
+
rank
|
|
88
|
+
isGeneralSpoiler
|
|
89
|
+
isMediaSpoiler
|
|
90
|
+
isAdult
|
|
91
|
+
}
|
|
92
|
+
isFavourite
|
|
93
|
+
isAdult
|
|
94
|
+
nextAiringEpisode {
|
|
95
|
+
airingAt
|
|
96
|
+
timeUntilAiring
|
|
97
|
+
episode
|
|
98
|
+
}
|
|
99
|
+
externalLinks {
|
|
100
|
+
id
|
|
101
|
+
url
|
|
102
|
+
site
|
|
103
|
+
}
|
|
104
|
+
streamingEpisodes {
|
|
105
|
+
title
|
|
106
|
+
thumbnail
|
|
107
|
+
url
|
|
108
|
+
site
|
|
109
|
+
}
|
|
110
|
+
rankings {
|
|
111
|
+
id
|
|
112
|
+
rank
|
|
113
|
+
type
|
|
114
|
+
format
|
|
115
|
+
year
|
|
116
|
+
season
|
|
117
|
+
allTime
|
|
118
|
+
context
|
|
119
|
+
}
|
|
120
|
+
mediaListEntry {
|
|
121
|
+
id
|
|
122
|
+
status
|
|
123
|
+
}
|
|
124
|
+
stats {
|
|
125
|
+
scoreDistribution {
|
|
126
|
+
score
|
|
127
|
+
amount
|
|
128
|
+
}
|
|
129
|
+
statusDistribution {
|
|
130
|
+
status
|
|
131
|
+
amount
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
siteUrl
|
|
135
|
+
autoCreateForumThread
|
|
136
|
+
isRecommendationBlocked
|
|
137
|
+
modNotes
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
const data = { query, variables };
|
|
143
|
+
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.AiringScheduleQuery = AiringScheduleQuery;
|
|
@@ -0,0 +1,69 @@
|
|
|
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.CharacterQuery = void 0;
|
|
13
|
+
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
|
+
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
class CharacterQuery extends APIWrapper_1.APIWrapper {
|
|
16
|
+
constructor(authToken) {
|
|
17
|
+
super('https://graphql.anilist.co');
|
|
18
|
+
this.authToken = authToken;
|
|
19
|
+
}
|
|
20
|
+
character(variables) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const query = `
|
|
23
|
+
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) {
|
|
24
|
+
Character (id: $id, isBirthday: $isBirthday, search: $search, id_not: $id_not, id_in: $id_in, id_not_in: $id_not_in, sort: $sort) {
|
|
25
|
+
id
|
|
26
|
+
name {
|
|
27
|
+
first
|
|
28
|
+
last
|
|
29
|
+
full
|
|
30
|
+
native
|
|
31
|
+
}
|
|
32
|
+
image {
|
|
33
|
+
large
|
|
34
|
+
medium
|
|
35
|
+
}
|
|
36
|
+
description(asHtml: $asHtml)
|
|
37
|
+
gender
|
|
38
|
+
dateOfBirth {
|
|
39
|
+
year
|
|
40
|
+
month
|
|
41
|
+
day
|
|
42
|
+
}
|
|
43
|
+
age
|
|
44
|
+
bloodType
|
|
45
|
+
isFavourite
|
|
46
|
+
isFavouriteBlocked
|
|
47
|
+
siteUrl
|
|
48
|
+
media(sort: $mediaSort, onList: $mediaOnList, page: $mediaPage, perPage: $mediaPerPage) {
|
|
49
|
+
nodes {
|
|
50
|
+
id
|
|
51
|
+
title {
|
|
52
|
+
romaji
|
|
53
|
+
english
|
|
54
|
+
native
|
|
55
|
+
userPreferred
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
favourites
|
|
60
|
+
modNotes
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
const data = { query, variables };
|
|
65
|
+
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.CharacterQuery = CharacterQuery;
|
|
@@ -0,0 +1,232 @@
|
|
|
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.MediaQuery = void 0;
|
|
13
|
+
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
|
+
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
class MediaQuery extends APIWrapper_1.APIWrapper {
|
|
16
|
+
constructor(authToken) {
|
|
17
|
+
super('https://graphql.anilist.co');
|
|
18
|
+
this.authToken = authToken;
|
|
19
|
+
}
|
|
20
|
+
media(variables) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const query = `
|
|
23
|
+
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]) {
|
|
24
|
+
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) {
|
|
25
|
+
id
|
|
26
|
+
idMal
|
|
27
|
+
title {
|
|
28
|
+
romaji
|
|
29
|
+
english
|
|
30
|
+
native
|
|
31
|
+
userPreferred
|
|
32
|
+
}
|
|
33
|
+
type
|
|
34
|
+
format
|
|
35
|
+
status
|
|
36
|
+
description
|
|
37
|
+
startDate {
|
|
38
|
+
year
|
|
39
|
+
month
|
|
40
|
+
day
|
|
41
|
+
}
|
|
42
|
+
endDate {
|
|
43
|
+
year
|
|
44
|
+
month
|
|
45
|
+
day
|
|
46
|
+
}
|
|
47
|
+
season
|
|
48
|
+
seasonYear
|
|
49
|
+
seasonInt
|
|
50
|
+
${(variables === null || variables === void 0 ? void 0 : variables.type) === 'ANIME' ? 'episodes\nduration' : 'chapters\nvolumes'}
|
|
51
|
+
countryOfOrigin
|
|
52
|
+
isLicensed
|
|
53
|
+
source
|
|
54
|
+
hashtag
|
|
55
|
+
trailer {
|
|
56
|
+
id
|
|
57
|
+
site
|
|
58
|
+
thumbnail
|
|
59
|
+
}
|
|
60
|
+
updatedAt
|
|
61
|
+
coverImage {
|
|
62
|
+
extraLarge
|
|
63
|
+
large
|
|
64
|
+
medium
|
|
65
|
+
color
|
|
66
|
+
}
|
|
67
|
+
bannerImage
|
|
68
|
+
genres
|
|
69
|
+
synonyms
|
|
70
|
+
averageScore
|
|
71
|
+
meanScore
|
|
72
|
+
popularity
|
|
73
|
+
isLocked
|
|
74
|
+
trending
|
|
75
|
+
favourites
|
|
76
|
+
tags {
|
|
77
|
+
id
|
|
78
|
+
name
|
|
79
|
+
description
|
|
80
|
+
rank
|
|
81
|
+
isGeneralSpoiler
|
|
82
|
+
isMediaSpoiler
|
|
83
|
+
isAdult
|
|
84
|
+
}
|
|
85
|
+
relations {
|
|
86
|
+
edges {
|
|
87
|
+
relationType
|
|
88
|
+
node {
|
|
89
|
+
id
|
|
90
|
+
title {
|
|
91
|
+
romaji
|
|
92
|
+
english
|
|
93
|
+
native
|
|
94
|
+
userPreferred
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
characters {
|
|
100
|
+
edges {
|
|
101
|
+
id
|
|
102
|
+
role
|
|
103
|
+
name
|
|
104
|
+
voiceActors {
|
|
105
|
+
id
|
|
106
|
+
name {
|
|
107
|
+
first
|
|
108
|
+
last
|
|
109
|
+
full
|
|
110
|
+
native
|
|
111
|
+
}
|
|
112
|
+
image {
|
|
113
|
+
large
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
media {
|
|
117
|
+
id
|
|
118
|
+
title {
|
|
119
|
+
romaji
|
|
120
|
+
english
|
|
121
|
+
native
|
|
122
|
+
userPreferred
|
|
123
|
+
}
|
|
124
|
+
coverImage {
|
|
125
|
+
extraLarge
|
|
126
|
+
large
|
|
127
|
+
medium
|
|
128
|
+
color
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
favouriteOrder
|
|
132
|
+
node {
|
|
133
|
+
id
|
|
134
|
+
name {
|
|
135
|
+
first
|
|
136
|
+
last
|
|
137
|
+
full
|
|
138
|
+
native
|
|
139
|
+
}
|
|
140
|
+
image {
|
|
141
|
+
large
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
staff {
|
|
147
|
+
edges {
|
|
148
|
+
id
|
|
149
|
+
role
|
|
150
|
+
favouriteOrder
|
|
151
|
+
node {
|
|
152
|
+
id
|
|
153
|
+
name {
|
|
154
|
+
first
|
|
155
|
+
last
|
|
156
|
+
full
|
|
157
|
+
native
|
|
158
|
+
}
|
|
159
|
+
image {
|
|
160
|
+
large
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
studios {
|
|
166
|
+
edges {
|
|
167
|
+
id
|
|
168
|
+
isMain
|
|
169
|
+
favouriteOrder
|
|
170
|
+
node {
|
|
171
|
+
id
|
|
172
|
+
name
|
|
173
|
+
isAnimationStudio
|
|
174
|
+
siteUrl
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
isFavourite
|
|
179
|
+
isAdult
|
|
180
|
+
nextAiringEpisode {
|
|
181
|
+
airingAt
|
|
182
|
+
timeUntilAiring
|
|
183
|
+
episode
|
|
184
|
+
}
|
|
185
|
+
externalLinks {
|
|
186
|
+
id
|
|
187
|
+
url
|
|
188
|
+
site
|
|
189
|
+
}
|
|
190
|
+
streamingEpisodes {
|
|
191
|
+
title
|
|
192
|
+
thumbnail
|
|
193
|
+
url
|
|
194
|
+
site
|
|
195
|
+
}
|
|
196
|
+
rankings {
|
|
197
|
+
id
|
|
198
|
+
rank
|
|
199
|
+
type
|
|
200
|
+
format
|
|
201
|
+
year
|
|
202
|
+
season
|
|
203
|
+
allTime
|
|
204
|
+
context
|
|
205
|
+
}
|
|
206
|
+
mediaListEntry {
|
|
207
|
+
id
|
|
208
|
+
status
|
|
209
|
+
}
|
|
210
|
+
stats {
|
|
211
|
+
scoreDistribution {
|
|
212
|
+
score
|
|
213
|
+
amount
|
|
214
|
+
}
|
|
215
|
+
statusDistribution {
|
|
216
|
+
status
|
|
217
|
+
amount
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
siteUrl
|
|
221
|
+
autoCreateForumThread
|
|
222
|
+
isRecommendationBlocked
|
|
223
|
+
modNotes
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
`;
|
|
227
|
+
const data = { query, variables };
|
|
228
|
+
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.MediaQuery = MediaQuery;
|
|
@@ -0,0 +1,170 @@
|
|
|
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.MediaListQuery = void 0;
|
|
13
|
+
const APIWrapper_1 = require("../../../base/APIWrapper");
|
|
14
|
+
const RequestHandler_1 = require("../../../base/RequestHandler");
|
|
15
|
+
class MediaListQuery extends APIWrapper_1.APIWrapper {
|
|
16
|
+
constructor(authToken) {
|
|
17
|
+
super('https://graphql.anilist.co');
|
|
18
|
+
this.authToken = authToken;
|
|
19
|
+
}
|
|
20
|
+
mediaList(variables) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const query = `
|
|
23
|
+
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) {
|
|
24
|
+
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) {
|
|
25
|
+
id
|
|
26
|
+
userId
|
|
27
|
+
mediaId
|
|
28
|
+
status
|
|
29
|
+
score (format: $ScoreFormat)
|
|
30
|
+
progress
|
|
31
|
+
progressVolumes
|
|
32
|
+
repeat
|
|
33
|
+
priority
|
|
34
|
+
private
|
|
35
|
+
notes
|
|
36
|
+
hiddenFromStatusLists
|
|
37
|
+
customLists (asArray: $asArray)
|
|
38
|
+
advancedScores
|
|
39
|
+
startedAt {
|
|
40
|
+
year
|
|
41
|
+
month
|
|
42
|
+
day
|
|
43
|
+
}
|
|
44
|
+
completedAt {
|
|
45
|
+
year
|
|
46
|
+
month
|
|
47
|
+
day
|
|
48
|
+
}
|
|
49
|
+
updatedAt
|
|
50
|
+
createdAt
|
|
51
|
+
media {
|
|
52
|
+
id
|
|
53
|
+
idMal
|
|
54
|
+
title {
|
|
55
|
+
romaji
|
|
56
|
+
english
|
|
57
|
+
native
|
|
58
|
+
userPreferred
|
|
59
|
+
}
|
|
60
|
+
type
|
|
61
|
+
format
|
|
62
|
+
status
|
|
63
|
+
description (asHtml: $asHtml)
|
|
64
|
+
startDate {
|
|
65
|
+
year
|
|
66
|
+
month
|
|
67
|
+
day
|
|
68
|
+
}
|
|
69
|
+
endDate {
|
|
70
|
+
year
|
|
71
|
+
month
|
|
72
|
+
day
|
|
73
|
+
}
|
|
74
|
+
season
|
|
75
|
+
seasonYear
|
|
76
|
+
seasonInt
|
|
77
|
+
episodes
|
|
78
|
+
duration
|
|
79
|
+
chapters
|
|
80
|
+
volumes
|
|
81
|
+
countryOfOrigin
|
|
82
|
+
isLicensed
|
|
83
|
+
source
|
|
84
|
+
hashtag
|
|
85
|
+
trailer {
|
|
86
|
+
id
|
|
87
|
+
site
|
|
88
|
+
thumbnail
|
|
89
|
+
}
|
|
90
|
+
updatedAt
|
|
91
|
+
coverImage {
|
|
92
|
+
extraLarge
|
|
93
|
+
large
|
|
94
|
+
medium
|
|
95
|
+
color
|
|
96
|
+
}
|
|
97
|
+
bannerImage
|
|
98
|
+
genres
|
|
99
|
+
synonyms
|
|
100
|
+
averageScore
|
|
101
|
+
meanScore
|
|
102
|
+
popularity
|
|
103
|
+
isLocked
|
|
104
|
+
trending
|
|
105
|
+
favourites
|
|
106
|
+
tags {
|
|
107
|
+
id
|
|
108
|
+
name
|
|
109
|
+
description
|
|
110
|
+
category
|
|
111
|
+
rank
|
|
112
|
+
isGeneralSpoiler
|
|
113
|
+
isMediaSpoiler
|
|
114
|
+
isAdult
|
|
115
|
+
}
|
|
116
|
+
isFavourite
|
|
117
|
+
isFavouriteBlocked
|
|
118
|
+
isAdult
|
|
119
|
+
nextAiringEpisode {
|
|
120
|
+
id
|
|
121
|
+
airingAt
|
|
122
|
+
timeUntilAiring
|
|
123
|
+
episode
|
|
124
|
+
}
|
|
125
|
+
externalLinks {
|
|
126
|
+
id
|
|
127
|
+
url
|
|
128
|
+
site
|
|
129
|
+
}
|
|
130
|
+
streamingEpisodes {
|
|
131
|
+
title
|
|
132
|
+
thumbnail
|
|
133
|
+
url
|
|
134
|
+
site
|
|
135
|
+
}
|
|
136
|
+
rankings {
|
|
137
|
+
id
|
|
138
|
+
rank
|
|
139
|
+
type
|
|
140
|
+
format
|
|
141
|
+
year
|
|
142
|
+
season
|
|
143
|
+
allTime
|
|
144
|
+
context
|
|
145
|
+
}
|
|
146
|
+
stats {
|
|
147
|
+
scoreDistribution {
|
|
148
|
+
score
|
|
149
|
+
amount
|
|
150
|
+
}
|
|
151
|
+
statusDistribution {
|
|
152
|
+
status
|
|
153
|
+
amount
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
siteUrl
|
|
157
|
+
autoCreateForumThread
|
|
158
|
+
isRecommendationBlocked
|
|
159
|
+
isReviewBlocked
|
|
160
|
+
modNotes
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`;
|
|
165
|
+
const data = { query, variables };
|
|
166
|
+
return yield (0, RequestHandler_1.sendRequest)(this.baseURL, 'POST', data, this.authToken);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.MediaListQuery = MediaListQuery;
|