Commit Graph

5 Commits

Author SHA1 Message Date
Koen Bolhuis c1bb3f39f4 Run rustfmt 2021-09-01 18:14:04 +02:00
Koen Bolhuis c49f40128d Use the attohttpc crate instead of ureq.
This has some implications for Error:
- because attohttpc doesn't distinguish between errors
  when serializing or deserializing request/response
  data, Error::RequestJson and Error::ResponseJson have
  been merged into Error::Json. In practice this shouldn't
  matter much because request data is (usually) well-formed.
- attohttpc also doesn't return errors for HTTP responses
  with statuses in the [400-599] range, so manual conversion
  to an error is needed (this now happens in ResponseType::from_response).
2021-09-01 18:04:56 +02:00
Koen Bolhuis 508f697a51 Add rate limiting information to response types
Add the `rate_limit` field to all response types,
which contains rate limiting information such as
maximum and remaining requests in the current
time frame, as well as when the next time frame
starts.

All response types now also implement the `ResponseType`
trait (internal for now). Currently this trait allows
converting from `ureq::Response` to the response type,
by extracting rate limiting information from the response
headers and deserializing the response body into the
response type.
2021-01-30 03:06:02 +01:00
Koen Bolhuis 56a50d936c Move Client to raw module 2021-01-19 23:51:17 +01:00
Koen Bolhuis a22fcff2bf Move low-level models to raw module 2021-01-19 23:41:54 +01:00
Renamed from src/models/response.rs (Browse further)