#rest #json #http-request #data #async #json-file

rest-json-client

Utility library for easing http json api request

5 releases

0.2.3 Mar 27, 2024
0.2.2 Mar 22, 2024
0.2.1 Sep 28, 2023
0.2.0 Sep 28, 2023
0.1.0 Sep 28, 2023

#218 in HTTP client

Download history 71/week @ 2024-02-26 119/week @ 2024-03-18 103/week @ 2024-03-25 48/week @ 2024-04-01

270 downloads per month

MIT license

12KB
152 lines

Library to simplify calls to a RESTful API using a JSON file as the data source. GET, POST, PUT and DELETE methods are supported.

Example

Getting a list of posts from Json Placeholder

# use rest_json_client::{ApiClientBuilder, Authentication, Error};
# use json_placeholder_data::posts::Post;
#
# tokio_test::block_on(async {
    let base = "https://jsonplaceholder.typicode.com/";
    let posts = ApiClientBuilder::new(base)
        .build()?
        .get::<Vec<Post>>("posts")
        .await?;

#     assert_eq!(posts.len(), 100);
#     Ok::<(), Error>(())
# });

Dependencies

~4–18MB
~241K SLoC