#Java Reddit API Wrapper
JRAW is currently in an experimental stage, and therefore subject to application-breaking API changes that could occur at any time before v1.0.
##Notable Features
- Java 7 compatible
- Mini HTTP framework that wraps OkHttp
- Basic site actions (login, vote, submit, comment, read inbox, etc.)
- Full multireddit support
- Full captcha support
- Get trending subreddits
- Get random posts and subreddits
- Incubating OAuth2 usage
##Getting Started ####Adding the Dependency
JRAW is hosted on Bintray's jCenter.
Gradle:
repositories {
jcenter()
}
dependencies {
compile 'net.dean.jraw:JRAW:0.6.1'
}
Maven:
Add jCenter to your repositories (see here and press "Set me up!" on the right hand side) and then add the repository:
<dependency>
<groupId>net.dean.jraw</groupId>
<artifactId>JRAW</artifactId>
<version>0.6.1</version>
</dependency>
####Using the Library See the wiki to get you up and running
Javadoc can be found here
##Building
JRAW uses Gradle as its build system. If you're coming from a Maven background, you can read this StackOverflow question to help you get started.
./gradlew release
will generate four Jar files in build/releases/
: a normal jar with just the library, a "fat" jar with all of JRAW's runtime dependencies, a Javadoc jar, and a sources jar. See here for an example.
./gradlew test
will run the unit tests
##Contributing
Before contributing, it is recommended that you have a decent knowledge of how the Reddit API works.
Some references:
- reddit/reddit's 'API' wiki page: Quick overview of the API and its rules
- reddit/reddit's 'JSON' wiki page: Shows the data structure of the objects returned by the API
- And of course, don't forget the official Reddit API documentation
####Want to contribute? Follow these steps:
- Fork the repository
- Put your testing user's credentials in
/src/test/java/resources/credentials.json
. It should be in this format - Add your code. Implement an endpoint, make the code prettier, or even just fix up some whitespace or documentation.
- Write TestNG tests covering your changes
- Test your code by executing
./gradlew test
- Update
ENDPOINTS.md
andEndpoints.java
by running./gradlew endpoints:update
- Send the pull request
####Creating a user for unit testing
The :testingUser
subproject is a script to help you get set up with JRAW. To run it, execute TERM=dumb ./gradlew testingUser:run
. This script will:
- Register a new user
- Create an OAuth2 app
- Record the username, password, client ID, and client secret in
credentials.json
- Create a subreddit
- Create a multireddit
- Submit a self post to /r/jraw_testing2