myanimelist-0.1.4 has been yanked.
MyAnimeList Rust Api
A fully typed Rust MyAnimeList api
Currently this has full coverage of the following apis:
- anime
- manga
- user_animelist
- user_mangalist
- user
- forum
The api is fully async, but has a blocking api for those who need sync (use the *_blocking function variants instead).
Please report bugs if you encounter any.
To get api client id and secret - which is required to use this - sign up for an app at https://myanimelist.net/apiconfig
For help understanding this api and how it works, please carefully read mal api docs at https://myanimelist.net/apiconfig/references/api/v2
Rate limiting is unspecified in mal api, but in practice you should do no more than 1 query/s
// if you want to create your token with a scope, add scope before generating a token
client.auth.add_scope;
// this requires a webserver to receive the oauth code+state for regenerate
// set your own custom callback for production usage
client.auth.set_callback;
// regenerate tokens from scratch
client.auth.regenerate.await;
// if you have a refresh key, you can exchange it for an access token
client.auth.refresh_token.await;
// you can automatically try to refresh it if access token expired
// if no refresh token exists, it will regenerate the whole thing
client.auth.try_refresh.await;
// you can also set the access/refresh token manually if you need to
client.auth.set_refresh_token;
client.auth.set_access_token;
// set the time from Instant::now() after which access token expires
client.auth.set_expires_in;
client.auth.set_refresh_expires_in;
// use the api
client.anime.get.list.query.send.await;
// for more information on the api, see their api docs:
// https://myanimelist.net/apiconfig/references/api/v2
//
// this api follows a builder pattern, and follows their api
// it should be relatively intuitive to use
//
// view mal docs to see if your token needs a scope or not,
// and for information on what the routes do