Skip to content

Haptic-Apps/JRAW

 
 

Repository files navigation

#Java Reddit API Wrapper

travis-ci build status Coverage Status reddit API coverage Latest release

JRAW is currently in an experimental stage, and therefore subject to breaking API changes that could occur at any time.

Quick Note: Due to the fact that the unit tests rely on a solid internet connection and that the reddit API is working properly, a failing build does not necessarily mean that the library is currently unstable. For example, this build failed because reddit was having issues with SSL at the time. JRAW tries its best to recover from server errors, but it can only do so much.

##Notable Features

  • OAuth2 support
  • Full multireddit support
  • All common actions (login, vote, submit, comment, messages, etc.)
  • Java 7 compatible
  • Simple HTTP framework capable of wrapping most any HTTP library
  • Dynamic ratelimit adjustment

See Quickstart to get you up and running. Javadoc can be found here

##Building

JRAW uses Gradle as its build system. If you come from a Maven background, see Gradle's user guide to get you started.

gradle 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.

gradle 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:

####Want to contribute? Follow these steps:

  1. Fork the repository
  2. Put your testing user's credentials in src/test/java/resources/credentials.json. It should be in this format. If you don't have a testing user, see below.
  3. Add your code. Implement an endpoint, make the code prettier, or even just fix up some whitespace or documentation.
  4. Write TestNG tests covering your changes
  5. Test your code by executing gradle test
  6. Update ENDPOINTS.md and Endpoints.java by running gradle endpoints:update (see the wiki)
  7. Send the pull request

####Creating a user for unit testing

Here's how to create a testing user:

  1. Register a new user
  2. Create an OAuth2 app
  3. Record the username, password, client ID, and client secret in src/test/java/resources/credentials.json
  4. Create a subreddit
  5. Create a multireddit
  6. Submit a self post to /r/jraw_testing2

Packages

No packages published

Languages

  • Kotlin 73.9%
  • Java 23.8%
  • Groovy 2.3%