Crate mal [] [src]

The purpose of this library is to provide high-level access to the MyAnimeList API. It allows you to add, update, delete, read, and search for anime / manga from a user's list, as well as verify user credentials.

All operations are centered around the MAL struct, as it stores the user credentials required to perform most operations on the API.

Please keep in mind that the API is rate limited to around ~5 requests per minute. If you send too many requests, the caller's IP will be banned for ~1-2 hours and all requests will return a 403 (Forbidden) status code.

Examples

Adding an anime to a user's list:

use mal::MAL;
use mal::list::Status;
use mal::list::anime::AnimeEntry;

// Create a new MAL instance
let mal = MAL::new("username", "password");

// Search for "Toradora" on MyAnimeList
let mut search_results = mal.anime_list().search_for("Toradora").unwrap();

// Use the first result's info
let toradora_info = search_results.swap_remove(0);

// Create a new anime list entry with Toradora's info
let mut entry = AnimeEntry::new(toradora_info);

// Set the entry's watched episodes to 5 and status to watching
entry.values
     .set_watched_episodes(5)
     .set_status(Status::WatchingOrReading);

// Add the entry to the user's anime list
mal.anime_list().add(&mut entry).unwrap();

Updating a manga on a user's list by its ID:

use mal::MAL;
use mal::list::Status;
use mal::list::manga::MangaValues;

// Create a new MAL instance
let mal = MAL::new("username", "password");

// Create new entry values
let mut values = MangaValues::new();

// Set the number of read chapters to 25, read volumes to 2, score to 10, and status to completed
values.set_read_chapters(25)
      .set_read_volumes(2)
      .set_score(10)
      .set_status(Status::Completed);

// Update the entry with an id of 2 (Berserk) on the user's manga list with the specified values
mal.manga_list().update_id(2, &mut values).unwrap();

Retrieving an anime off of a user's list and updating it:

use mal::MAL;
use mal::list::Status;

// Create a new MAL instance
let mal = MAL::new("username", "password");

// Read the user's anime list
let list = mal.anime_list().read().unwrap();

// Find the first series on the user's list that's being watched
let mut entry = list.entries.into_iter().find(|e| {
    e.values.status() == Status::WatchingOrReading
}).unwrap();

// Set the entrie's watched episodes to its total episodes, its score to 10, and status to completed
entry.values
     .set_watched_episodes(entry.series_info.episodes)
     .set_score(10)
     .set_status(Status::Completed);

// Update the entry on the user's anime list with the new values
mal.anime_list().update(&mut entry).unwrap();

Modules

error
list

This module provides generic functionality for adding, updating, deleting, and reading entries from a user's anime / manga list, as well as searching for an anime / manga series.

Structs

MAL

Used to interact with the MyAnimeList API with authorization being handled automatically.