lbry-rs

A Rust API wrapper for lbrynet

1 unstable release

0.0.1 Apr 21, 2019

MIT license

5KB

lbry-rs

A Rust API wrapper for lbrynet

Installation

From crates

  1. Add the following line to your Cargo.toml dependencies
lbry-rs = "0.0.1"

From source

  1. Clone the repository
$ git clone https://github.com/zxawry/lbry-rs
  1. Add the following line to your Cargo.toml dependencies
lbry-rs = {path = "{path-to-where-you-cloned-the-repository}"}

Usage

extern crate lbry_rs;

use lbry_rs::LbrynetApi;

//re-exported from serde_json
use lbry_rs::{Value, json};

fn main() {
    //instantiate a lbry client
    let mut lbry = LbrynetApi::new();

    //make requests by providing the method and params with cURL command-line syntax
    //params must be of the type serde_json::Value so use json! macro for conversion
    let result0: Value = lbry.call("status", json!({}));
    let result1: Value = lbry.call("resolve", json!({"urls":"lbrytv"}));
        
    println!("{}", result0);
    println!("{}", result1);
}

Note that lbrynet must be up and running, to use this API wrapper.

License

MIT License

Dependencies

~11–18MB
~249K SLoC