Struct mangadex_api::v5::MangaDexClient
source · [−]pub struct MangaDexClient {
pub(crate) http_client: HttpClientRef,
}
Expand description
API client to make requests to the MangaDex v5 API.
Fields
http_client: HttpClientRef
Implementations
sourceimpl 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(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
.
sourcepub fn account(&self) -> AccountBuilder
pub fn account(&self) -> AccountBuilder
Get a builder for handling the account endpoints.
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.
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.
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 infrastructure(&self) -> InfrastructureBuilder
pub fn infrastructure(&self) -> InfrastructureBuilder
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.
sourcefn settings(&self) -> SettingsBuilder
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.
Trait Implementations
sourceimpl Clone for MangaDexClient
impl Clone for MangaDexClient
sourcefn clone(&self) -> MangaDexClient
fn clone(&self) -> MangaDexClient
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for MangaDexClient
impl Debug for MangaDexClient
sourceimpl Default for MangaDexClient
impl Default for MangaDexClient
sourcefn 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();
Auto Trait Implementations
impl !RefUnwindSafe for MangaDexClient
impl Send for MangaDexClient
impl Sync for MangaDexClient
impl Unpin for MangaDexClient
impl !UnwindSafe for MangaDexClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more