@irfanshadikrishad/anilist 1.0.7 → 1.0.8

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.
@@ -7,14 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import fetch from "node-fetch";
11
10
  import inquirer from "inquirer";
12
- import { aniListEndpoint, getNextSeasonAndYear, getTitle } from "./workers.js";
13
- import { deleteMangaEntryMutation, deleteMediaEntryMutation, popularQuery, trendingQuery, upcomingAnimesQuery, } from "./queries.js";
14
- import { currentUserAnimeList, currentUserMangaList } from "./queries.js";
15
- import { isLoggedIn, currentUsersId, retriveAccessToken } from "./auth.js";
16
- import { addAnimeToListMutation, addMangaToListMutation } from "./mutations.js";
11
+ import fetch from "node-fetch";
12
+ import { currentUsersId, isLoggedIn, retriveAccessToken } from "./auth.js";
17
13
  import { fetcher } from "./fetcher.js";
14
+ import { addAnimeToListMutation, addMangaToListMutation } from "./mutations.js";
15
+ import { currentUserAnimeList, currentUserMangaList, deleteMangaEntryMutation, deleteMediaEntryMutation, popularQuery, trendingQuery, upcomingAnimesQuery, } from "./queries.js";
16
+ import { aniListEndpoint, getNextSeasonAndYear, getTitle } from "./workers.js";
18
17
  function getTrending(count) {
19
18
  return __awaiter(this, void 0, void 0, function* () {
20
19
  var _a, _b, _c, _d;
@@ -175,7 +174,7 @@ function loggedInUsersAnimeLists() {
175
174
  method: "POST",
176
175
  headers: {
177
176
  "content-type": "application/json",
178
- Authorization: `Bearer ${yield retriveAccessToken()}`,
177
+ "Authorization": `Bearer ${yield retriveAccessToken()}`,
179
178
  },
180
179
  body: JSON.stringify({
181
180
  query: currentUserAnimeList,
@@ -285,7 +284,7 @@ function loggedInUsersMangaLists() {
285
284
  method: "POST",
286
285
  headers: {
287
286
  "Content-Type": "application/json",
288
- Authorization: `Bearer ${yield retriveAccessToken()}`,
287
+ "Authorization": `Bearer ${yield retriveAccessToken()}`,
289
288
  },
290
289
  body: JSON.stringify({
291
290
  query: currentUserMangaList,
@@ -348,7 +347,7 @@ function loggedInUsersMangaLists() {
348
347
  method: "POST",
349
348
  headers: {
350
349
  "Content-Type": "application/json",
351
- Authorization: `Bearer ${yield retriveAccessToken()}`,
350
+ "Authorization": `Bearer ${yield retriveAccessToken()}`,
352
351
  },
353
352
  body: JSON.stringify({ query, variables }),
354
353
  });
@@ -400,7 +399,7 @@ function deleteAnimeCollection() {
400
399
  method: "POST",
401
400
  headers: {
402
401
  "content-type": "application/json",
403
- Authorization: `Bearer ${yield retriveAccessToken()}`,
402
+ "Authorization": `Bearer ${yield retriveAccessToken()}`,
404
403
  },
405
404
  body: JSON.stringify({
406
405
  query: currentUserAnimeList,
@@ -463,7 +462,7 @@ function deleteAnimeByAnimeId(id, title) {
463
462
  method: "POST",
464
463
  headers: {
465
464
  "content-type": "application/json",
466
- Authorization: `Bearer ${yield retriveAccessToken()}`,
465
+ "Authorization": `Bearer ${yield retriveAccessToken()}`,
467
466
  },
468
467
  body: JSON.stringify({
469
468
  query: deleteMediaEntryMutation,
@@ -495,7 +494,7 @@ function deleteMangaCollection() {
495
494
  method: "POST",
496
495
  headers: {
497
496
  "content-type": "application/json",
498
- Authorization: `Bearer ${yield retriveAccessToken()}`,
497
+ "Authorization": `Bearer ${yield retriveAccessToken()}`,
499
498
  },
500
499
  body: JSON.stringify({
501
500
  query: currentUserMangaList,
@@ -558,7 +557,7 @@ function deleteMangaByMangaId(id, title) {
558
557
  method: "POST",
559
558
  headers: {
560
559
  "Content-Type": "application/json",
561
- Authorization: `Bearer ${yield retriveAccessToken()}`,
560
+ "Authorization": `Bearer ${yield retriveAccessToken()}`,
562
561
  },
563
562
  body: JSON.stringify({
564
563
  query: deleteMangaEntryMutation,
@@ -642,4 +641,4 @@ function getUpcomingAnimes(count) {
642
641
  }
643
642
  });
644
643
  }
645
- export { getTrending, getPopular, getUpcomingAnimes, loggedInUsersAnimeLists, loggedInUsersMangaLists, deleteAnimeCollection, deleteMangaCollection, };
644
+ export { deleteAnimeCollection, deleteMangaCollection, getPopular, getTrending, getUpcomingAnimes, loggedInUsersAnimeLists, loggedInUsersMangaLists, };
@@ -8,4 +8,4 @@ declare function exportAnimeList(): Promise<void>;
8
8
  declare function exportMangaList(): Promise<void>;
9
9
  declare function importAnimeList(): Promise<void>;
10
10
  declare function importMangaList(): Promise<void>;
11
- export { getUserInfoByUsername, getAnimeDetailsByID, getAnimeSearchResults, getMangaSearchResults, deleteUserActivities, writeTextActivity, exportAnimeList, exportMangaList, importAnimeList, importMangaList, };
11
+ export { deleteUserActivities, exportAnimeList, exportMangaList, getAnimeDetailsByID, getAnimeSearchResults, getMangaSearchResults, getUserInfoByUsername, importAnimeList, importMangaList, writeTextActivity, };
@@ -7,13 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import inquirer from "inquirer";
10
11
  import fetch from "node-fetch";
11
- import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, mangaSearchQuery, userActivityQuery, userQuery, } from "./queries.js";
12
12
  import { currentUsersId, isLoggedIn, retriveAccessToken } from "./auth.js";
13
- import { aniListEndpoint, formatDateObject, getTitle, importAnimeListFromExportedJSON, importMangaListFromExportedJSON, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, } from "./workers.js";
14
13
  import { fetcher } from "./fetcher.js";
15
- import inquirer from "inquirer";
16
14
  import { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveTextActivityMutation, } from "./mutations.js";
15
+ import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, mangaSearchQuery, userActivityQuery, userQuery, } from "./queries.js";
16
+ import { aniListEndpoint, formatDateObject, getTitle, importAnimeListFromExportedJSON, importMangaListFromExportedJSON, MALexport, MALimport, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, } from "./workers.js";
17
17
  function getUserInfoByUsername(username) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
19
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
@@ -320,6 +320,7 @@ function exportAnimeList() {
320
320
  choices: [
321
321
  { name: "CSV", value: 1 },
322
322
  { name: "JSON", value: 2 },
323
+ { name: "XML (MyAnimeList)", value: 3 },
323
324
  ],
324
325
  pageSize: 10,
325
326
  },
@@ -350,6 +351,12 @@ function exportAnimeList() {
350
351
  case 2:
351
352
  yield saveJSONasJSON(mediaWithProgress, "anime");
352
353
  break;
354
+ case 3:
355
+ yield MALexport.Anime();
356
+ break;
357
+ default:
358
+ console.log(`\nInvalid export type. ${exportType}`);
359
+ break;
353
360
  }
354
361
  }
355
362
  else {
@@ -379,6 +386,7 @@ function exportMangaList() {
379
386
  choices: [
380
387
  { name: "CSV", value: 1 },
381
388
  { name: "JSON", value: 2 },
389
+ { name: "XML (MyAnimeList)", value: 3 },
382
390
  ],
383
391
  pageSize: 10,
384
392
  },
@@ -404,6 +412,12 @@ function exportMangaList() {
404
412
  case 2:
405
413
  yield saveJSONasJSON(mediaWithProgress, "manga");
406
414
  break;
415
+ case 3:
416
+ yield MALexport.Manga();
417
+ break;
418
+ default:
419
+ console.log(`\nInvalid export type. ${exportType}`);
420
+ break;
407
421
  }
408
422
  }
409
423
  else {
@@ -427,7 +441,10 @@ function importAnimeList() {
427
441
  type: "list",
428
442
  name: "source",
429
443
  message: "Select a source:",
430
- choices: [{ name: "Exported JSON file.", value: 1 }],
444
+ choices: [
445
+ { name: "Exported JSON file.", value: 1 },
446
+ { name: "MyAnimeList (XML)", value: 2 },
447
+ ],
431
448
  pageSize: 10,
432
449
  },
433
450
  ]);
@@ -435,6 +452,9 @@ function importAnimeList() {
435
452
  case 1:
436
453
  yield importAnimeListFromExportedJSON();
437
454
  break;
455
+ case 2:
456
+ yield MALimport.Anime();
457
+ break;
438
458
  default:
439
459
  console.log(`\nInvalid Choice.`);
440
460
  break;
@@ -453,7 +473,10 @@ function importMangaList() {
453
473
  type: "list",
454
474
  name: "source",
455
475
  message: "Select a source:",
456
- choices: [{ name: "Exported JSON file.", value: 1 }],
476
+ choices: [
477
+ { name: "Exported JSON file.", value: 1 },
478
+ { name: "MyAnimeList (XML)", value: 2 },
479
+ ],
457
480
  pageSize: 10,
458
481
  },
459
482
  ]);
@@ -461,6 +484,9 @@ function importMangaList() {
461
484
  case 1:
462
485
  yield importMangaListFromExportedJSON();
463
486
  break;
487
+ case 2:
488
+ yield MALimport.Manga();
489
+ break;
464
490
  default:
465
491
  console.log(`\nInvalid Choice.`);
466
492
  break;
@@ -471,4 +497,4 @@ function importMangaList() {
471
497
  }
472
498
  });
473
499
  }
474
- export { getUserInfoByUsername, getAnimeDetailsByID, getAnimeSearchResults, getMangaSearchResults, deleteUserActivities, writeTextActivity, exportAnimeList, exportMangaList, importAnimeList, importMangaList, };
500
+ export { deleteUserActivities, exportAnimeList, exportMangaList, getAnimeDetailsByID, getAnimeSearchResults, getMangaSearchResults, getUserInfoByUsername, importAnimeList, importMangaList, writeTextActivity, };
@@ -4,4 +4,4 @@ declare const deleteActivityMutation = "\nmutation($id: Int!) {\n DeleteActivit
4
4
  declare const saveTextActivityMutation = "\nmutation SaveTextActivity($status: String!) {\n SaveTextActivity(text: $status) { id text userId createdAt }\n}\n";
5
5
  declare const saveAnimeWithProgressMutation = "\nmutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {\n SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {\n id progress hiddenFromStatusLists\n }\n}\n";
6
6
  declare const saveMangaWithProgressMutation = "\nmutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {\n SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private\n ) { id progress hiddenFromStatusLists private }\n}\n";
7
- export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveTextActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, };
7
+ export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, };
@@ -1,38 +1,38 @@
1
- const addAnimeToListMutation = `
2
- mutation($mediaId: Int, $status: MediaListStatus) {
3
- SaveMediaListEntry(mediaId: $mediaId, status: $status) { id status }
4
- }
1
+ const addAnimeToListMutation = `
2
+ mutation($mediaId: Int, $status: MediaListStatus) {
3
+ SaveMediaListEntry(mediaId: $mediaId, status: $status) { id status }
4
+ }
5
5
  `;
6
- const addMangaToListMutation = `
7
- mutation($mediaId: Int, $status: MediaListStatus) {
8
- SaveMediaListEntry(mediaId: $mediaId, status: $status) {
9
- id
10
- status
11
- media { id title { romaji english } }
12
- }
13
- }
6
+ const addMangaToListMutation = `
7
+ mutation($mediaId: Int, $status: MediaListStatus) {
8
+ SaveMediaListEntry(mediaId: $mediaId, status: $status) {
9
+ id
10
+ status
11
+ media { id title { romaji english } }
12
+ }
13
+ }
14
14
  `;
15
- const deleteActivityMutation = `
16
- mutation($id: Int!) {
17
- DeleteActivity(id: $id) { deleted }
18
- }
15
+ const deleteActivityMutation = `
16
+ mutation($id: Int!) {
17
+ DeleteActivity(id: $id) { deleted }
18
+ }
19
19
  `;
20
- const saveTextActivityMutation = `
21
- mutation SaveTextActivity($status: String!) {
22
- SaveTextActivity(text: $status) { id text userId createdAt }
23
- }
20
+ const saveTextActivityMutation = `
21
+ mutation SaveTextActivity($status: String!) {
22
+ SaveTextActivity(text: $status) { id text userId createdAt }
23
+ }
24
24
  `;
25
- const saveAnimeWithProgressMutation = `
26
- mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {
27
- SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {
28
- id progress hiddenFromStatusLists
29
- }
30
- }
25
+ const saveAnimeWithProgressMutation = `
26
+ mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {
27
+ SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {
28
+ id progress hiddenFromStatusLists
29
+ }
30
+ }
31
31
  `;
32
- const saveMangaWithProgressMutation = `
33
- mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {
34
- SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private
35
- ) { id progress hiddenFromStatusLists private }
36
- }
32
+ const saveMangaWithProgressMutation = `
33
+ mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {
34
+ SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private
35
+ ) { id progress hiddenFromStatusLists private }
36
+ }
37
37
  `;
38
- export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveTextActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, };
38
+ export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, };
@@ -2,8 +2,8 @@ declare const currentUserQuery = "{\n Viewer {\n id name about bans siteUrl
2
2
  declare const trendingQuery = "query ($page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }\n }\n}";
3
3
  declare const popularQuery = "query ($page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }\n }\n}";
4
4
  declare const userQuery = "query ($username: String) {\n User(name: $username) {\n id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }\n isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }\n statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }\n }\n}";
5
- declare const currentUserAnimeList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: ANIME) {\n lists { name entries { id progress hiddenFromStatusLists status media { id title { romaji english } status episodes siteUrl } } }\n }\n}\n";
6
- declare const currentUserMangaList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: MANGA) {\n lists { name entries { id progress hiddenFromStatusLists private status media { id title { romaji english } status chapters } } }\n }\n}\n";
5
+ declare const currentUserAnimeList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: ANIME) {\n lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english } status episodes siteUrl } } }\n }\n}\n";
6
+ declare const currentUserMangaList = "query ($id: Int) {\n MediaListCollection(userId: $id, type: MANGA) {\n lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english } status chapters } } }\n }\n}\n";
7
7
  declare const deleteMediaEntryMutation = "mutation($id: Int!) {\n DeleteMediaListEntry(id: $id) { deleted }\n}";
8
8
  declare const deleteMangaEntryMutation = "mutation($id: Int) {\n DeleteMediaListEntry(id: $id) { deleted }\n}";
9
9
  declare const upcomingAnimesQuery = "query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {\n Page(perPage: $perPage) {\n media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {\n id title { romaji english native userPreferred } season seasonYear startDate { year month day }\n episodes description genres\n }\n }\n}";
@@ -17,4 +17,6 @@ declare const activityMangaListQuery = "query ($userId: Int, $page: Int, $perPag
17
17
  declare const activityMessageQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {\n ... on MessageActivity { id type message recipient { id name } createdAt }\n }\n }\n}";
18
18
  declare const activityAllQuery = "query ($userId: Int, $page: Int, $perPage: Int) {\n Page(page: $page, perPage: $perPage) {\n activities(userId: $userId, sort: ID_DESC) {\n ... on TextActivity { id type text createdAt user { id name } }\n ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }\n ... on MessageActivity { id type message recipient { id name } createdAt }\n }\n }\n}";
19
19
  declare const activityMediaList = "query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {\n Page(page: $page, perPage: $perPage) {\n pageInfo { total currentPage lastPage hasNextPage perPage }\n activities(userId: $userId, type: $type, sort: ID_DESC) {\n ... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }\n }\n }\n}";
20
- export { currentUserQuery, trendingQuery, popularQuery, userQuery, currentUserAnimeList, currentUserMangaList, deleteMediaEntryMutation, deleteMangaEntryMutation, upcomingAnimesQuery, animeDetailsQuery, userActivityQuery, animeSearchQuery, mangaSearchQuery, activityAllQuery, activityMediaList, activityAnimeListQuery, activityMangaListQuery, activityMessageQuery, activityTextQuery, };
20
+ declare const malIdToAnilistAnimeId = "query ($malId: Int) {\n Media(idMal: $malId, type: ANIME) {\n id title { romaji english } } \n}\n";
21
+ declare const malIdToAnilistMangaId = "query ($malId: Int) {\n Media(idMal: $malId, type: MANGA) {\n id title { romaji english } } \n}\n";
22
+ export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userQuery, };
@@ -1,122 +1,132 @@
1
- const currentUserQuery = `{
2
- Viewer {
3
- id name about bans siteUrl options { profileColor timezone activityMergeTime }
4
- donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }
5
- moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }
6
- statistics { anime { count meanScore minutesWatched } manga { count chaptersRead volumesRead } }
7
- mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }
8
- }
9
- }`;
10
- const trendingQuery = `query ($page: Int, $perPage: Int) {
11
- Page(page: $page, perPage: $perPage) {
12
- media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }
13
- }
14
- }`;
15
- const popularQuery = `query ($page: Int, $perPage: Int) {
16
- Page(page: $page, perPage: $perPage) {
17
- media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }
18
- }
19
- }`;
20
- const userQuery = `query ($username: String) {
21
- User(name: $username) {
22
- id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }
23
- isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }
24
- statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }
25
- }
26
- }`;
27
- const currentUserAnimeList = `query ($id: Int) {
28
- MediaListCollection(userId: $id, type: ANIME) {
29
- lists { name entries { id progress hiddenFromStatusLists status media { id title { romaji english } status episodes siteUrl } } }
30
- }
31
- }
1
+ const currentUserQuery = `{
2
+ Viewer {
3
+ id name about bans siteUrl options { profileColor timezone activityMergeTime }
4
+ donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }
5
+ moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }
6
+ statistics { anime { count meanScore minutesWatched } manga { count chaptersRead volumesRead } }
7
+ mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }
8
+ }
9
+ }`;
10
+ const trendingQuery = `query ($page: Int, $perPage: Int) {
11
+ Page(page: $page, perPage: $perPage) {
12
+ media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }
13
+ }
14
+ }`;
15
+ const popularQuery = `query ($page: Int, $perPage: Int) {
16
+ Page(page: $page, perPage: $perPage) {
17
+ media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }
18
+ }
19
+ }`;
20
+ const userQuery = `query ($username: String) {
21
+ User(name: $username) {
22
+ id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }
23
+ isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }
24
+ statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }
25
+ }
26
+ }`;
27
+ const currentUserAnimeList = `query ($id: Int) {
28
+ MediaListCollection(userId: $id, type: ANIME) {
29
+ lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english } status episodes siteUrl } } }
30
+ }
31
+ }
32
32
  `;
33
- const currentUserMangaList = `query ($id: Int) {
34
- MediaListCollection(userId: $id, type: MANGA) {
35
- lists { name entries { id progress hiddenFromStatusLists private status media { id title { romaji english } status chapters } } }
36
- }
37
- }
33
+ const currentUserMangaList = `query ($id: Int) {
34
+ MediaListCollection(userId: $id, type: MANGA) {
35
+ lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english } status chapters } } }
36
+ }
37
+ }
38
38
  `;
39
- const deleteMediaEntryMutation = `mutation($id: Int!) {
40
- DeleteMediaListEntry(id: $id) { deleted }
41
- }`;
42
- const deleteMangaEntryMutation = `mutation($id: Int) {
43
- DeleteMediaListEntry(id: $id) { deleted }
44
- }`;
45
- const upcomingAnimesQuery = `query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {
46
- Page(perPage: $perPage) {
47
- media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {
48
- id title { romaji english native userPreferred } season seasonYear startDate { year month day }
49
- episodes description genres
50
- }
51
- }
52
- }`;
53
- const animeDetailsQuery = `query ($id: Int) {
54
- Media(id: $id) {
55
- id idMal title { romaji english native userPreferred } episodes nextAiringEpisode { id }
56
- duration startDate { year month day } endDate { year month day } countryOfOrigin description isAdult status season format genres siteUrl
57
- stats { scoreDistribution { score amount } statusDistribution { status amount } }
58
- }
59
- }`;
60
- const userActivityQuery = `query ($id: Int, $page: Int, $perPage: Int) {
61
- Page(page: $page, perPage: $perPage) {
62
- activities(userId: $id, type_in: [ANIME_LIST, MANGA_LIST], sort: ID_DESC) {
63
- ... on ListActivity { id status progress createdAt media { id title { romaji english } } }
64
- }
65
- }
66
- }`;
67
- const animeSearchQuery = `query ($search: String, $perPage: Int) {
68
- Page(perPage: $perPage) {
69
- media(search: $search, type: ANIME) { id title { romaji english native userPreferred } episodes status description }
70
- }
71
- }`;
72
- const mangaSearchQuery = `query ($search: String, $perPage: Int) {
73
- Page(perPage: $perPage) {
74
- media(search: $search, type: MANGA) { id title { romaji english native userPreferred } chapters status description }
75
- }
76
- }`;
77
- const activityTextQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
78
- Page(page: $page, perPage: $perPage) {
79
- activities(userId: $userId, type: TEXT, sort: ID_DESC) {
80
- ... on TextActivity { id type text createdAt user { id name } }
81
- }
82
- }
83
- }`;
84
- const activityAnimeListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
85
- Page(page: $page, perPage: $perPage) {
86
- activities(userId: $userId, type: ANIME_LIST, sort: ID_DESC) {
87
- ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
88
- }
89
- }
90
- }`;
91
- const activityMangaListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
92
- Page(page: $page, perPage: $perPage) {
93
- activities(userId: $userId, type: MANGA_LIST, sort: ID_DESC) {
94
- ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
95
- }
96
- }
97
- }`;
98
- const activityMessageQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
99
- Page(page: $page, perPage: $perPage) {
100
- activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {
101
- ... on MessageActivity { id type message recipient { id name } createdAt }
102
- }
103
- }
104
- }`;
105
- const activityAllQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
106
- Page(page: $page, perPage: $perPage) {
107
- activities(userId: $userId, sort: ID_DESC) {
108
- ... on TextActivity { id type text createdAt user { id name } }
109
- ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
110
- ... on MessageActivity { id type message recipient { id name } createdAt }
111
- }
112
- }
113
- }`;
114
- const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {
115
- Page(page: $page, perPage: $perPage) {
116
- pageInfo { total currentPage lastPage hasNextPage perPage }
117
- activities(userId: $userId, type: $type, sort: ID_DESC) {
118
- ... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }
119
- }
120
- }
121
- }`;
122
- export { currentUserQuery, trendingQuery, popularQuery, userQuery, currentUserAnimeList, currentUserMangaList, deleteMediaEntryMutation, deleteMangaEntryMutation, upcomingAnimesQuery, animeDetailsQuery, userActivityQuery, animeSearchQuery, mangaSearchQuery, activityAllQuery, activityMediaList, activityAnimeListQuery, activityMangaListQuery, activityMessageQuery, activityTextQuery, };
39
+ const deleteMediaEntryMutation = `mutation($id: Int!) {
40
+ DeleteMediaListEntry(id: $id) { deleted }
41
+ }`;
42
+ const deleteMangaEntryMutation = `mutation($id: Int) {
43
+ DeleteMediaListEntry(id: $id) { deleted }
44
+ }`;
45
+ const upcomingAnimesQuery = `query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {
46
+ Page(perPage: $perPage) {
47
+ media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {
48
+ id title { romaji english native userPreferred } season seasonYear startDate { year month day }
49
+ episodes description genres
50
+ }
51
+ }
52
+ }`;
53
+ const animeDetailsQuery = `query ($id: Int) {
54
+ Media(id: $id) {
55
+ id idMal title { romaji english native userPreferred } episodes nextAiringEpisode { id }
56
+ duration startDate { year month day } endDate { year month day } countryOfOrigin description isAdult status season format genres siteUrl
57
+ stats { scoreDistribution { score amount } statusDistribution { status amount } }
58
+ }
59
+ }`;
60
+ const userActivityQuery = `query ($id: Int, $page: Int, $perPage: Int) {
61
+ Page(page: $page, perPage: $perPage) {
62
+ activities(userId: $id, type_in: [ANIME_LIST, MANGA_LIST], sort: ID_DESC) {
63
+ ... on ListActivity { id status progress createdAt media { id title { romaji english } } }
64
+ }
65
+ }
66
+ }`;
67
+ const animeSearchQuery = `query ($search: String, $perPage: Int) {
68
+ Page(perPage: $perPage) {
69
+ media(search: $search, type: ANIME) { id title { romaji english native userPreferred } episodes status description }
70
+ }
71
+ }`;
72
+ const mangaSearchQuery = `query ($search: String, $perPage: Int) {
73
+ Page(perPage: $perPage) {
74
+ media(search: $search, type: MANGA) { id title { romaji english native userPreferred } chapters status description }
75
+ }
76
+ }`;
77
+ const activityTextQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
78
+ Page(page: $page, perPage: $perPage) {
79
+ activities(userId: $userId, type: TEXT, sort: ID_DESC) {
80
+ ... on TextActivity { id type text createdAt user { id name } }
81
+ }
82
+ }
83
+ }`;
84
+ const activityAnimeListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
85
+ Page(page: $page, perPage: $perPage) {
86
+ activities(userId: $userId, type: ANIME_LIST, sort: ID_DESC) {
87
+ ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
88
+ }
89
+ }
90
+ }`;
91
+ const activityMangaListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
92
+ Page(page: $page, perPage: $perPage) {
93
+ activities(userId: $userId, type: MANGA_LIST, sort: ID_DESC) {
94
+ ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
95
+ }
96
+ }
97
+ }`;
98
+ const activityMessageQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
99
+ Page(page: $page, perPage: $perPage) {
100
+ activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {
101
+ ... on MessageActivity { id type message recipient { id name } createdAt }
102
+ }
103
+ }
104
+ }`;
105
+ const activityAllQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
106
+ Page(page: $page, perPage: $perPage) {
107
+ activities(userId: $userId, sort: ID_DESC) {
108
+ ... on TextActivity { id type text createdAt user { id name } }
109
+ ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
110
+ ... on MessageActivity { id type message recipient { id name } createdAt }
111
+ }
112
+ }
113
+ }`;
114
+ const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {
115
+ Page(page: $page, perPage: $perPage) {
116
+ pageInfo { total currentPage lastPage hasNextPage perPage }
117
+ activities(userId: $userId, type: $type, sort: ID_DESC) {
118
+ ... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }
119
+ }
120
+ }
121
+ }`;
122
+ const malIdToAnilistAnimeId = `query ($malId: Int) {
123
+ Media(idMal: $malId, type: ANIME) {
124
+ id title { romaji english } }
125
+ }
126
+ `;
127
+ const malIdToAnilistMangaId = `query ($malId: Int) {
128
+ Media(idMal: $malId, type: MANGA) {
129
+ id title { romaji english } }
130
+ }
131
+ `;
132
+ export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userQuery, };