pub struct UserListBuilder { /* private fields */ }Implementations§
Source§impl UserListBuilder
impl UserListBuilder
Sourcepub fn new(username: &str) -> Self
pub fn new(username: &str) -> Self
Takes a MyAnimeList username, and initializes a user’s animelist retriever
Sourcepub fn status(&mut self, status: Status) -> &mut Self
pub fn status(&mut self, status: Status) -> &mut Self
A filter added to UserListBuilder that will tell the run() to filter by the user’s listed status
Sourcepub fn sort(&mut self, sort: Sort) -> &mut Self
pub fn sort(&mut self, sort: Sort) -> &mut Self
A filter added to UserListBuilder that will tell the run() to sort the User’s list
Sourcepub fn limit(&mut self, limit: u32) -> &mut Self
pub fn limit(&mut self, limit: u32) -> &mut Self
A filter added to UserListBuilder that will tell the run() to limit the entries in the User’s list
Sourcepub fn offset(&mut self, offset: u32) -> &mut Self
pub fn offset(&mut self, offset: u32) -> &mut Self
A filter added to UserListBuilder that will tell the run() to offset the starting point of the user’s list.
For example, if the limit is 10 for a first run(), and you want the 10 afterwards, you’d add .offset(10)
Sourcepub fn include_list_status(&mut self) -> &mut Self
pub fn include_list_status(&mut self) -> &mut Self
A field added to UserListBuilder that will tell the run() to add the user’s list details
Sourcepub async fn run(&self) -> Result<MalAnimeSearch, Box<dyn Error>>
pub async fn run(&self) -> Result<MalAnimeSearch, Box<dyn Error>>
Calls the MyAnimeList API to recieve a user’s animelist created by the builder, based on the username,
and fields added from the other methods.
The user does not need to be logged in, aside from using the .add_my_list_status()
to the result. The user searched must also not be private
This method returns a Result, containing either the data in a MalAnimeSearch, or an error.
Example usage:
use mal_query::myanimelist::builders::UserListBuilder;
use mal_query::myanimelist::models::Status;
async fn user_list_builder_example() {
let api = UserListBuilder::new("naginis_api")
.limit(10)
.status(Status::Watching)
.run()
.await;
match api {
Err(_e) => assert!(false),
Ok(data_vec) => assert!(true),
}
}