Search in sources :

Example 1 with ImportantUserPaginator

use of net.dean.jraw.paginators.ImportantUserPaginator in project Slide by ccrama.

the class UserSubscriptions method doFriendsOf.

private static List<String> doFriendsOf() {
    if (friends == null || friends.isEmpty()) {
        friends = new CaseInsensitiveArrayList();
        CaseInsensitiveArrayList finished = new CaseInsensitiveArrayList();
        ImportantUserPaginator pag = new ImportantUserPaginator(Authentication.reddit, "friends");
        pag.setLimit(100);
        try {
            while (pag.hasNext()) {
                for (UserRecord s : pag.next()) {
                    finished.add(s.getFullName());
                }
            }
            friends = (finished);
            return friends;
        } catch (Exception e) {
            // failed;
            e.printStackTrace();
        }
    }
    return friends;
}
Also used : UserRecord(net.dean.jraw.models.UserRecord) ImportantUserPaginator(net.dean.jraw.paginators.ImportantUserPaginator) ApiException(net.dean.jraw.ApiException) NetworkException(net.dean.jraw.http.NetworkException)

Aggregations

ApiException (net.dean.jraw.ApiException)1 NetworkException (net.dean.jraw.http.NetworkException)1 UserRecord (net.dean.jraw.models.UserRecord)1 ImportantUserPaginator (net.dean.jraw.paginators.ImportantUserPaginator)1