Struct mal::MAL
[−]
[src]
pub struct MAL<'a> { pub username: String, pub password: String, pub client: Cow<'a, Client>, }
Used to interact with the MyAnimeList API with authorization being handled automatically.
Fields
username: String
The user's name on MyAnimeList.
password: String
The user's password on MyAnimeList.
client: Cow<'a, Client>
The client used to send requests to the API.
Methods
impl<'a> MAL<'a>
[src]
pub fn new<S: Into<String>>(username: S, password: S) -> MAL<'a>
[src]
Creates a new instance of the MAL struct for interacting with the MyAnimeList API. If you only need to retrieve the entries from a user's list, then you do not need to provide a valid password.
This function will create a new reqwest Client
to send requests to MyAnimeList.
If you already have a Client
that you only need to make synchronous requests with
and that will live as long as MAL
, then you should call with_client
instead
with Cow::Borrowed
.
pub fn with_client<S>(
username: S,
password: S,
client: Cow<'a, Client>
) -> MAL<'a> where
S: Into<String>,
[src]
username: S,
password: S,
client: Cow<'a, Client>
) -> MAL<'a> where
S: Into<String>,
Creates a new instance of the MAL struct for interacting with the MyAnimeList API. If you only need to retrieve the entries from a user's list, then you do not need to provide a valid password.
pub fn anime_list(&self) -> List<AnimeEntry>
[src]
Returns a new List
instance to perform anime list operations.
pub fn manga_list(&self) -> List<MangaEntry>
[src]
Returns a new List
instance to perform manga list operations.
pub fn verify_credentials(&self) -> Result<bool, MALError>
[src]
Returns true if the provided account credentials are correct.
Examples
use mal::MAL; // Create a new MAL instance let mal = MAL::new("username", "password"); // Verify that the username and password are valid let valid = mal.verify_credentials().unwrap(); assert_eq!(valid, false);
Trait Implementations
impl<'a> Clone for MAL<'a>
[src]
fn clone(&self) -> MAL<'a>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Debug for MAL<'a>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more