calne-ca / mal-api-java

MyAnimeList API Java Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java Client for MyAnimeList API (DEPRECATED)

WARNING:

MyAnimeList has disabled their API as of May 2018, therefore this Java implementation doesn't work at the moment!

Usage

Initializing the Client

MALClient client = new MALClient("username","password");

Verify Credentials

try {
    User user = client.verifyCredentials();
    System.out.println("Verified user with id: " + user.getId());
} catch(NotAuthorizedException e) {
    System.err.println("The provided credentials are invalid!");
}

Searching for Anime

List<Anime> animes = client.searchForAnime("Fate Kaleid");
animes.forEach(a -> System.out.println(a.getTitle()))

Searching for Manga

List<Manga> mangas = client.searchForManga("Fate Zero");
mangas.forEach(m -> System.out.println(m.getTitle()))

Fetching AnimeList

AnimeList animeList = client.getAnimeList();
List<AnimeEntry> entries = animeList.getEntries();
entries.forEach(e -> System.out.println(e.getSeriesTitle()))

Fetching MangaList

MangaList mangaList = client.getMangaList();
List<MangaEntry> entries = mangaList.getEntries();
entries.forEach(e -> System.out.println(e.getSeriesTitle()))

Adding Anime to AnimeList

AnimeListEntryValues values = new AnimeListEntryValues();
values.setStatus(AnimeListEntryStatus.WATCHING);
values.setEpisode(3);

client.addToAnimeList(anime,values);

Adding Manga to MangaList

MangaListEntryValues values = new MangaListEntryValues();
values.setStatus(MangaListEntryStatus.READING);
values.setChapter(14);
values.setVolume(1);

client.addToMangaList(manga,values);

Updating AnimeList

AnimeListEntryValues values = AnimeListEntryValues.from(entry);
values.setStatus(AnimeListEntryStatus.COMPLETED);

client.updateAnimeList(entry,values);

Updating MangaList

MangaListEntryValues values = MangaListEntryValues.from(entry);
values.setStatus(MangaListEntryStatus.COMPLETED);

client.updateMangaList(entry,values);

Removing Anime from AnimeList

client.removeFromAnimeList(entry);

Removing Manga from MangaList

client.removeFromMangaList(entry);

Maven Dependency

<dependency>
    <groupId>net.beardbot</groupId>
    <artifactId>mal-api</artifactId>
    <version>1.0.1</version>
</dependency>

About

MyAnimeList API Java Client

License:GNU General Public License v3.0


Languages

Language:Java 100.0%