#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(group: 'net.dean.jraw', name: 'JRAW', version: '0.5.0')
}
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.5.0</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
- It is recommended to create an entire new user for the unit testing, since this library aims to test all endpoints (including moderation tasks and submitting and deleting submissions and comments).
- Create a multireddit whose name is not "jraw_testing", containing at least one subreddit
- Create a Reddit app. The type is recommended to be 'script'.
- Be a moderator of at least one subreddit. See here to create one.
- Submit at least one selfpost (how about on /r/jraw_testing2?)