9 unstable releases (3 breaking)

✓ Uses Rust 2018 edition

0.4.0 Apr 16, 2020
0.3.1 Apr 11, 2020
0.2.2 Nov 29, 2019
0.2.1 Jul 19, 2019
0.1.2 Jul 19, 2019

#2 in #reddit

Download history 7/week @ 2020-03-15 19/week @ 2020-03-22 8/week @ 2020-03-29 51/week @ 2020-04-05 54/week @ 2020-04-12 7/week @ 2020-04-19 4/week @ 2020-04-26 5/week @ 2020-05-03 4/week @ 2020-05-10 34/week @ 2020-05-17 17/week @ 2020-05-24 43/week @ 2020-05-31 15/week @ 2020-06-07 12/week @ 2020-06-14 40/week @ 2020-06-21 42/week @ 2020-06-28

78 downloads per month

MIT license

35KB
684 lines

roux.rs

CircleCI Documentation Crate GitHub

A simple Reddit API wrapper implemented in Rust.

Usage

Using OAuth

To create an OAuth client with the Reddit API, use the Reddit class.

use roux::Reddit;
let client = Reddit::new("USER_AGENT", "CLIENT_ID", "CLIENT_SECRET")
    .username("USERNAME")
    .password("PASSWORD")
    .login();

let me = client.unwrap();

It is important that you pick a good user agent. The ideal format is platform:program:version (by /u/yourname), e.g. macos:roux:v0.3.0 (by /u/beanpup_py). This will authticate you as the user given in the username function.

Usage

Using the OAuth client, you can:

Submit A Text Post

use roux::Reddit;
let client = Reddit::new("USER_AGENT", "CLIENT_ID", "CLIENT_SECRET")
    .username("USERNAME")
    .password("PASSWORD")
    .login();

let me = client.unwrap();
me.submit_text("TEXT_TITLE", "TEXT_BODY", "SUBREDDIT");

Submit A Link Post

use roux::Reddit;
let client = Reddit::new("USER_AGENT", "CLIENT_ID", "CLIENT_SECRET")
    .username("USERNAME")
    .password("PASSWORD")
    .login();

let me = client.unwrap();
me.submit_link("LINK_TITLE", "LINK", "SUBREDDIT");

Read-Only Modules

There are also read-only modules that don't need authentication:

Dependencies

~16MB
~404K SLoC