Comments (1)
Hello there!
Firstly, Thank you for posting this interesting issue.
Secondly, I apologize for not responding you sooner,
I have a lot of projects behind this and I didn't have the time on focusing on this issue.
Thirdly, Your proposition for adding rate limiting handling is interesting,
but adding field on mangadex_api_schema::ApiData
would be technical challenge for me.
There is around 30 endpoints that respond with these headers, and each of them have a different response type.
I know that some of them respond with the : mangadex_api_schema::ApiData
,
but for the GET /at-home/server/{id}
, his response type is mangadex_api_schema::v5::AtHomeServer
.
After re factoring all of the SDK for the new syntax, I come up with an idea that should be 'easy' to implement and noticeable in your development.
We added these struct :
/// This `RateLimit` struct contains all the data needed for rate limit handling
/// It can be parsed via a [`reqwest::Response`] or [`reqwest::header::HeaderMap`]
#[derive(Serialize, Debug)]
#[cfg_attr(feature = "non_exhaustive", non_exhaustive)]
pub struct RateLimit {
/// value from `x-ratelimit-limit` header
pub limit: u32,
/// value from `x-ratelimit-remaining` header
pub remaining: u32,
/// value from `x-ratelimit-retry-after` header
/// It's normally an [`i64`] [(Unix timestamp)](https://www.unixtimestamp.com/)
/// but can be parsed as a [`crate::MangaDexDateTime`]
pub retry_after: MangaDexDateTime,
}
/// This struct is used for rate limited endpoint
/// `rate_limit` is for the rate limit metadata
/// `body` is the response data
pub struct Limited<T> {
pub rate_limit: RateLimit,
pub body: T,
}
The RateLimit
struct is for the rate limit metadata header.
And the Limited<T>
is for handling the metadata.
I know that it might be a strange solution but it's the only one that i come up with.
You can lookup to this linked pull request #87 to see the work progess
from mangadex-api.
Related Issues (20)
- `find_relationship` function for `ApiObject`
- Add `ApiClient` endpoint support
- add `authorOrArtist` in manga search builder
- Add mangadex `OAuth` login system
- Add the support of `/statistics/group`, `/statistics/chapter`
- Add create forums threads support : `/forums/thread`
- Refactor `mangadex-api` endpoint as in the swagger docs
- Create a dedicated `tauri-plugin`
- Add user history endpoints : `/user/history`
- The property chapters is not defined and the definition does not allow additional properties HOT 2
- Annoucement for 3.0.0 HOT 1
- Add a default Error struct for Endpoint builders
- Dependency Dashboard
- a `ApiClientAttribute` in `schema`
- `GET /client` endpoint : The list of user owned ApiClients
- `POST /client` endpoint : Create an ApiClient
- `GET /client/{id}` : Get ApiClient by ID
- `POST /client/{id}` : Edit ApiClient
- `builder_send!` implementation + documentation update
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mangadex-api.