JRAW Versions Save

The Java Reddit API Wrapper

v1.1.0

5 years ago

Breaking changes

All versions after v1.0.0 will try to minimize breaking changes until the next major release (v2.0.0). However, there are some cases in which breaking changes are required between minor versions.

  • RedditClient.subreddits() returns a SubredditReference instead of a DefaultPaginator (#211)
  • The upper bound of RedditIterable (and therefore Paginator) has been changed from Any (Object in Java) to UniquelyIdentifiable (#249)
  • Submission.getThumbnail() is now nullable (#241)

Improvements

  • Streams are here! (#206, #249) A stream continuously polls the first page of some paginated data (e.g. the inbox, new comments, etc.) and emits new values when they are encountered. Here's a practical example:
for (c in redditClient.subreddit("RocketLeague").comments().build().stream()) {
    // Do something with the newly-created comment
}

  • Added RedditClient.searchSubreddits() (#212)
  • Added RedditClient.searchSubredditsByName() (#244)
  • All models are now Serializable
  • Added SubredditSort.BEST (see here)
  • Added SubredditReference.patchFlairList() (767ff28)
  • Added SubmissionReference.flagAsSpoiler and SubmissionReference.stickPost (#235, thanks to @canaangifford!)
  • OAuth2 web apps are now supported (#213)
  • Better support for serializing Listings (#234)
  • Better support for querying suspended/non-existent accounts (#252)

Bug fixes

  • Fixed a bug that caused AccountHelper to use the wrong credentials when calling switchToUserless() (#210)
  • Encountering a user profile while browsing subreddits no longer throws an exception (#216)
  • Tabs, newlines, and similar characters are now properly sent (#220)
  • Fixed a NPE when deserializing posts with embedded media (#227)
  • Fixed StatefulAuthHelper.onUserChallenge sometimes throwing a NPE (#231)
  • Fixed a rare JsonDataException where an int was too small to store the embedded media's cache age (#236)
  • Subreddit.getNsfw() no longer always returns null (#239)
  • Better handling of embedded media (#247, #248, thanks to @andsala!)
  • Comment.getAuthorFlairText() now works properly (#250)

Deprecations

  • UserReference.about() is deprecated in favor of UserReference.query() for better handling of suspended/non-existent accounts

Before:

Account account;
try {
    account = reddit.user("some username").about();
} catch (NullPointerException e) {
    // suspended site-wide
} catch (ApiException e) {
    // probably doesn't exist
}

After:

AccountQuery query = reddit.user("some username").query();
switch (query.getStatus()) {
    case EXISTS:
        Account account = query.getAccount();
        // do something
    case NON_EXISTENT:
        // do something
    case SUSPENDED:
        // do something
}

Dependencies

Dependency Before After
Kotlin 1.2.10 1.2.41
OkHttp 3.9.1 3.10.0
Moshi 1.5.0 1.6.0
AutoValue 1.5.3 1.5.4

v1.0.0

6 years ago

v1.0.0 is a total rewrite of the library in Kotlin. This is pretty much a brand new library, so I'd recommend checking out the documentation.

Big stuff:

  • No more messing around with managers. The new building block of the API is a Reference.
  • The API is much more fluent. For example here's what you do to subscribe to a subreddit:
redditClient.subreddit("pics").subscribe();
  • Access tokens are now automatically refreshed unless you tell your RedditClient not to
  • No more Thing/RedditObject class. All model classes extend Object.
  • A lot easier to authenticate and get started. For example, here's how to authenticate a script app:
RedditClient reddit = OAuthHelper.automatic(networkAdapter, credentials);
  • No more dozens of Paginator sublcasses, now there's only 3.
  • Paginator sorting has been reworked (thanks to @eduard-netsajev)
  • Rate limiting is handled more consistently. A RateLimitException is thrown when appropriate.
  • Paginator settings are immutable once built
  • Get instant updates for live threads via web sockets (see here)

Internals

  • Guava is no longer a dependency, switched from Jackson to Moshi
    • Rate limiting is done in-house
    • Comment tree traversal is done in-house
    • Cut down on ~10k methods for Android builds
  • JRAW is tightly bound to OkHttp for simplicity

v0.9.0

7 years ago

Thank you to all who contributed to this release! JRAW v0.9.0 contains several breaking changes as well as many bug fixes and enhancements.

Breaking API changes

Class definitions
  • Moved Dimension, JrawUtils, NoSuchEnumConstantException, and Version classes into new package net.dean.jraw.util
  • Award renamed to Trophy
  • Removed CompoundSubredditPaginator (merged with SubredditPaginator)
  • Captcha related methods in RedditClient can moved to net.dean.jraw.managers.CaptchaHelper
  • RelatedPaginator removed as the reddit API no longer supports it
Method definitions
  • getCreatedUtc() methods have been removed. getCreated() now returns UTC dates and functions the same way as getCreatedUtc()
  • SubredditPaginator constructor takes varargs in order to fulfill the functionality of the now-removed CompoundSubredditPaginator
  • AccountManager.updateSelfpost renamed to updateContribution, now takes a PublicContribution rather than a Submission to allow for comment editing
  • AccountPreferencesEditor simplified down to key-value pairs instead of methods for each property
  • InboxManager.setRead() now supports multiple messages to mark as read.
  • RedditClient.getPreferences() now accepts a List instead of varargs
  • HttpLogger.Component.RESPONSE_BODY_ALWAYS_FULL is now implemented as a property (setResponseBodyAlwaysFull())

New features

  • Captcha support for private messages (thanks to @rubenmayayo)
  • Added getSuggestedSort(), isLocked(), and getThumbnails() to Submission
  • Fluent API: Added AuthenticatedUserReference and InboxReference
  • UserSubredditsPaginator now has two accumulateMergedAll() methods for easily gathering a list of all of a user's subreddits (thanks to @worker8)
  • Added CloudSearch support to SubmissionSearchPaginator
  • Added missing Q&A comment sort
  • Added Sorting.GILDED

Internal changes

  • Script and application-only apps now authenticate with less network overhead (thanks to @fbis251)
  • OkHttpClient timeout set to 10 seconds by default
  • Updated to OkHttp 3
  • Gradle wrapper updated to 2.13 (thanks to @fbis251)

Bug fixes

  • Fixed multireddit URL detection regex (thanks to @rubenmayayo)
  • Fixed RedditClient.getTrophies() (thanks to @rubenmayayo)
  • Submission.getThumbnailType() now properly handles a null thumbnail (thanks to @zglazer)
  • Fixed loading a thread continuation on some instances
  • Fixed multireddit sorting (thanks to @ccrama)
  • RedditClient.getSubreddit() now throws an IllegalArgumentException when the subreddit is not viewable instead of failing later when trying to access JSON data
  • Handle HTTP 204 No Content responses that don't have Content-Type headers (thanks to @zglazer)

v0.8.0

8 years ago

API Changes

  • Added the net.dean.jraw.auth package. Helps manage OAuth2 flow, especially on mobile apps. See the updated OAuth2 wiki page for more.
  • Introduce the fluent API. See the wiki for more.
  • SubredditStream now handles calls to /subreddits/default
  • Endpoints.USER_USERNAME_LIKED renamed to USER_USERNAME_UPVOTED. Likewise for USER_USERNAME_DISLIKED.
  • Added PublicContribution.getRemovalReason()
  • Added Submission.getPostHint()
  • OkHttpAdapter now accepts an OkHttpClient as a parameter in its constructor
  • Removed toolbar-related methods in AccountPreferences and AccountPreferencesEditor
  • AccountManager.save() accepts a PublicContribution instead of a Submission

Internal

  • Fixed a bug where OAuthData.getScopes() was not returning the expected result.
  • Added hashCode and equals methods to Thing
  • Fixed a big where OAuthHelper removed its own refresh token after the first refresh

v0.7.1

9 years ago

What's new in this release:

API Changes

  • LiveThreadManager class provides CRUD operations on live threads.
  • Concrete model classes are now final
  • RedditClient constructor no longer accepts a 'requests per minute' argument since the ratelimit is set dynamically now
  • Added missing TimePeriod.WEEK constant

Internal

  • RedditClient's retry limit now applies to any server-side error, not just 503's

Meta

  • Update OkHttp from 2.2.0 to 2.3.0

This is not a comprehensive change set. Changes from v0.7.0.x were not included.

v0.7.0.3

9 years ago

NB: This is a time-based release. It is not to be considered stable but is provided for those who want the latest and greatest features of the library.

API Changes

  • RedditClient now automatically retries a request if reddit throws a 503 at it. The amount of times the client will retry is configurable using RedditClient.setRetryLimit().
  • Removed the username and password arguments in Credentials.installedApp() and Credentials.webapp() (#51)
  • Added more properties to AccountPreferencesEditor (see here for a full list)
  • EmbeddedMedia has been removed, as its only purpose was to feed the website data. API consumers should use oEmbed (Submission.getOEmbedMedia()) instead.
  • AllSubredditsPaginator has been renamed to SubredditStream
  • Iterate through new comments from a subreddit using CommentStream
CommentNode
  • [!!!] CommentNode now bears the responsibility of loading a Comment's children. Consequently, Comment.getReplies() has been replaced by CommentNode.getChildren()
  • CommentNode.loadFully() can fully expand a comment tree
  • CommentNode now implements Iterable to iterate over direct children

Documentation

  • A fullname is now referred to as such in the docs, not as "full name."

Bug Fixes

  • CommentNode now handles 'continue this thread' MoreChildren properly (#56)
  • JrawUtils.isFullname() now allows the ID to be alphanumeric
  • HttpLogger now always logs at the correct level

v0.7.0.2

9 years ago

NB: This is a time-based release. It is not to be considered stable but is provided for those who want the latest and greatest features of the library.

Main features in this release:

OAuth

  • Ability to set the refresh token using OAuthHelper.setRefreshToken()
  • New class InvalidScopeException that is thrown when the client does not use the required scope
  • Ability to revoke both access tokens and refresh tokens using OAuthHelper.revokeAccessToken() and revokeRefreshToken() respectively

Multireddits

  • More data provided by the API now, so MultiReddit has changed accordingly. See here fore more.
  • Get a user's public multireddits using MultiRedditManager.getPublicMultis(String)

Other

  • RedditClient.isLoggedIn() renamed to isAuthenticated()
  • Added LoggedInAccount.getCreddits()
  • Username mentions in InboxPaginator
  • Javadoc for the models package cleaned up a great bit.
  • Updated Gradle to 2.3

v0.7.0.1

9 years ago

NB: This is a time-based release. It is not to be considered stable but is provided for those who want the latest and greatest features of the library.

Main features in this release:

  • FULL support for OAuth2, including refreshing and revoking access tokens, and application-only (user-less) authentication. See the wiki for the adjusted API.
  • Removal of cookie authentication, since it is deprecated. See #47.
  • Endpoints not usable with OAuth (registering, OAuth app management, etc.) have been removed.
  • RedditOAuth2Client has been merged with RedditClient
  • Submission.getComments() now returns a CommentNode, which provides the ability to easily traverse the comment tree.
  • NetworkException is now a RuntimeException, meaning you no longer have to catch it if you don't want to.
  • Addition of the UserAgent class, assists with standardizing the User-Agent header
  • More was renamed to MoreChildren
  • AbstractManager and Paginator did not need to implement NetworkAccessible, so they do not now.
  • RedditClient.SubmissionRequest is now its own class (net.dean.jraw.http.SubmissionRequest) and properly implements the builder pattern
  • Implemented the endpoints under the "creddits" scope. However, these are untested.
  • The Paginators class was removed since there is no reason to have factory methods for classes that have simple, public constructors

Also, make sure to check out the new wiki pages on OAuth2 and getting started.

v0.7.0

9 years ago

Main changes in this release:

  • New library-inspecific HTTP client design. See commit ec88e60 for more.
  • HTTP logging is disabled by default
  • JrawUtils methods renamed. See commit 0ce88cd for more.
  • Switch to Guava's MediaType instead of OkHttp's
  • Migrated to Jackson 2
  • Removed Votable's getUpvotes() and getDownvotes(). See commit 0c81a0e

v0.6.1

9 years ago

Minor patch release

  • Update OkHttp to v2.1.0
  • Fixed an issue when Gradle downloaded OkHttp v2.1.0 but expected v2.0.0