|
1 | | -WORK IN PROGRESS |
| 1 | +## Java Client for MyAnimeList API |
2 | 2 |
|
3 | | -Java implementation of the [documented](https://myanimelist.net/modules.php?go=api) and undocumented API of [MyAnimeList](https://myanimelist.net/). |
| 3 | +### Usage |
| 4 | + |
| 5 | +**Initializing the Client** |
| 6 | + |
| 7 | +```java |
| 8 | +MALClient client = new MALClient("username","password"); |
| 9 | +``` |
| 10 | + |
| 11 | +**Verify Credentials** |
| 12 | +```java |
| 13 | +try { |
| 14 | + User user = client.verifyCredentials(); |
| 15 | + System.out.println("Verified user with id: " + user.getId()); |
| 16 | +} catch(NotAuthorizedException e) { |
| 17 | + System.err.println("The provided credentials are invalid!"); |
| 18 | +} |
| 19 | +``` |
| 20 | + |
| 21 | +**Searching for Anime** |
| 22 | +```java |
| 23 | +List<Anime> animes = client.searchForAnime("Fate Kaleid"); |
| 24 | +animes.forEach(a -> System.out.println(a.getTitle())) |
| 25 | +``` |
| 26 | + |
| 27 | +**Searching for Manga** |
| 28 | +```java |
| 29 | +List<Manga> mangas = client.searchForManga("Fate Zero"); |
| 30 | +mangas.forEach(m -> System.out.println(m.getTitle())) |
| 31 | +``` |
| 32 | + |
| 33 | +**Fetching AnimeList** |
| 34 | +```java |
| 35 | +AnimeList animeList = client.getAnimeList(); |
| 36 | +List<AnimeEntry> entries = animeList.getEntries(); |
| 37 | +entries.forEach(e -> System.out.println(e.getSeriesTitle())) |
| 38 | +``` |
| 39 | + |
| 40 | +**Fetching MangaList** |
| 41 | +```java |
| 42 | +MangaList mangaList = client.getMangaList(); |
| 43 | +List<MangaEntry> entries = mangaList.getEntries(); |
| 44 | +entries.forEach(e -> System.out.println(e.getSeriesTitle())) |
| 45 | +``` |
| 46 | + |
| 47 | +**Adding Anime to AnimeList** |
| 48 | +```java |
| 49 | +AnimeListEntryValues values = new AnimeListEntryValues(); |
| 50 | +values.setStatus(AnimeListEntryStatus.WATCHING); |
| 51 | +values.setEpisode(3); |
| 52 | + |
| 53 | +client.addToAnimeList(anime,values); |
| 54 | +``` |
| 55 | + |
| 56 | +**Adding Manga to MangaList** |
| 57 | +```java |
| 58 | +MangaListEntryValues values = new MangaListEntryValues(); |
| 59 | +values.setStatus(MangaListEntryStatus.READING); |
| 60 | +values.setChapter(14); |
| 61 | +values.setVolume(1); |
| 62 | + |
| 63 | +client.addToMangaList(manga,values); |
| 64 | +``` |
| 65 | + |
| 66 | +**Updating AnimeList** |
| 67 | +```java |
| 68 | +AnimeListEntryValues values = AnimeListEntryValues.from(entry); |
| 69 | +values.setStatus(AnimeListEntryStatus.COMPLETED); |
| 70 | + |
| 71 | +client.updateAnimeList(entry,values); |
| 72 | +``` |
| 73 | + |
| 74 | +**Updating MangaList** |
| 75 | +```java |
| 76 | +MangaListEntryValues values = MangaListEntryValues.from(entry); |
| 77 | +values.setStatus(MangaListEntryStatus.COMPLETED); |
| 78 | + |
| 79 | +client.updateMangaList(entry,values); |
| 80 | +``` |
| 81 | + |
| 82 | +**Removing Anime from AnimeList** |
| 83 | +```java |
| 84 | +client.removeFromAnimeList(entry); |
| 85 | +``` |
| 86 | + |
| 87 | +**Removing Manga from MangaList** |
| 88 | +```java |
| 89 | +client.removeFromMangaList(entry); |
| 90 | +``` |
| 91 | + |
| 92 | +### Maven Dependency |
| 93 | +After first release... |
0 commit comments