mangadex-api: A Mangadex API SDK for Rust

Dex-chan lover
Joined
Jan 11, 2023
Messages
71
Hello everyone!
It's been while since I didn't publish something here.

Today, I'm here to introduce you something that I have been maintaining for a while
Announcing,

mangadex-api: A Mangadex API SDK for Rust

This library is kinda the equivalent of mangadex-full-api but for Rust.

Features: (Note: this is not the crate feauture flag list)
  • Asynchronous
  • Mutli-threading support (via multi-thread or tokio-multi-thread or rw-mutli-thread feature flag)
  • Flexible types and schemas: The types is provided by the mangadex-api-types-rust crate and the schema by mangadex-api-schema-rust. They both provide the response types used in the SDK, and also support serde serialization and type exports via specta crate.
  • OAuth authentification via Personal Client (there is an example here)
  • Chapter/Cover Image download (via utils feature flag)
  • Chapter Uploading (not tested yet in production but compiles ??)

Quick Start:
- Install Rust (If you didn't have one)
  • Init a new cargo project
  • Add the dependencies :
Code:
[dependencies]
# We're using [tokio](https://tokio.rs/) for the and [anyhow](https://docs.rs/anyhow/latest/anyhow/)
tokio = { version = "1", features = ["full"] }
# ...
# Types and schemas are always required
mangadex-api-types-rust = "0.5"
mangadex-api-schema-rust = "0.5"
mangadex-api = "3.0.0-rc.2"
- Then copy this code in your src/main.rs file.
Code:
use mangadex_api::v5::MangaDexClient;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // The [`MangaDexClient`](https://docs.rs/mangadex-api/3.0.0-rc.2/mangadex_api/v5/struct.MangaDexClient.html) 
    // provides the HTTP client, the User-Agent which is by default `mangadex-api v3.0.0-alpha.1`
    let client = MangaDexClient::default();

    // Calls the `GET /manga/random` endpoint
    let random_manga = client
        .manga()
        .random()
        .get()
        .send()
        .await?;

    // We print the result in the standard output
    println!("{:?}", random_manga);

    Ok(())
}

There is a few example in the Github readme and in the example directory.

Developer Notes:
Quick history :
The mangadex-api was originally made and maintained by gondolyr,
but the crate was yanked before it's v2 realease
.
At the same time, I was building Special-Eureka and i was sad that the crate was yanked.
I decided to create a fork from it, but gondolyr asked me if I want to get the crate ownership.
I gladly accept it because i need it.

Roadmap :
- Support of the new custom list (when it deployed)
  • Tauri support
  • Testing Upload

Bugs or missing parts :
I'm currently preparing the v3 realease of this crate.
There is a lot to improve and some part might missing (request parameters, response structs,...)
Please create an issue if something is not right, I will gladly respond to it.


I built something on top of your library!
Sure, I'm glad that you build something on top of it.
The crate has a MIT licence or Apache 2.0, so it's your choice

Thanks for reading to end.
 

Users who are viewing this thread

Top