@irfanshadikrishad/anilist 1.9.8 → 2.0.0-forbidden.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.
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @param {string} query - The AniList GraphQL query to be executed.
9
9
  * @param {object} variables - An object containing the variables for the query.
10
- * @returns {Promise<T|null>} The response from the API as a JSON object if successful; otherwise, null.
10
+ * @returns {Promise<object|null>} The response from the API as a JSON object if successful; otherwise, null.
11
11
  */
12
- declare function fetcher<T extends object = object>(query: string, variables: object, retryCount?: number): Promise<T | null>;
12
+ declare function fetcher(query: string, variables: object): Promise<object | null>;
13
13
  export { fetcher };
@@ -7,6 +7,7 @@ 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';
10
11
  import { Auth } from './auth.js';
11
12
  import { aniListEndpoint, handleRateLimitRetry } from './workers.js';
12
13
  /**
@@ -18,17 +19,17 @@ import { aniListEndpoint, handleRateLimitRetry } from './workers.js';
18
19
  *
19
20
  * @param {string} query - The AniList GraphQL query to be executed.
20
21
  * @param {object} variables - An object containing the variables for the query.
21
- * @returns {Promise<T|null>} The response from the API as a JSON object if successful; otherwise, null.
22
+ * @returns {Promise<object|null>} The response from the API as a JSON object if successful; otherwise, null.
22
23
  */
23
- function fetcher(query_1, variables_1) {
24
- return __awaiter(this, arguments, void 0, function* (query, variables, retryCount = 0) {
24
+ function fetcher(query, variables) {
25
+ return __awaiter(this, void 0, void 0, function* () {
25
26
  var _a, _b;
26
27
  try {
27
28
  const headers = {
28
29
  'content-type': 'application/json',
29
30
  };
30
31
  const token = (yield Auth.isLoggedIn())
31
- ? yield Auth.RetrieveAccessToken()
32
+ ? yield Auth.RetriveAccessToken()
32
33
  : null;
33
34
  if (token)
34
35
  headers['Authorization'] = `Bearer ${token}`;
@@ -42,8 +43,8 @@ function fetcher(query_1, variables_1) {
42
43
  return response;
43
44
  }
44
45
  else if (request.status === 429) {
45
- yield handleRateLimitRetry(retryCount);
46
- return yield fetcher(query, variables, retryCount + 1);
46
+ yield handleRateLimitRetry(60);
47
+ return yield fetcher(query, variables);
47
48
  }
48
49
  else {
49
50
  console.error(`\n${request.status} ${((_b = (_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) || 'Unknown error'}.`);
@@ -1,30 +1,66 @@
1
1
  declare class AniList {
2
+ /**
3
+ * Prompt the user for a list status (Planning/Watching-Reading/Completed/Paused/Dropped)
4
+ */
5
+ private static promptListType;
6
+ /**
7
+ * Save a media entry to the authenticated user's list, logging the outcome.
8
+ */
9
+ private static saveEntryToList;
10
+ /**
11
+ * Import a previously exported AniList JSON file, saving each entry with
12
+ * progress via the given mutation.
13
+ */
14
+ private static importJSONList;
2
15
  static importAnime(): Promise<void>;
3
16
  static importManga(): Promise<void>;
17
+ /**
18
+ * Prompt for CSV/JSON/XML and dispatch to the matching exporter.
19
+ */
20
+ private static promptExportFormatAndSave;
4
21
  static exportAnime(): Promise<void>;
5
22
  static exportManga(): Promise<void>;
23
+ /**
24
+ * Pick an existing entry from one of the user's own lists and re-save it
25
+ * under a (possibly different) list status.
26
+ */
27
+ private static pickFromMyListAndResave;
6
28
  static MyAnime(): Promise<void>;
7
29
  static MyManga(): Promise<void>;
30
+ /**
31
+ * Page through a media browse query (trending/popular/upcoming), letting the
32
+ * user "see more" or pick an entry to add to one of their lists.
33
+ */
34
+ private static browseAndAddAnime;
8
35
  static getTrendingAnime(count: number): Promise<void>;
9
36
  static getPopularAnime(count: number): Promise<void>;
10
37
  static getUpcomingAnime(count: number): Promise<void>;
11
38
  static getUserByUsername(username: string): Promise<void>;
12
39
  static getAnimeDetailsByID(anilistID: number): Promise<void>;
13
40
  static getMangaDetailsByID(mangaID: number): Promise<void>;
41
+ /**
42
+ * Search AniList and let the user pick a result to add to one of their lists.
43
+ */
44
+ private static searchAndAddToList;
14
45
  static searchAnime(search: string, count: number): Promise<void>;
15
46
  static searchManga(search: string, count: number): Promise<void>;
16
47
  }
17
48
  declare class MyAnimeList {
49
+ /**
50
+ * Import a MyAnimeList export XML file, mapping each entry to its AniList
51
+ * equivalent by MAL id and saving it with progress.
52
+ */
53
+ private static importMALList;
18
54
  static importAnime(): Promise<void>;
19
55
  static importManga(): Promise<void>;
56
+ /**
57
+ * Fetch the authenticated user's anime/manga list and export it as MAL XML.
58
+ */
59
+ private static exportMALList;
20
60
  static exportAnime(): Promise<void>;
21
61
  static exportManga(): Promise<void>;
22
62
  }
23
63
  declare class AniDB {
24
64
  static importAnime(): Promise<void>;
25
65
  }
26
- declare class MoveTo {
27
- static AnimeList(): Promise<void>;
28
- static MangaList(): Promise<void>;
29
- }
30
- export { AniDB, AniList, MoveTo, MyAnimeList };
66
+ export { AniDB, AniList, MyAnimeList };