Rust Documentation Crate

What is this?

WIP Rust bindings for the Reddit API

This is a WIP, you likely won't find it particularly useful

Set up

Follow https://github.com/reddit-archive/reddit/wiki/OAuth2 for set up instructions.

Use

Set up a script with access to a Reddit account, collect the access token, the client ID, and the client secret. Once you have that, get a refresh token. Once you have that you can do:

// pants is mutable so the refresh token can be updated let mut pants = Pants::new( USER_AGENT, "<access-token>", "<refresh_token>", "<client-id>", "<client-secret>", ); For example, if you're using dotenv and reading values from the environment: // pants is mutable so the refresh token can be updated let mut pants = Pants::new( USER_AGENT, &env::var("ACCESS_TOKEN").unwrap(), env::var("REFRESH_TOKEN").unwrap(), &env::var("CLIENT_ID").unwrap(), &env::var("CLIENT_SECRET").unwrap(), ); Then you can invoke things, e.g:

pants.me()

If your refresh token expires, it should automatically refresh.

Currently implemented with (partially) structured response: - GET /api/v1/me - GET /api/v1/me/karma - GET /api/v1/me/prefs - GET /prefs/friends

Currently kind of implemented (no query parameters), with JSON response: - GET /api/v1/me/trophies - GET /prefs/blocked - GET /prefs/messaging - GET /prefs/trusted - GET /api/v1/me/friends - GET /api/v1/me/blocked

All other APIs are not implemented