Crates.io | redbot |
lib.rs | redbot |
version | 0.1.3 |
source | src |
created_at | 2019-05-27 19:39:16.911091 |
updated_at | 2019-06-03 02:43:37.45982 |
description | Reddit API wrapper for Rust. |
homepage | https://github.com/celeo/redbot |
repository | https://github.com/celeo/redbot |
max_upload_size | |
id | 137400 |
size | 34,556 |
(Unofficial) Rust bindings for Reddit's API.
Reddit's API documentation can be found here and endpoint documentation can be found here.
use redbot::{Api, Config, Value};
fn main() {
let config = Config::load_config("config.json").expect("Could not load confiog");
let mut api = Api::new(config);
api.do_login().expect("Could not perform login");
let mut resp = match api.query("GET", "api/v1/me/karma", None, None) {
Ok(resp) => resp,
Err(err) => panic!(err),
};
let karma_breakdown: Value = match resp.json() {
Ok(data) => data,
Err(err) => panic!(err),
};
println!("{:?}", karma_breakdown);
}