10 releases
0.1.9 | Jan 31, 2024 |
---|---|
0.1.8 | Apr 25, 2023 |
#272 in #repository
31 downloads per month
50KB
726 lines
JsonBank.io Rust SDK
The official repository for the JsonBank.io Rust SDK.
Documentation | crates.io | docs.rs
Usage
Add the following to your Cargo.toml file
[dependencies]
jsonbank = "0.1"
Then import the library in your code
use jsonbank::{JsonBank, JsonObject};
fn main() {
let jsb = JsonBank::new_without_config();
// get public content
let data: JsonObject = match jsb.get_content("jsonbank/sdk-test/index.json") {
Ok(data) => data,
Err(err) => panic!("{:?}", err)
};
println!("{:?}", data);
}
Testing
Create an .env file in the root of the project and add the following variables
JSB_HOST="https://api.jsonbank.io"
JSB_PUBLIC_KEY="your public key"
JSB_PRIVATE_KEY="your private key"
Then run the tests command below.
Note: A single thread is required for test so that all tests can run in defined order.
cargo test -- --test-threads=1
or using npm because a package.json file is included
npm run test
Dependencies
~4–16MB
~215K SLoC