| Crates.io | reqt |
| lib.rs | reqt |
| version | 1.0.0 |
| created_at | 2025-11-26 11:10:09.945727+00 |
| updated_at | 2025-11-26 11:10:09.945727+00 |
| description | An HTTP request manager, providing high level features to connect to a web API and handle requests. |
| homepage | https://github.com/ZialeHub/reqt |
| repository | https://github.com/ZialeHub/reqt |
| max_upload_size | |
| id | 1951250 |
| size | 158,695 |
reqtreqt is an HTTP request manager, providing high level features to connect to a web API and handle requests.
reqt goal is to make communication with web APIs easy.
reqt provides high level interfaces to make connect, auth, pagination, filtering, ranging, sorting, and working with rate limits a breeze.
Web devs who need to interact with an API.
Api<P: Pagination = RequestPagination, F: Filter = FilterRule, S: Sort = SortRule, R: Range = RangeRule>
Api Connector can be defined using the default Pagination, Filter, Sort and Range rules, or by implementing your own types that implement the following traits:
Each rule can be overridden for a specific request if needed later.
Authorization Type define how to use your token in each request:
Authorization: Basic username:passwordAuthorization: Bearer <token>X-API-Key: 1234567890abcdefAuthorization: Bearer <access_token>Authorization: Bearer <refresh_token>Request<B: Serialize + Clone = (), P: Pagination = RequestPagination, F: Filter = FilterRule, S: Sort = SortRule, R: Range = RangeRule>
The request allow you to override pagination, filter, sort and range rules from the connector.
Pagination defines the rule to manage multiple page requests depending on the API specifications.
By default RequestPagination will be used and fields are set as follow:
size = 100 => Page sizecurrent_page = 1pagination = PaginationRule::OneShotAnd the headers page[number]=x and page[size]=y are added to the final query of the request.
To implement your own pagination, you need to implement the Pagination trait.
Filter defines the way to filter resources with your request, and the list of filters you want to apply.
To implement your own filter rule, you need to implement the Filter trait.
Range defines the way to range resources with your request, and the list of ranges you want to apply.
To implement your own range rule, you need to implement the Range trait.
Sort defines the way to sort resources with your request, and the list of sorts you want to apply.
To implement your own sort rule, you need to implement the Sort trait.
The rate limit can be set through the ApiBuilder (Default = RateLimiter::new(1, TimePeriod::Second)), and will allow the connector to respect a specific rate to avoid 429 HTTP errors.
To implement your own connector with ease, you have in your hands the following macros:
#[derive(Debug, Clone, Deserialize, Oauth2)]
#[pagination(PaginationTest)]
#[filter(FilterTest)]
#[sort(SortTest)]
#[range(RangeTest)]
struct TestApiConnector {
client_id: String,
client_secret: String,
auth_endpoint: String,
scopes: Vec<String>,
}
Please always perform the following checks before committing:
cargo build --workspace --all --all-features --testscargo fmt --allcargo clippy --workspace --all --all-features --tests -- -D warningscargo test --all-targets --all-features --workspaceThis project is licensed under the MIT License. See LICENSE for details.
Huge thanks to gpoblon for his CI, ideas and reviews!