/** * Retrieves comments for a post * * @param id The unique id of a Post from which Comments will be returned. * @param sortMode The order that the Posts will be sorted by. Options are: "top" (ranked by * upvotes minus downvotes), "best" (similar to top, except that it uses a more complicated * algorithm to have good posts jump to the top and stay there, and bad comments to work their * way down, see http://blog.reddit.com/2009/10/reddits-new-comment-sorting-system.html), * "hot" (similar to "top", but weighted by time so that recent, popular posts are put near * the top), "new" (posts will be sorted by creation time). * @param callback The listener that will be given the data (or error) */ public void getComments( String subreddit, String id, String sortMode, final StructuredGetCommentsListener callback) { jsonInstance.getComments( subreddit, id, sortMode, new JsonGetCommentsListener() { @Override public void getCommentsFailed(Exception exception) { callback.getCommentsFailed(exception); } @Override public void getCommentsCompleted(String data) { callback.getCommentsCompleted(gson.fromJson(data, ArrayList.class)); } }); }
/** * Retrieves comments for a post * * @param id The unique id of a Post from which Comments will be returned. * @param sortMode The order that the Posts will be sorted by. Options are: "top" (ranked by * upvotes minus downvotes), "best" (similar to top, except that it uses a more complicated * algorithm to have good posts jump to the top and stay there, and bad comments to work their * way down, see http://blog.reddit.com/2009/10/reddits-new-comment-sorting-system.html), * "hot" (similar to "top", but weighted by time so that recent, popular posts are put near * the top), "new" (posts will be sorted by creation time). * @return HashMap<String, Object> */ public HashMap<String, Object> getComments(String subreddit, String id, String sortMode) throws Exception { return gson.fromJson(jsonInstance.getComments(subreddit, id, sortMode), LinkedHashMap.class); }