Skip to content
Matt Dean edited this page Jan 3, 2018 · 11 revisions

This is for version 0.9.0 and below. The documentation for v1.0.0+ can be found here

Design Philosophy

JRAW is designed with simplicity in mind; each class operates on a "need-to-know" basis. Only specific classes can execute a network request, facilitate the transfer of data, etc. The library is divided into five sections: networking, authentication, management, models, and pagination.

Networking

Defined in net.dean.jraw.http

This package is primarily built off of HttpAdapter and HttpClient. HttpAdapter forms a bridge between JRAW and another networking library, such as OkHttp. HttpClient uses an HttpAdapter to perform network requests. HttpClient's direct child is RestClient, which introduces request history and logging through SLF4J. Note that RestClient is not reddit-specific, but rather a generic HTTP client. RestClient's direct child is RedditClient, which targets reddit's API specifically. It adds rate limiting and access to a few reddit endpoints.

Only classes that implement NetworkAccessible can send HTTP requests.

Authentication

Defined in net.dean.jraw.auth and net.dean.jraw.http.oauth.

These two packages are mainly centered around OAuthHelper and AuthenticationManager. OAuthHelper is designed to aid in the OAuth2 authentication process. AuthenticationManager helps make the whole refresh-token-storing situation a little bit easier. See here for more.

Management

Defined in net.dean.jraw.managers

Every class in the managers package is responsible for a certain section of the API. For example, AccountManager handles things user-related, like voting, saving and hiding posts. InboxManager operates on the inbox, etc.

Models

Defined in net.dean.jraw.models

All models are read-only objects instantiated with a Jackson JsonNode parsed from responses from the reddit API. See the Models page for more.

Pagination

Defined in net.dean.jraw.paginators.

Paginators is how JRAW handles reddit's paginated data. For example, a SubredditPaginator could iterate through /r/pics. See the Paginators page for more.

Getting Started

See Quickstart