Crate mangadex[][src]

Expand description

Rust crates.io License

Unofficial asynchronous mangadex API wrapper for rust

Example login:

use mangadex::Client;
use mangadex::api::{auth, manga};

#[tokio::main]
async fn main() {
    let mut client = Client::default();
    client.login("username", "password").await.unwrap();
}

How to get some mangas (you don’t need to be logged in for most actions):

use mangadex::api::manga::*;
use mangadex::schema::manga::*;
use mangadex::schema::LanguageCode;
use mangadex::Client;
 
#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = Client::default();
 
    let list_manga = ListMangaBuilder::default()
        .add_status(MangaStatus::Ongoing)
        .build()?;
 
    let mangas = list_manga.send(&client).await?;
 
    for manga_result in &mangas.results {
        if let Ok(manga) = &manga_result {
            let english_title = manga
                .data
                .attributes
                .title
                .get(&LanguageCode::English)
                .unwrap();
            println!("Got manga {} with id: {:x}", english_title, manga.data.id);
        }
    }
 
    Ok(())
}

Re-exports

pub use reqwest;

Modules

api

API request wrappers

schema

Data structures for API abstraction

Structs

Client

The client used to talk to the api.

Enums

Errors

A enum with all the possible errors

Type Definitions

Result

Helper Result type.