redbot

Crates.ioredbot
lib.rsredbot
version0.1.3
sourcesrc
created_at2019-05-27 19:39:16.911091
updated_at2019-06-03 02:43:37.45982
descriptionReddit API wrapper for Rust.
homepagehttps://github.com/celeo/redbot
repositoryhttps://github.com/celeo/redbot
max_upload_size
id137400
size34,556
Matt Boulanger (Celeo)

documentation

https://docs.rs/redbot

README

redbot

(Unofficial) Rust bindings for Reddit's API.

crates.io link

Reddit's API documentation can be found here and endpoint documentation can be found here.

Usage

Example

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);
}
Commit count: 13

cargo fmt