-
Notifications
You must be signed in to change notification settings - Fork 125
Fluent API
Matt Dean edited this page Jan 3, 2018
·
4 revisions
This is for version 0.9.0 and below. The documentation for v1.0.0+ can be found here
NB: The fluent API is currently incubating and can change at any time.
The fluent API attempts to provide a simple and concise way to use RedditClient
's features. All you have to do to use this API is to construct a new FluentRedditClient
.
FluentRedditClient fluent = new FluentRedditClient(redditClient);
Note that FluentRedditClient
is NOT a subclass of RedditClient
, but rather its own object. Additionally, the RedditClient
provided in the constructor must have already been authenticated.
Here are some examples of the fluent API:
// Get a list of pages in a subreddit's wiki
List<String> wikiPages = fluent.subreddit("pics").wiki().pages();
// Subscribe to a subreddit
fluent.subreddit("pics").subscribe();
// Get current flair
FlairTemplate currentFlair = fluent.subreddit("pics").flair().current();
// Submit a link
Submission submission = fluent.subreddit("programming")
.submit("https://github.com/thatJavaNerd/JRAW", "A pretty cool reddit API wrapper");
Methods that make a networking request are annotated with NetworkingCall