A simple Reddit API wrapper implemented in Rust.
To create an OAuth client with the Reddit API, use the Reddit
class.
```rust,norun
use roux::Reddit;
let client = Reddit::new("USERAGENT", "CLIENTID", "CLIENTSECRET")
.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.
Using the OAuth client, you can:
rust,no_run
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");
rust,no_run
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");
There are also read-only modules that don't need authentication: