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
impl AMClient
Sourcepub fn new(config: AMConfig) -> ToshoResult<Self>
pub fn new(config: AMConfig) -> ToshoResult<Self>
Sourcepub fn with_proxy(&self, proxy: Proxy) -> ToshoResult<Self>
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.
Sourcepub async fn get_remainder(&self) -> ToshoResult<IAPRemainder>
pub async fn get_remainder(&self) -> ToshoResult<IAPRemainder>
Get the account information or remainder.
This request has data related to user point and more.
Sourcepub async fn get_comic(&self, id: u64) -> ToshoResult<ComicInfoResponse>
pub async fn get_comic(&self, id: u64) -> ToshoResult<ComicInfoResponse>
Sourcepub async fn get_comic_viewer(
&self,
id: u64,
episode: &ComicPurchase,
) -> ToshoResult<ComicReadResponse>
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.
Sourcepub async fn get_account(&self) -> ToshoResult<AccountUserResponse>
pub async fn get_account(&self) -> ToshoResult<AccountUserResponse>
Get the account for the current session.
Sourcepub async fn get_favorites(
&self,
) -> ToshoResult<ComicDiscoveryPaginatedResponse>
pub async fn get_favorites( &self, ) -> ToshoResult<ComicDiscoveryPaginatedResponse>
Get account favorites.
Sourcepub async fn search(
&self,
query: impl Into<String>,
status: Option<ComicStatus>,
tag_id: Option<u64>,
page: Option<u64>,
limit: Option<u64>,
) -> ToshoResult<ComicSearchResponse>
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)
Sourcepub async fn get_discovery(&self) -> ToshoResult<ComicDiscovery>
pub async fn get_discovery(&self) -> ToshoResult<ComicDiscovery>
Get home discovery.
Sourcepub async fn stream_download(
&self,
url: impl AsRef<str>,
writer: impl AsyncWrite + Unpin,
) -> ToshoResult<()>
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AMClient
impl !RefUnwindSafe for AMClient
impl Send for AMClient
impl Sync for AMClient
impl Unpin for AMClient
impl !UnwindSafe for AMClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more