Releases: mattbdean/JRAW
v1.1.0
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.flagAsSpoilerandSubmissionReference.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.onUserChallengesometimes 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 ofUserReference.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
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
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 asgetCreatedUtc()- SubredditPaginator constructor takes varargs in order to fulfill the functionality of the now-removed CompoundSubredditPaginator
AccountManager.updateSelfpostrenamed toupdateContribution, now takes a PublicContribution rather than aSubmissionto 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 varargsHttpLogger.Component.RESPONSE_BODY_ALWAYS_FULLis now implemented as a property (setResponseBodyAlwaysFull())
New features
- Captcha support for private messages (thanks to @rubenmayayo)
- Added
getSuggestedSort(),isLocked(), andgetThumbnails()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
API Changes
- Added the
net.dean.jraw.authpackage. 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.
SubredditStreamnow handles calls to/subreddits/defaultEndpoints.USER_USERNAME_LIKEDrenamed toUSER_USERNAME_UPVOTED. Likewise forUSER_USERNAME_DISLIKED.- Added
PublicContribution.getRemovalReason() - Added
Submission.getPostHint() OkHttpAdapternow accepts anOkHttpClientas a parameter in its constructor- Removed toolbar-related methods in
AccountPreferencesandAccountPreferencesEditor AccountManager.save()accepts aPublicContributioninstead of aSubmission
Internal
- Fixed a bug where
OAuthData.getScopes()was not returning the expected result. - Added
hashCodeandequalsmethods toThing - Fixed a big where
OAuthHelperremoved its own refresh token after the first refresh
v0.7.1
What's new in this release:
API Changes
LiveThreadManagerclass 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.WEEKconstant
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
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()andCredentials.webapp()(#51) - Added more properties to
AccountPreferencesEditor(see here for a full list) EmbeddedMediahas been removed, as its only purpose was to feed the website data. API consumers should use oEmbed (Submission.getOEmbedMedia()) instead.AllSubredditsPaginatorhas been renamed toSubredditStream- Iterate through new comments from a subreddit using
CommentStream
CommentNode
- [!!!]
CommentNodenow bears the responsibility of loading a Comment's children. Consequently,Comment.getReplies()has been replaced byCommentNode.getChildren() CommentNode.loadFully()can fully expand a comment treeCommentNodenow implementsIterableto 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 alphanumericHttpLoggernow always logs at the correct level
v0.7.0.2
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
InvalidScopeExceptionthat is thrown when the client does not use the required scope - Ability to revoke both access tokens and refresh tokens using
OAuthHelper.revokeAccessToken()andrevokeRefreshToken()respectively
Multireddits
- More data provided by the API now, so
MultiReddithas changed accordingly. See here fore more. - Get a user's public multireddits using
MultiRedditManager.getPublicMultis(String)
Other
RedditClient.isLoggedIn()renamed toisAuthenticated()- Added
LoggedInAccount.getCreddits() - Username mentions in
InboxPaginator - Javadoc for the
modelspackage cleaned up a great bit. - Updated Gradle to 2.3
v0.7.0.1
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.
RedditOAuth2Clienthas been merged withRedditClientSubmission.getComments()now returns aCommentNode, which provides the ability to easily traverse the comment tree.NetworkExceptionis now aRuntimeException, meaning you no longer have to catch it if you don't want to.- Addition of the
UserAgentclass, assists with standardizing theUser-Agentheader Morewas renamed toMoreChildrenAbstractManagerandPaginatordid not need to implementNetworkAccessible, so they do not now.RedditClient.SubmissionRequestis 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
Paginatorsclass 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
Main changes in this release:
- New library-inspecific HTTP client design. See commit
ec88e60for more. - HTTP logging is disabled by default
JrawUtilsmethods renamed. See commit0ce88cdfor more.- Switch to Guava's MediaType instead of OkHttp's
- Migrated to Jackson 2
- Removed
Votable'sgetUpvotes()andgetDownvotes(). See commit0c81a0e