AMClient

Struct AMClient 

Source
pub struct AMClient { /* private fields */ }
Expand description

Main client for interacting with the AP AM

§Example

use tosho_amap::{AMClient, AMConfig};

#[tokio::main]
async fn main() {
    let config = AMConfig::new("123", "abcxyz", "xyz987abc");
    let client = AMClient::new(config).unwrap();
    let manga = client.get_comic(48000051).await.unwrap();
    println!("{:?}", manga);
}

Implementations§

Source§

impl AMClient

Source

pub fn new(config: AMConfig) -> ToshoResult<Self>

Create a new client instance.

§Parameters
  • config - The configuration to use for the client.
Source

pub fn with_proxy(&self, proxy: Proxy) -> ToshoResult<Self>

Attach a proxy to the client.

This will clone the client and return a new client with the proxy attached.

§Arguments
  • proxy - The proxy to attach to the client

Get the underlying cookie store.

Source

pub async fn get_remainder(&self) -> ToshoResult<IAPRemainder>

Get the account information or remainder.

This request has data related to user point and more.

Source

pub async fn get_comic(&self, id: u64) -> ToshoResult<ComicInfoResponse>

Get a single comic information by ID.

§Arguments
  • id - The ID of the comic.
Source

pub async fn get_comic_viewer( &self, id: u64, episode: &ComicPurchase, ) -> ToshoResult<ComicReadResponse>

Get reader/viewer for an episode.

§Arguments
  • comic_id - The ID of the comic.
  • episode - The episode being read.
Source

pub async fn get_account(&self) -> ToshoResult<AccountUserResponse>

Get the account for the current session.

Source

pub async fn get_favorites( &self, ) -> ToshoResult<ComicDiscoveryPaginatedResponse>

Get account favorites.

Source

pub async fn search( &self, query: impl Into<String>, status: Option<ComicStatus>, tag_id: Option<u64>, page: Option<u64>, limit: Option<u64>, ) -> ToshoResult<ComicSearchResponse>

Search for comics.

§Arguments
  • query - The query to search for.
  • page - The page to search for. (default to 1)
  • limit - The limit of results per page. (default to 30)
Source

pub async fn get_discovery(&self) -> ToshoResult<ComicDiscovery>

Get home discovery.

Source

pub async fn stream_download( &self, url: impl AsRef<str>, writer: impl AsyncWrite + Unpin, ) -> ToshoResult<()>

Stream download the image from the given URL.

§Arguments
  • url - The URL of the image.
  • writer - The writer to write the image to.
Source

pub async fn login( email: impl Into<String>, password: impl Into<String>, ) -> ToshoResult<AMConfig>

Perform a login request.

§Arguments
  • email - The email of the user.
  • password - The password of the user.

Trait Implementations§

Source§

impl Clone for AMClient

Source§

fn clone(&self) -> AMClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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