pub struct HttpClient {
    pub client: Client,
    pub base_url: Url,
    auth_tokens: Option<AuthTokens>,
    captcha: Option<String>,
}

Fields

client: Clientbase_url: Urlauth_tokens: Option<AuthTokens>captcha: Option<String>

Implementations

Create a new HttpClient with a custom reqwest::Client.

Get a builder struct to customize the HttpClient fields.

Examples
use url::Url;

use mangadex_api::{MangaDexClient, HttpClient};

let http_client = HttpClient::builder()
    .base_url(Url::parse("127.0.0.1:8000")?)
    .build()?;

let mangadex_client = MangaDexClient::new_with_http_client(http_client);

Send the request to the endpoint but don’t deserialize the response.

This is useful to handle things such as response header data for more control over areas such as rate limiting.

Send the request to the endpoint and deserialize the response body.

Get the authentication tokens stored in the client.

Set new authentication tokens into the client.

Remove all authentication tokens from the client.

This is effectively the same as logging out, though will not remove the active session from the MangaDex server. Be sure to call the logout endpoint to ensure your session is removed.

Get the captcha solution stored in the client.

Set a new captcha solution into the client.

The code needed for this can be found in the “X-Captcha-Sitekey” header field, or the siteKey parameter in the error context of a 403 response, captcha_required_exception error code.

Remove the captcha solution from the client.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

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

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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