1.2.5 • Published 7 years ago

popura v1.2.5

Weekly downloads
11
License
MIT
Repository
github
Last release
7 years ago

#popura

NodeJS wrapper for MyAnimeList API

npm version Travis CI Build Status Coverage Status XO code style

Popura is a promise-returning wrapper for MAL API.

Table of Contents

Install

$ npm install --save popura

Usage

import popura from 'popura';
const client = popura('YourAwesomeUsername', 'YourHackablePassword');

client.getAnimeList()
  .then(res => console.log(res))
  .catch(err => console.log(err));

API

.getUser()

Return the current user's username.

.setUser(username, password)

Change the current user in this client instance.

.verifyAuth()

Check if this user is valid.

Returns Promise => {id, username}.

.searchAnimes(name) and .searchMangas(name)

Search for an anime or manga title by name.

Returns Promise => Array of Anime Models | Manga Models.

.getAnimeList(username = this.user) and .getMangaList(username = this.user)

Get the animelist or mangalist from an user. If username is empty, returns current user's list.

Returns Promise => {myinfo, list} where myinfo is a Myinfo Model and list is an array of Anime List Item Models | Manga List Item Models.

.addAnime(id, values = {}) and .addManga(id, values = {})

Inserts an anime or manga with id into your list. Optionally you can define values from Anime Models | Manga Models.

Returns Promise => Raw response.body.

.updateAnime(id, values = {}) and updateManga(id, values = {})

Changes values from an anime or manga with id in your list. Define values from Anime Models | Manga Models.

Returns Promise => Raw response.body.

.deleteAnime(id) and deleteManga(id)

Removes an anime or manga with id from your list.

Returns Promise => Raw response.body.

Models

Anime Model

Model used to add/update animes

PropertyTypeNote
episodeint
statusint or string1 / watching, 2 / completed, 3 / onhold, 4 / dropped, 6 / plantowatch
scoreint
storage_typeint
storage_valuefloat
times_rewatchedint
rewatch_valueint
date_startdatemmddyyyy
date_finishdatemmddyyyy
priorityint
enable_discussionint1 = enable, 0 = disable
enable_rewatchingint1 = enable, 0 = disable
commentsstring
fansub_groupstring
tagsarray

Manga Model

Model used to add/update mangas

PropertyTypeNote
chapterint
volumeint
statusint or string1 / reading, 2 / completed, 3 / onhold, 4 / dropped, 6 / plantoread
scoreint
times_rereadint
reread_valueint
date_startdatemmddyyyy
date_finishdatemmddyyyy
priorityint
enable_discussionint1 = enable, 0 = disable
enable_rereadingint1 = enable, 0 = disable
commentsstring
scan_groupstring
tagsarray
retail_volumesint

Anime List Item Model

Model you receive from API when requesting anime list

PropertyTypeNote
series_animedb_idint
series_titlestring
series_synonymsarray
series_typeintTODO: figure out the meaning of these ints
series_episodesint
series_statusintTODO: figure out the meaning of these ints
series_startdatemmddyyyy
series_enddatemmddyyyy
my_idint
my_watched_episodesint
my_start_datedatemmddyyyy
my_finish_datedatemmddyyyy
my_scoreint
my_statusint1 = watching, 2 = completed, 3 = onhold, 4 = dropped, 6 = plantowatch
my_rewatchingint
my_rewatching_epint
my_last_updateddatemmddyyyy
my_tagsarray

Manga List Item Model

Model you receive from API when requesting anime list

PropertyTypeNote
series_mangadb_idint
series_titlestring
series_synonymsarray
series_typeintTODO: figure out the meaning of these ints
series_chaptersint
series_volumesint
series_statusintTODO: figure out the meaning of these ints
series_startdatemmddyyyy
series_enddatemmddyyyy
my_idint
my_read_chaptersint
my_read_volumesint
my_start_datedatemmddyyyy
my_finish_datedatemmddyyyy
my_scoreint
my_statusint1 = reading, 2 = completed, 3 = onhold, 4 = dropped, 6 = plantoread
my_rereadingint
my_rereading_chapint
my_last_updateddatemmddyyyy
my_tagsarray

Myinfo Model

PropertyTypeNote
user_idint
user_namestring
user_watchingintOnly for anime
user_readingintOnly for manga
user_completedint
user_onholdint
user_droppedint
user_plantowatchintOnly for anime
user_plantoreadintOnly for manga
user_days_spent_watchingfloatYes, they use 'watching' for manga too

Development

After clonning this repo, you must copy .env.sample to .env and put your MAL username and password.

In some tests, it'll add, update and remove one anime and one manga from your lists. You can specify these two at .env. Defaults to anime Tachumaru Gekijou (id = 9562) and manga Junshin Miracle 100% (id = 94483), two not so known titles.

License

MIT

1.2.5

7 years ago

1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago