#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

#56 in #json-file

Download history 5/week @ 2024-02-20 66/week @ 2024-02-27 119/week @ 2024-03-19 105/week @ 2024-03-26 21/week @ 2024-04-02

191 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–16MB
~228K SLoC