pub struct MangaApiClient<State = None> { /* private fields */ }Expand description
The MangaApiClient provides functions for interacting with the various
manga and user mangalist MAL API endpoints. The accessible endpoints
vary depending on if the MangaApiClient was constructed from a
MalClientId or an OauthClient.
Keep in mind that constructing a MangaApiClient from an OauthClient provides more access to the MAL API than from a MalClientId. Check the MAL API documentation to view which endpoints require an OauthClient versus a MalClientId to see which one is most appropriate for your use case.
§Example
ⓘ
use dotenvy;
use mal_api::oauth::MalClientId;
use mal_api::prelude::*;
#[tokio::main]
async fn main() {
dotenvy::dotenv().ok();
let client_id = MalClientId::from_env().unwrap();
let api_client = MangaApiClient::from(&client_id);
let common_fields = mal_api::manga::all_common_fields();
let detail_fields = mal_api::manga::all_detail_fields();
let query = GetMangaList::builder("one")
.fields(&common_fields)
.limit(3)
.build()
.unwrap();
let response = api_client.get_manga_list(&query).await;
if let Ok(response) = response {
println!("Response: {}\n", response);
}
let query = GetMangaDetails::builder(44347)
.fields(&detail_fields)
.build()
.unwrap();
let response = api_client.get_manga_details(&query).await;
if let Ok(response) = response {
println!("Response: {}\n", response);
}
let query = GetMangaRanking::builder(MangaRankingType::All)
.enable_nsfw()
.fields(&common_fields)
.limit(10)
.build()
.unwrap();
let response = api_client.get_manga_ranking(&query).await;
if let Ok(response) = response {
println!("Response: {}\n", response);
}
}Implementations§
Source§impl MangaApiClient<Oauth>
impl MangaApiClient<Oauth>
Sourcepub async fn update_manga_list_status(
&self,
query: &UpdateMyMangaListStatus,
) -> Result<MangaListStatus, MangaApiError>
pub async fn update_manga_list_status( &self, query: &UpdateMyMangaListStatus, ) -> Result<MangaListStatus, MangaApiError>
Update the status of a manga for the OAuth user’s manga list
Correspoonds to the Update my manga list status endpoint
Sourcepub async fn delete_manga_list_item(
&self,
query: &DeleteMyMangaListItem,
) -> Result<(), MangaApiError>
pub async fn delete_manga_list_item( &self, query: &DeleteMyMangaListItem, ) -> Result<(), MangaApiError>
Delete a manga entry from the OAuth user’s manga list
Corresponds to the Delete my manga list item endpoint
Trait Implementations§
Source§impl<State: Clone> Clone for MangaApiClient<State>
impl<State: Clone> Clone for MangaApiClient<State>
Source§fn clone(&self) -> MangaApiClient<State>
fn clone(&self) -> MangaApiClient<State>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<State = None> !RefUnwindSafe for MangaApiClient<State>
impl<State = None> !UnwindSafe for MangaApiClient<State>
impl<State> Freeze for MangaApiClient<State>
impl<State> Send for MangaApiClient<State>where
State: Send,
impl<State> Sync for MangaApiClient<State>where
State: Sync,
impl<State> Unpin for MangaApiClient<State>where
State: Unpin,
impl<State> UnsafeUnpin for MangaApiClient<State>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more