Giter VIP home page Giter VIP logo

mal-rs's Introduction

mal-rs Crates.io Documentation

NOTE: Since the MyAnimeList API was suddenly shut down, this library does not currently work. If/when the API is restored, this library will be updated to support it unless the new API does not require a full-scale library to be used. All future development will happen here: https://gitlab.com/Acizza/mal-rs

The purpose of this library is to provide high-level access to the MyAnimeList API.

At the time of writing, all features of the API are implemented, which include:

  • Adding, updating, removing, and reading entries from a user's anime and manga list
  • Searching for anime and manga by name
  • Getting misc. info and statistics from a user's anime and manga list
  • Verifying user credentials

Usage

By default, the library builds with support to work with both anime and manga. If you need to search for / perform operations on both the user's anime and manga list, you can simply add mal as a dependency to your Cargo.toml file:

[dependencies]
mal = "0.8"

If you only need to work with just one type of list, you should use the following feature gates to reduce the final binary size and compilation time:

If you only need to search for anime / work with anime on a user's list, use the anime feature:

[dependencies.mal]
version = "0.8"
default-features = false

features = ["anime"]

If you only need to search for manga / work with manga on a user's list, use the manga feature:

[dependencies.mal]
version = "0.8"
default-features = false

features = ["manga"]

Example

The following will update an existing anime on a user's list:

extern crate mal;

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

fn main() {
    // 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 Toradora in the list entries
    let mut toradora = list
        .entries
        .into_iter()
        .find(|e| e.series_info.id == 4224)
        .unwrap();

    // Set new values for the list entry
    // In this case, the episode count will be updated to 25, the score will be set to 10, and the status will be set to completed
    toradora.values
            .set_watched_episodes(25)
            .set_score(10)
            .set_status(Status::Completed);

    // Update the anime on the user's list
    mal.anime_list().update(&mut toradora).unwrap();
}

For more examples, see the docs on docs.rs.

mal-rs's People

Contributors

acizza avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.