Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/calne-ca/mal-api-java

MyAnimeList API Java Client
https://github.com/calne-ca/mal-api-java

anime animelist api api-client java java-client mal manga myanimelist myanimelist-api

Last synced: 2 months ago
JSON representation

MyAnimeList API Java Client

Awesome Lists containing this project

README

        

## 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**

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

**Verify Credentials**
```java
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**
```java
List animes = client.searchForAnime("Fate Kaleid");
animes.forEach(a -> System.out.println(a.getTitle()))
```

**Searching for Manga**
```java
List mangas = client.searchForManga("Fate Zero");
mangas.forEach(m -> System.out.println(m.getTitle()))
```

**Fetching AnimeList**
```java
AnimeList animeList = client.getAnimeList();
List entries = animeList.getEntries();
entries.forEach(e -> System.out.println(e.getSeriesTitle()))
```

**Fetching MangaList**
```java
MangaList mangaList = client.getMangaList();
List entries = mangaList.getEntries();
entries.forEach(e -> System.out.println(e.getSeriesTitle()))
```

**Adding Anime to AnimeList**
```java
AnimeListEntryValues values = new AnimeListEntryValues();
values.setStatus(AnimeListEntryStatus.WATCHING);
values.setEpisode(3);

client.addToAnimeList(anime,values);
```

**Adding Manga to MangaList**
```java
MangaListEntryValues values = new MangaListEntryValues();
values.setStatus(MangaListEntryStatus.READING);
values.setChapter(14);
values.setVolume(1);

client.addToMangaList(manga,values);
```

**Updating AnimeList**
```java
AnimeListEntryValues values = AnimeListEntryValues.from(entry);
values.setStatus(AnimeListEntryStatus.COMPLETED);

client.updateAnimeList(entry,values);
```

**Updating MangaList**
```java
MangaListEntryValues values = MangaListEntryValues.from(entry);
values.setStatus(MangaListEntryStatus.COMPLETED);

client.updateMangaList(entry,values);
```

**Removing Anime from AnimeList**
```java
client.removeFromAnimeList(entry);
```

**Removing Manga from MangaList**
```java
client.removeFromMangaList(entry);
```

### Maven Dependency
```xml

net.beardbot
mal-api
1.0.1

```