jsonbank

Crates.iojsonbank
lib.rsjsonbank
version0.1.9
sourcesrc
created_at2023-04-19 22:15:40.197191
updated_at2024-01-31 16:06:51.705706
descriptionJsonBank.io Rust SDK
homepagehttps://docs.jsonbank.io/sdks/rust
repositoryhttps://github.com/jsonbankio/rust-sdk
max_upload_size
id843962
size50,830
Anthony (Trapcode) (trapcodeio)

documentation

README

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
Commit count: 61

cargo fmt