Giter Club home page Giter Club logo

mangadex-api's Introduction

Hi ๐Ÿ‘‹, I'm Tony Mushah

A Malagasy passionnate otaku who love programming!

  • ๐Ÿ”ญ Iโ€™m currently working on Special Eureka

  • ๐ŸŒฑ Iโ€™m currently learning Rust, Tauri and SvelteKit (Bevy Engine for the future)

  • ๐Ÿค Iโ€™m looking for help with Special Eureka

  • ๐Ÿ’ฌ Ask me about Rust

  • โšก Fun fact : I read a lot of manga, and play a lot of video games (especially Genshin Impact). I hate PHP

Connect with me:

tonymushah

Languages and Tools:

git java linux postgresql react redis rust spring svelte typescript

tonymushah

ย tonymushah

tonymushah

mangadex-api's People

Contributors

curstantine avatar dependabot[bot] avatar renovate[bot] avatar tonymushah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

mangadex-api's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

cargo
mangadex-api-input-types/Cargo.toml
  • serde 1.0
  • specta 1.0
  • tokio 1
  • anyhow 1.0.82
  • async-graphql 7.0.3
  • uuid 1.8
  • url 2.5
mangadex-api-schema/Cargo.toml
  • reqwest 0.12
  • serde 1.0
  • serde_qs 0.13
  • thiserror 1.0
  • url 2.5
  • uuid 1.8
  • specta 1.0
  • tokio 1
  • serde_json 1
  • jsonxf 1
  • color-print 0.3.6
mangadex-api-tests/Cargo.toml
  • tokio 1.37
  • anyhow 1.0.82
  • reqwest 0.12
  • uuid 1
mangadex-api-types/Cargo.toml
  • anyhow 1.0.82
  • derive_builder 0.20
  • reqwest 0.12
  • serde 1
  • thiserror 1
  • time 0.3
  • url 2.5
  • uuid 1.8
  • async-graphql 7.0.3
  • specta 1.0
  • tokio 1
  • serde_json 1
mangadex-api/Cargo.toml
  • derive_builder 0.20
  • futures 0.3
  • reqwest 0.12
  • serde 1.0
  • serde_qs 0.13
  • thiserror 1.0
  • time 0.3
  • url 2.5
  • uuid 1.8
  • bytes 1.6
  • anyhow 1.0.82
  • tokio 1.37
  • async-stream 0.3.5
  • tokio-stream 0.1
  • getset 0
  • anyhow 1.0.82
  • serde_urlencoded 0.7
  • clap 4.5.4
  • fake 2.9.2
  • serde_json 1.0
  • tokio 1.37
  • wiremock 0.6
devcontainer
.devcontainer/devcontainer.json
  • mcr.microsoft.com/devcontainers/universal 2
  • ghcr.io/devcontainers/features/rust 1
github-actions
.github/workflows/rust.yml
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4

  • Check this box to trigger a request for Renovate to run again on this repository

implement missing languages

As always, some languages are missing.
I don't know how many languages missing but it seems like Mangadex added a bunch recently.

The Plan:

1- List all Mangadex supported languages:

Should be easy:

  • Just go to the mangadex.org,
  • click to user icon at the top right
  • go to chapter languages
  • list them all

2- Implement them :

Mangadex uses the ISO 639-1 standard.
All "currently" supported languages is here : mangadex-api-types::language::Language

The property chapters is not defined and the definition does not allow additional properties

When using chapters or add_chapter, such as the below

let mut chapters_res = client
    .search()
    .chapter()
    .add_chapter(String::from("1"))
    .manga_id(&manga_id)
    .limit(limit)
    .build()?
    .send()
    .await?;

Sending it yields an error like so

Error: an error occurred with the MangaDex API request: MangaDexErrorResponse { errors: [MangaDexError { id: 9c346772-7b14-5982-b4b6-7b5888522762, status: 400, title: Some("validation_exception"), detail: Some("Error validating : The property chapters is not defined and the definition does not allow additional properties"), context: None }] }

Upon serializing it, I see this output

{"limit":10,"offset":null,"ids":[],"title":null,"groups":[],"uploader":[],"manga":"4e7a4a0f-8391-4069-839b-de2352297dab","volume":[],"chapters":["1"],"translatedLanguage":["en"],"originalLanguage":[],"excludedOriginalLanguage":[],"contentRating":[],"excludedGroups":[],"excludedUploaders":[],"includeFutureUpdates":null,"createdAtSince":null,"updatedAtSince":null,"publishAtSince":null,"includeEmptyPages":null,"includeExternalUrl":null,"includeFuturePublishAt":null,"order":null,"includes":[]}

Notice chapters. From the mangadex api I see a parameter named chapter but not chapters

Indeed, using a query like this results in the same error
https://api.mangadex.org/chapter?limit=10&manga=4e7a4a0f-8391-4069-839b-de2352297dab&chapters[0]=1&translatedLanguage[0]=en
Whereas this one works
https://api.mangadex.org/chapter?limit=10&manga=4e7a4a0f-8391-4069-839b-de2352297dab&chapter[0]=1&translatedLanguage[0]=en

Add la as part of the list of available languages.

Example: https://api.mangadex.org/chapter?translatedLanguage[]=la

RequestError(
    reqwest::Error {
        kind: Decode,
        source: Error("unknown variant `la`, expected one of `ar`, `bn`, `bg`, `my`, `ca`, `zh-ro`, `zh`, `zh-hk`, `cs`, `da`, `nl`, `en`, `tl`, `fi`, `fr`, `de`, `el`, `he`, `hi`, `hu`, `id`, `it`, `ja`, `ja-ro`, `ko`, `ko-ro`, `lt`, `ms`, `mn`, `ne`, `kr`, `no`, `fa`, `pl`, `pt-br`, `pt`, `rm`, `ro`, `ru`, `sr`, `es`, `es-la`, `sv`, `th`, `tr`, `uk`, `vi`, `NULL`", line: 0, column: 0),
    },
)

gondolyr request list

i need to know what feature you wanted to add in the crate.

I have a bunch of stuff ๐Ÿ˜… ...
There are probably more I can list but this is already a lot.

  • Compile times are painfully slow. As a library, minimizing the compile times should be a priority. Removing external dependencies in favor of building things manually in the project would probably be a good starting place.
  • More structs and modules should be made public. This is currently making it impossible for some to compile their programs simply because they can't define the type in their functions.
    error[E0603]: module `manga_aggregate` is private
      --> src/events/components/manga_reader.rs:48:132
       |
    48 | ...ponentInteraction, manga: mangadex_api::v5::schema::manga_aggregate::MangaAggregate) {
       |                                                        ^^^^^^^^^^^^^^^ private module
       |
    note: the module `manga_aggregate` is defined here
      --> /home/jp/.cargo/registry/src/github.com-1ecc6299db9ec823/mangadex-api-1.3.0/src/v5/schema.rs:14:1
       |
    14 | mod manga_aggregate;
       | ^^^^^^^^^^^^^^^^^^^^
    
  • The API could be made more ergonomic. The builder pattern felt clunky whenever I tried to use my own library.
    let manga = client
        .manga()
        .aggregate()
        .manga_id(&manga_id)
        .translated_language(languages)
        .build()
        .unwrap()
        .send()
        .await;

Owner Edit: This syntax doesn't work since v3
So the following example should be:

    let manga = client
        .manga()
        .id(your_manga_id)
        .aggregate()
        .get()
        .translated_language(languages)
        .send()
        .await
        .unwrap();
  • #112
    Owner Edit : It won't work since the old login system is deprecated
  • I'm not sure that breaking up the project into workspaces (mangadex-api-types, mangadex-api-schema) was worth the trouble. It might be good to put them back into a single workspace but I can't say which is better honestly.
  • The v5 module is probably unnecessary. I made it because of the potential of future major API versions since at the time I made it, there was a v2 and v5 of the MangaDex API.
  • Having WASM compatibility would be nice.
  • It would be good to see more String fields converted to an enum type where appropriate. Here is one example:
    pub roles: Vec<String>, // TODO: Deserialize the strings into `UserRole` enum.
  • I'm not maintaining this crate for the foreseeable future so I don't need to be included in the list of authors

Notes about some of the custom deserialization I added:

Originally posted by @gondolyr in #1 (comment)

Preparation for the `MangaDex API` v5.10.2 update

Just ealier, an OpenAPI spec changes pull request have been opened on the MangaDex API Docs repository

Edit:
It's now deployed so this update will come very soon

To summarize, there is some notable changes:

1- a new endpoint have been added: POST /upload/check-approval-required

Check if a given manga / locale for a User needs moderation approval
Body Schema :

  • manga: Uuid (the mangaID)
  • locale: Language

Possible response schema:

  • 200 : ok
{
   "result": "ok",
   "requiresApproval": true | false
}
  • 404: the manga is not found
{
    "result": "ok"
}

2- Removed all /account endpoint:

Since MangaDex Authentification migrated to OAuth 2.0, these endpoint will be removed in the next version.
but DELETE /user/{id} and POST /user/delete/{code} is still there so... I don't know what to tell about this.

3- Added namicomi on the AuthorLinks structs.

Todo list:

Add Rate Limiting Handling

Rate limits can change depending on the number of load balancers that are active. The API call responses includes header meta data related to these rate limits.

In the short term I would suggest adding these headers to the mangadex_api_schema::ApiData struct to allow user code to utilise this meta data.

Header Description
X-RateLimit-Limit Maximal number of requests this endpoint allows per its time period
X-RateLimit-Remaining Remaining number of requests within your quota for the current time period
X-RateLimit-Retry-After Timestamp of the end of the current time period, as UNIX timestamp

https://api.mangadex.org/docs/rate-limits/

Annoucement for 3.0.0

NEED ATTENTION

If you don't know, Mangadex API Team (that doesn't include me) realease a new breaking change in their follows and custom list system.
Reference here
As for that, i'm now preparing for having a new breakin-change realease this weekend or next week.
Owner Edit: The v3 developpement took 5 months though ๐Ÿ˜….
As a preparation, i will tell about what we will change :

1- The new follow/custom list system

I don't know about the details of it but i will reference this in a new issue

2- The RateLimit metadata

Ref #26

3- A new syntax

Example :
Let's say we have an endpoint like this:
GET /manga/{id}
then you should have an invoke syntax like this:

// Note: the `client` is the `mangadex-api::v5::Client` here 
client
    .manga()
    .id(/*your manga id here*/)
    .get()
    .send()
    .await?;

or

GET /chapter
Path Parameters
=============
- chapter : uuid[]
- manga : uuid
- includes : IncludesReferenceExpansion[]

should be :

client.chapter().get().chapter(/*your chapter id list*/).manga(/*your manga id*/).includes(/*your include reference enum list*/).send().await?;

Notice that there is no .build()? in this syntax.

I want to make it like that because it's overhelming to maintain the API with all of those weird function.

4- A dedicated tauri-plugin

ref : #10

Thanks for understanding.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.