mangadex_api::v5

Struct 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>

Available on crate feature oauth only.
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

Available on crate feature oauth only.
Source§

impl MangaDexClient

Source

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

Available on non-crate feature multi-thread and non-crate feature tokio-multi-thread and non-crate feature rw-multi-thread and crate feature oauth only.
Source

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

Available on non-crate feature 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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

Source§

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>,

Source§

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>,

Source§

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

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T