Struct mangadex_api::web_scrape::builder::LoginAjaxBuilder[][src]

pub struct LoginAjaxBuilder<'a> {
    md_client: &'a (dyn MangaDexClient + 'a),
    username: String,
    password: String,
    remember_me: bool,
    two_factor_code: Option<String>,
}

Builder for the /ajax/actions.ajax.php?function=login endpoint.

Fields

md_client: &'a (dyn MangaDexClient + 'a)username: Stringpassword: Stringremember_me: booltwo_factor_code: Option<String>

Implementations

impl<'a> LoginAjaxBuilder<'a>[src]

pub fn new<T: Into<String>>(
    md_client: &'a dyn MangaDexClient,
    username: T,
    password: T
) -> LoginAjaxBuilder<'a>
[src]

Create a new builder instance for logging in via the AJAX endpoint.

Parameters

  • username: MangaDex username.
  • password: Plain-text MangaDex password.

pub fn remember_me(&mut self, remember_me: bool) -> &mut Self[src]

Toggle the “Remember me” flag to increase the session length from 1 day to 1 year.

pub fn two_factor<T: Into<String>>(&mut self, two_factor_code: T) -> &mut Self[src]

Set the 2-factor 6-digit TOTP authentication code.

This can be used in the same request as the login.

pub async fn send(&self) -> Result<LoginAjaxResponseType, Error>[src]

Send the request to MangaDex.

If the response type is LoginAjaxResponseType::TwoFactorAuthenticationRequired, retry the request using the two_factor() method before sending to send the 2FA code.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for LoginAjaxBuilder<'a>

impl<'a> !Send for LoginAjaxBuilder<'a>

impl<'a> !Sync for LoginAjaxBuilder<'a>

impl<'a> Unpin for LoginAjaxBuilder<'a>

impl<'a> !UnwindSafe for LoginAjaxBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.