pub struct MangaDexClient {
pub http_client: HttpClientRef,
}
Expand description
API client to make requests to the MangaDex v5 API.
Fields§
§http_client: HttpClientRef
Implementations§
Source§impl MangaDexClient
impl MangaDexClient
Sourcepub fn new(client: Client) -> Self
pub fn new(client: Client) -> Self
Create a new MangaDexClient
with a custom reqwest::Client
.
§Examples
use reqwest::Client;
use mangadex_api::v5::MangaDexClient;
let reqwest_client = Client::builder()
.timeout(std::time::Duration::from_secs(10))
.build()?;
let client = MangaDexClient::new(reqwest_client);
Sourcepub fn new_with_http_client_ref(http_client: HttpClientRef) -> Self
pub fn new_with_http_client_ref(http_client: HttpClientRef) -> Self
Create a new MangaDexClient
with a custom client reference
Sourcepub fn new_with_http_client(http_client: HttpClient) -> Self
pub fn new_with_http_client(http_client: HttpClient) -> Self
Create a new MangaDexClient
with a custom HttpClient
.
In most cases, providing a custom HttpClient
isn’t necessary.
This function is primarily useful for mock testing but is available for anyone that needs to
change the base URL if it changes due to an unforeseen event.
§Examples
use reqwest::Client;
use url::Url;
use mangadex_api::v5::MangaDexClient;
use mangadex_api::HttpClient;
let reqwest_client = Client::builder()
.timeout(std::time::Duration::from_secs(10))
.build()?;
let http_client = HttpClient::builder()
.client(reqwest_client)
.base_url(Url::parse("127.0.0.1:8080")?)
.build()?;
let client = MangaDexClient::new_with_http_client(http_client);
Sourcepub fn get_http_client(&self) -> HttpClientRef
pub fn get_http_client(&self) -> HttpClientRef
Return the Reqwest Client
.
This can be used to create manual HTTP requests.
Using this is generally not advised as it can provide mutable access to the HttpClient
.
pub async fn set_auth_tokens(&mut self, auth_tokens: &AuthTokens) -> Result<()>
pub async fn clear_auth_tokens(&mut self) -> Result<()>
pub async fn get_auth_tokens(&self) -> Result<AuthTokens>
pub async fn set_captcha<A: Into<String>>(&mut self, captcha: A) -> Result<()>
pub async fn get_captcha(&self) -> Result<String>
pub async fn clear_captcha(&mut self) -> Result<()>
pub async fn get_client_info(&self) -> Result<ClientInfo>
oauth
only.Sourcepub fn at_home(&self) -> AtHomeBuilder
pub fn at_home(&self) -> AtHomeBuilder
Get a builder for handling the At-Home endpoints.
Sourcepub fn auth(&self) -> AuthBuilder
pub fn auth(&self) -> AuthBuilder
Get a builder for handling the authentication endpoints.
This builder is deprecated
Get a builder for handling the author endpoints.
Sourcepub fn captcha(&self) -> CaptchaBuilder
pub fn captcha(&self) -> CaptchaBuilder
Get a builder for handling the captcha endpoints.
Sourcepub fn chapter(&self) -> ChapterBuilder
pub fn chapter(&self) -> ChapterBuilder
Get a builder for handling the chapter endpoints.
pub fn client(&self) -> ApiClientEndpoint
Sourcepub fn cover(&self) -> CoverBuilder
pub fn cover(&self) -> CoverBuilder
Get a builder for handling manga volume cover art endpoints.
Sourcepub fn custom_list(&self) -> CustomListBuilder
pub fn custom_list(&self) -> CustomListBuilder
Get a builder for handling the custom list endpoints.
Sourcepub fn feed(&self) -> FeedBuilder
pub fn feed(&self) -> FeedBuilder
Get a builder for handling the feed endpoints.
Sourcepub fn ping(&self) -> PingEndpointBuilder
pub fn ping(&self) -> PingEndpointBuilder
Get a builder for handling the infrastructure endpoints.
Sourcepub fn legacy(&self) -> LegacyBuilder
pub fn legacy(&self) -> LegacyBuilder
Get a builder for handling the legacy endpoints.
Sourcepub fn manga(&self) -> MangaBuilder
pub fn manga(&self) -> MangaBuilder
Get a builder for handling the manga endpoints.
Sourcepub fn rating(&self) -> RatingBuilder
pub fn rating(&self) -> RatingBuilder
Get a builder for handling the rating endpoints.
Sourcepub fn report(&self) -> ReportBuilder
pub fn report(&self) -> ReportBuilder
Get a builder for handling the report endpoints.
Sourcepub fn scanlation_group(&self) -> ScanlationGroupBuilder
pub fn scanlation_group(&self) -> ScanlationGroupBuilder
Get a builder for handling the scanlation group endpoints.
Sourcepub fn search(&self) -> SearchBuilder
pub fn search(&self) -> SearchBuilder
Get a builder for handling the search endpoints.
This is a convenience builder that aggregates search endpoints from various categories.
Sourcepub fn settings(&self) -> SettingsBuilder
pub fn settings(&self) -> SettingsBuilder
Get a builder for handling the settings endpoints.
Sourcepub fn statistics(&self) -> StatisticsBuilder
pub fn statistics(&self) -> StatisticsBuilder
Get a builder for handling the statistics endpoints.
Sourcepub fn upload(&self) -> UploadBuilder
pub fn upload(&self) -> UploadBuilder
Get a builder for handling uploads.
Sourcepub fn user(&self) -> UserBuilder
pub fn user(&self) -> UserBuilder
Get a builder for handling the user endpoints.
Sourcepub fn api_dev_client() -> Self
pub fn api_dev_client() -> Self
This is an api client for
api.mangadex.dev
pub fn forums(&self) -> ForumsEndpoint
pub fn oauth(&self) -> OAuthBuider
oauth
only.Source§impl MangaDexClient
impl MangaDexClient
pub async fn set_client_info(&mut self, client_info: &ClientInfo) -> Result<()>
multi-thread
and non-crate feature tokio-multi-thread
and non-crate feature rw-multi-thread
and crate feature oauth
only.pub async fn clear_client_info(&mut self) -> Result<()>
multi-thread
and non-crate feature tokio-multi-thread
and non-crate feature rw-multi-thread
and crate feature oauth
only.Trait Implementations§
Source§impl Clone for MangaDexClient
impl Clone for MangaDexClient
Source§fn clone(&self) -> MangaDexClient
fn clone(&self) -> MangaDexClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MangaDexClient
impl Debug for MangaDexClient
Source§impl Default for MangaDexClient
impl Default for MangaDexClient
Source§fn default() -> Self
fn default() -> Self
Create a new MangaDexClient
with the default reqwest::Client
settings.
§Examples
use reqwest::Client;
use mangadex_api::v5::MangaDexClient;
let client = MangaDexClient::default();