roux.rs

CircleCI Documentation Crate GitHub

A simple, asynchronous Reddit API wrapper implemented in Rust.

Usage

Using OAuth

To create an OAuth client with the Reddit API, use the Reddit class. ```rust use roux::Reddit; let client = Reddit::new("USERAGENT", "CLIENTID", "CLIENT_SECRET") .username("USERNAME") .password("PASSWORD") .login() .await;

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

```rust use roux::Reddit; let client = Reddit::new("USERAGENT", "CLIENTID", "CLIENT_SECRET") .username("USERNAME") .password("PASSWORD") .login() .await;

let me = client.unwrap(); me.submittext("TEXTTITLE", "TEXT_BODY", "SUBREDDIT"); ```

Submit A Link Post

```rust use roux::Reddit; let client = Reddit::new("USERAGENT", "CLIENTID", "CLIENT_SECRET") .username("USERNAME") .password("PASSWORD") .login() .await;

let me = client.unwrap(); me.submitlink("LINKTITLE", "LINK", "SUBREDDIT"); ```

Read-Only Modules

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