jReddit


Source link: https://github.com/jReddit/jReddit

jReddit

What is jReddit?

jReddit is a wrapper for the Reddit API written in Java. Project started by Omer Elnour. Taken over for further development and maintenance by Karan Goel, Andrei Sfat, and Simon Kassing.

How to use jReddit?

We are currently in the transitional phase between cookie-based authentication and OAuth2. The previous version of jReddit (1.0.3), which uses the former, will no longer be supported by reddit beginning August. The latter is supported by the latest version of jReddit (1.0.4).

Latest version: 1.0.4

The latest version (1.0.4) can only be included by forking or directly copying source. When the build is stable, we will distribute it via Maven (as done with previous versions).

Old version (deprecated): 1.0.3

At the moment, jReddit 1.0.3 can be included in your project using:

Maven
<dependency>

<groupId>com.github.jreddit</groupId>

<artifactId>jreddit</artifactId>

<version>1.0.3</version> </dependency> 
Gradle
dependencies {

  compile group: 'com.github.jreddit', name: 'jreddit', version: '1.0.3' 
}
 

What can it do?

jReddit supports the creation of clients and bots using the Java language. It communicates using the reddit api, and all its actions are limited by the functionality offered there. It can for example authenticate apps using OAuth2, retrieve subreddits, submissions and comments, and perform various actions such as flairing, hiding and saving.

Examples

Examples can be found in Examples package. A full example Gradle (Android) project can be found in the Gradle example folder. To give you an impression, here is a code snippet for a simple example:

Connect a user

// Information about the app String userAgent = "jReddit: Reddit API Wrapper for Java"; String clientID = "JKJF3592jUIisfjNbZQ"; String redirectURI = "https://www.example.com/auth";  // Reddit application RedditApp redditApp = new RedditInstalledApp(clientID, redirectURI);
 RedditOAuthAgent agent = new RedditOAuthAgent(userAgent, redditApp);

  RedditClient client = new RedditHttpClient(userAgent, HttpClientBuilder.create().build());
  // Create a application-only token (will be valid for 1 hour) RedditToken token = agent.tokenAppOnly(false);
  // Create parser for request SubmissionsListingParser parser = new SubmissionsListingParser();
  // Create the request SubmissionsOfSubredditRequest request = (SubmissionsOfSubredditRequest) new SubmissionsOfSubredditRequest("programming", SubmissionSort.HOT).setLimit(100);
  // Perform and parse request, and store parsed result List<Submission> submissions = parser.parse(client.get(token, request));
  // Now print out the result (don't care about formatting) System.out.println(submissions);

Note: please see the reddit OAuth2 information page for more information on acquiring a client identifier, secret, and redirect URI.

What's next for jReddit?

The plan is to implement every feature documented here. To see which methods have been implemented, and which have not, see this file.

How to contribute?

It is recommend to start with forking and reading through the source code, in oder to understand the general structure and standards used. Then check the implemented_methods.md file to see which methods have not yet been implemented. Choose the ones you'd like to contribute to. When you implement a new request, make sure it is fully covered by testing (via JUnit), and that all other tests pass as well. Thorough documentation of your addition is appreciated.

Send in a pull request, including test, and it will be gladly merged to improve the library! :-)

Dependencies

  1. JSON-simple

  2. Apache HttpComponents

  3. SLF4J

  4. Apache OLTU

Resources

The Bluetooth Filter library allows for a more fine grained discovery. Developed with purpose-build Android application where they connect to one or two specific Bluetooth devices in mind. The Bluetooth Filter library allows those apps to only provide a minimum list of results to their users rather instead of the usual general list of all devices found.

Widget to calibrate sensors (Orientation). This Calibrator can be embedded in your own App.

Android library which can turn any View into a draggable dialog with swipe to dismiss feature.

Project to set up basics of a Java annotation processor.

Motivations

  • Provide a fluent and complete stack to write a custom annotation processor using Android Studio
  • Set up a robust testing strategy of the Processor implementation

An easy way to build RecyclerView.Adapter. This adapter also has multiple ItemViewType, if needed.

This ImageView is adjusted auto by aspect ratio.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes