diff --git a/documentation.md b/documentation.md index 0a76c4d..1223e2b 100644 --- a/documentation.md +++ b/documentation.md @@ -91,11 +91,11 @@ Names must be strings and ids must be numbers. - `staff.characters` | An array of ids and the english names of all characters that the staff has voiced (Up to the first 25 on the list.) # Search -- `Anilist.search(type, term, page, amount)` | Searches the database for an anime or manga that resembles the term provided. - Accepted types: anime, manga, character, staff, studio - Term: Search input (ie: Occultic;Nine) - Page: Page number of the search - Amount: Amount of results on the page +- `Anilist.search(type, term, page, amount)` | Searches the database for an anime or manga that resembles the term provided.
+ Accepted types: anime, manga, character, staff, studio
+ Term: Search input (ie: Occultic;Nine)
+ Page: Page number of the search, defaults to 1.
+ Amount: Amount of results on the page, defaults to 5. - `search.pageInfo` | Page object - `pageInfo.total` | Total amount of pages in search - `pageInfo.currentPage` | Current page of the search @@ -110,9 +110,9 @@ Names must be strings and ids must be numbers. # User ## Functions Usernames must be strings and ids must be numbers!
-`Anilist.user.all(username|id)` | All user profile function
-`Anilist.user.stats(username|id)` | User stats function
-`Anilist.user.profile(username|id)` | User profile function
+`Anilist.user.all(username|id)` | All user profile function, grabs both statistics and profile items.
+`Anilist.user.stats(username|id)` | Grabs all statistics for the given user. Contains no profile unique items.
+`Anilist.user.profile(username|id)` | Grabs all profile unique data. Contains no statistics of the user.
## Profile Unique - `profile.id` | User's id @@ -189,13 +189,29 @@ Usernames must be strings and ids must be numbers!
- `list.isCustomList` | Checks if the list is a custom one (not created by default by AniList) - `list.isSplitCompletedList` | Checks if the list is a split completed list ie. if the user chose to have each completed media format in a separate list (toggled in user's settings) - `list.status` | The user's list status ("CURRENT", "PLANNING", "COMPLETED", "PAUSED", "DROPPED", "REPEATING") -- `list.entries` | List of entries in this list, containing the media and related information - - `entry.media` | The media linked to that entry (refer to the `Media` paragraph for all properties) - - `entry.userId` | The user's id +- `list.entries` | List of entries in this list + - `entry.media` | An object containing various media information for the entry. + - `media.id` | The id of the media + - `media.idMAL` | The MAL id of the media + - `media.title` | Media title. Gives four values: romaji, English, native, userPreferred [Requires login for userPreferred] + - `media.description` | Media description + - `media.format` | Format of the media (ie: TV, OVA, Novel) + - `media.tags` | Tags that describes the media. Gives a name and checks if it is a media spoiler for each tag + - `media.startDate` | Official release date of the media + - `media.endDate` | Official end date of the media + - `media.genres` | Media genres + - `media.isFavourite` | [Requires login] Checks if media is on the user's favourites list + - `media.isAdult` | Checks if media is for adult audiences (ie: Hentai) + - `media.synonyms` | Media's alternative titles + - `media.siteUrl` | The media's Anilist page + - `media.duration` | Anime only. General length of an episode + - `media.episodes` | Anime only. Number of episodes + - `media.volumes` | Manga only. Number of volumes + - `media.chapters` | Manga only. Number of chapters. - `entry.status` | The user's status ("CURRENT", "PLANNING", "COMPLETED", "PAUSED", "DROPPED", "REPEATING") for that media - `entry.score` | The user's score for that media - `entry.progress` | The user's progress for that media (episodes for anime, chapters for manga) - - `entry.progressVolumes` | Only if the media is a mange. The user's volume progress for that manga + - `entry.progressVolumes` | Manga media only. The user's volume progress for that manga - `entry.repeat` | The amount of times the user rewatched or read the media - `entry.priority` | The user's priority for that media - `entry.private` | Check if the entry should only be visible to authenticated user diff --git a/lib/fetcher.js b/lib/fetcher.js index 3d1a8e4..8d1b0fd 100644 --- a/lib/fetcher.js +++ b/lib/fetcher.js @@ -55,9 +55,9 @@ async function formatMedia(media) { if (media.airingSchedule) { media.airingSchedule = media.airingSchedule.nodes; } if (media.studios) { media.studios = media.studios.nodes; } + media.recommendations = media.recommendations.nodes; media.relations = media.relations.nodes; media.trends = media.trends.nodes; - media.recommendations = media.recommendations.nodes; if (media.synonyms.length < 1) { media.synonyms = null; } @@ -133,8 +133,7 @@ module.exports = { return json.data.User; } else if (json.data.MediaListCollection) { json.data.MediaListCollection.lists.forEach(list => { - list.entries.map(entry => { - formatMedia(entry.media); + list.entries.map(entry => { //Media does not need to be formated in a list query. entry.dates = { 'startedAt': convertFuzzyDate(entry.startedAt), 'completedAt': convertFuzzyDate(entry.completedAt), diff --git a/lib/lists.js b/lib/lists.js index 7fd25dc..c984da3 100644 --- a/lib/lists.js +++ b/lib/lists.js @@ -17,16 +17,10 @@ module.exports = { var start = variables(user, 'ANIME'); var query = start[1] + `lists { name isCustomList isSplitCompletedList status entries { - media { id idMal title { romaji english native userPreferred } type episodes description format status startDate { year month day } - endDate { year month day } season duration countryOfOrigin isLicensed source hashtag trailer { id site } updatedAt coverImage { large medium } - bannerImage genres synonyms averageScore meanScore popularity trending tags { name isMediaSpoiler } - relations { nodes { id idMal title { english native romaji userPreferred } type format } } - characters { nodes { id name { full } } } staff { nodes { id name { full native } } } studios { nodes { id name } } - isFavourite isAdult nextAiringEpisode { timeUntilAiring airingAt } airingSchedule { nodes { airingAt timeUntilAiring } } - trends { nodes { date trending popularity inProgress } } externalLinks { url } - streamingEpisodes { title thumbnail url site } rankings { id } mediaListEntry { id } - reviews { nodes { id score summary body } } siteUrl autoCreateForumThread modNotes } - userId status score progress repeat priority private notes hiddenFromStatusLists + media { id idMal title { romaji english native userPreferred } + episodes description format startDate { year month day } endDate { year month day } + duration genres synonyms tags { name isMediaSpoiler } isFavourite isAdult siteUrl } + status score progress repeat priority private notes hiddenFromStatusLists advancedScores startedAt { year month day } completedAt { year month day } updatedAt createdAt } } } }`; return send(query, start[0]); }, @@ -41,14 +35,10 @@ module.exports = { var start = variables(user, 'MANGA'); var query = start[1] + `lists { name isCustomList isSplitCompletedList status entries { - media { id idMal title { romaji english native userPreferred } - type description format status startDate { year month day } endDate { year month day } volumes countryOfOrigin isLicensed updatedAt - coverImage { large medium } bannerImage genres synonyms averageScore meanScore siteUrl autoCreateForumThread modNotes - popularity trending tags { name isMediaSpoiler } relations { nodes { id idMal title { english native romaji userPreferred } type format } } - characters { nodes { id name { full } } } staff { nodes { id name { full native } } } isFavourite isAdult - trends { nodes { date trending popularity inProgress } } externalLinks { url } rankings { id } - mediaListEntry { id } reviews { nodes { id score summary body } } } - userId status score progress progressVolumes repeat priority private notes hiddenFromStatusLists + media { id idMal title { romaji english native userPreferred } + volumes chapters description format startDate { year month day } endDate { year month day } + genres synonyms tags { name isMediaSpoiler } isFavourite isAdult siteUrl } + status score progress progressVolumes repeat priority private notes hiddenFromStatusLists advancedScores startedAt { year month day } completedAt { year month day } updatedAt createdAt } } } }`; return send(query, start[0]); } diff --git a/package-lock.json b/package-lock.json index 01adc7f..f3ce339 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "anilist-node", - "version": "1.3.0", + "version": "1.4.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4db78a1..dfb3814 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anilist-node", - "version": "1.3.1", + "version": "1.4.0", "description": "A lightweight Node.js wrapper for the AniList API", "main": "index.js", "scripts": {