3 releases
0.1.3 | Jul 24, 2020 |
---|---|
0.1.2 | Jul 21, 2020 |
0.1.1 | Jul 20, 2020 |
52KB
1K
SLoC
RsReddit - A Rust Wrapper for the Reddit Web API
Description
RsReddit is lightweight wrapper for the Reddit Web API. The goal is to cover most common and useful endpoints like browsing subreddits, creating posts, commenting on posts. For a complete reference, see the official documentation
Features
Implemented endpoints:
- Get sorted posts of subreddit or frontpage
- Top posts
- Hot posts
- Best posts
- Rising posts
- New posts
- Controversial posts
- Comment on thread
- Reply to comments
- Get Thread comment tree
OAuth2 specific implementations:
- Authorize Client with Reddit UI ( Installed APP type. See here )
- Refresh bearer token
- Revoke bearer token
Usage
Add to your Cargo.toml
:
[dependencies]
rsreddit = "0.1.2"
Or get it from GitHub.
Getting Started
Authorization
Currently only Installed Apps are supported.
A script using this library has to register an installed app, or authorize an existing one.
To use an existing App, or set your own app, set the environment variable CLIENT_ID as the app's ID, and CLIENT_SECRET as base64 encoded CLIENT_ID.
You can also set these values in a .env
file, for example as shown here.
If you want to use your own installed app, create one over here. It is important to choose installed app. See the official documentation
Examples
- Reddit API endpoints
- Authorization Examples
Changelog
See changelog for release history
Contribution
Pull requetss, code reviews, general feedback are welcome!
Dependencies
~16–27MB
~431K SLoC