opennode-client

Crates.ioopennode-client
lib.rsopennode-client
version1.0.1
sourcesrc
created_at2019-10-15 07:40:02.769207
updated_at2020-01-06 12:49:01.523861
descriptionClient for the Opennode v1 HTTP API
homepage
repositoryhttps://github.com/edouardparis/opennode-rs.git
max_upload_size
id172625
size77,125
Édouard (edouardparis)

documentation

https://docs.rs/opennode-client/

README

opennode-client

MIT licensed opennode on crates.io opennode on docs.rs tippin.me

Rust Client for the Opennode v1 HTTP API. This library rely on rust Futures to allow asynchronous usage.

Opennode API documentation

Usage

Put this in your Cargo.toml:

[dependencies]
opennode = "1.0.0"
opennode-client = "1.0.1"

And this in your crate root:

extern crate opennode;
extern crate opennode_client;

Test

cargo test

Examples

Run file from examples with:

cargo run --example <example> -- <example flags> <example args>

Getting Started

use clap::{App, Arg};

use opennode::account;
use opennode_client::{client::Client, get_account_balance};

/// Get account balance:
/// `cargo run --example account -- --key=<KEY>`
#[tokio::main]
async fn main() {
    let app = App::new("account").arg(
        Arg::with_name("key")
            .short("k")
            .long("key")
            .help("opennode api_key")
            .value_name("KEY")
            .required(true)
            .takes_value(true),
    );

    let matches = app.get_matches();
    let api_key = matches.value_of("key").unwrap();
    let client = Client::from_url("https://dev-api.opennode.co", api_key);

    let balance: account::Balance = get_account_balance(&client).await.unwrap();

    println!("{:?}", balance)
}
Commit count: 49

cargo fmt