Struct mangadex_api::v5::MangaDexClient

source ·
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

source

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);
source

pub fn new_with_http_client_ref(http_client: HttpClientRef) -> Self

Create a new MangaDexClient with a custom client reference

source

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);
source

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.

source

pub async fn set_auth_tokens(&mut self, auth_tokens: &AuthTokens) -> Result<()>

source

pub async fn clear_auth_tokens(&mut self) -> Result<()>

source

pub async fn get_auth_tokens(&self) -> Result<AuthTokens>

source

pub async fn set_captcha<A: Into<String>>(&mut self, captcha: A) -> Result<()>

source

pub async fn get_captcha(&self) -> Result<String>

source

pub async fn clear_captcha(&mut self) -> Result<()>

source

pub async fn get_client_info(&self) -> Result<ClientInfo>

source

pub fn at_home(&self) -> AtHomeBuilder

Get a builder for handling the At-Home endpoints.

https://api.mangadex.org/swagger.html#/AtHome

source

pub fn auth(&self) -> AuthBuilder

Get a builder for handling the authentication endpoints.

This builder is deprecated

https://api.mangadex.org/docs/redoc.html#tag/Authentication

source

pub fn author(&self) -> AuthorBuilder

Get a builder for handling the author endpoints.

https://api.mangadex.org/swagger.html#/Author

source

pub fn captcha(&self) -> CaptchaBuilder

Get a builder for handling the captcha endpoints.

https://api.mangadex.org/swagger.html#/Captcha

source

pub fn chapter(&self) -> ChapterBuilder

Get a builder for handling the chapter endpoints.

https://api.mangadex.org/swagger.html#/Chapter

source

pub fn client(&self) -> ApiClientEndpoint

source

pub fn cover(&self) -> CoverBuilder

Get a builder for handling manga volume cover art endpoints.

https://api.mangadex.org/swagger.html#/Cover

source

pub fn custom_list(&self) -> CustomListBuilder

Get a builder for handling the custom list endpoints.

https://api.mangadex.org/swagger.html#/CustomList

source

pub fn feed(&self) -> FeedBuilder

Get a builder for handling the feed endpoints.

https://api.mangadex.org/swagger.html#/Feed

source

pub fn ping(&self) -> PingEndpointBuilder

Get a builder for handling the infrastructure endpoints.

https://api.mangadex.org/swagger.html#/Infrastructure

source

pub fn legacy(&self) -> LegacyBuilder

Get a builder for handling the legacy endpoints.

https://api.mangadex.org/swagger.html#/Legacy

source

pub fn manga(&self) -> MangaBuilder

Get a builder for handling the manga endpoints.

https://api.mangadex.org/swagger.html#/Manga

source

pub fn rating(&self) -> RatingBuilder

Get a builder for handling the rating endpoints.

https://api.mangadex.org/swagger.html#/Rating

source

pub fn report(&self) -> ReportBuilder

Get a builder for handling the report endpoints.

https://api.mangadex.org/swagger.html#/Report

source

pub fn scanlation_group(&self) -> ScanlationGroupBuilder

Get a builder for handling the scanlation group endpoints.

https://api.mangadex.org/swagger.html#/ScanlationGroup

source

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.

source

pub fn settings(&self) -> SettingsBuilder

Get a builder for handling the settings endpoints.

https://api.mangadex.org/swagger.html#/Settings

source

pub fn statistics(&self) -> StatisticsBuilder

Get a builder for handling the statistics endpoints.

https://api.mangadex.org/swagger.html#/Statistics

source

pub fn upload(&self) -> UploadBuilder

Get a builder for handling uploads.

https://api.mangadex.org/swagger.html#/Upload

source

pub fn user(&self) -> UserBuilder

Get a builder for handling the user endpoints.

https://api.mangadex.org/swagger.html#/User

source

pub fn api_dev_client() -> Self

This is an api client for api.mangadex.dev

source

pub fn forums(&self) -> ForumsEndpoint

source

pub fn oauth(&self) -> OAuthBuider

source§

impl MangaDexClient

source

pub async fn set_client_info(&mut self, client_info: &ClientInfo) -> Result<()>

source

pub async fn clear_client_info(&mut self) -> Result<()>

Trait Implementations§

source§

impl Clone for MangaDexClient

source§

fn clone(&self) -> MangaDexClient

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MangaDexClient

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for MangaDexClient

source§

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§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more