Example usage for twitter4j Paging Paging

List of usage examples for twitter4j Paging Paging

Introduction

In this page you can find the example usage for twitter4j Paging Paging.

Prototype

public Paging(long sinceId) 

Source Link

Usage

From source file:com.github.moko256.mastodon.MastodonTwitterImpl.java

License:Apache License

@Override
public ResponseList<Status> getFavorites(long l) throws TwitterException {
    return getFavorites(l, new Paging(-1L));
}

From source file:com.github.moko256.mastodon.MastodonTwitterImpl.java

License:Apache License

@Override
public ResponseList<Status> getUserTimeline(String s) throws TwitterException {
    return getUserTimeline(s, new Paging(-1L));
}

From source file:com.github.moko256.mastodon.MastodonTwitterImpl.java

License:Apache License

@Override
public ResponseList<Status> getUserTimeline(long l) throws TwitterException {
    return getUserTimeline(l, new Paging(-1L));
}

From source file:com.github.moko256.mastodon.MastodonTwitterImpl.java

License:Apache License

@Override
public ResponseList<Status> getUserTimeline() throws TwitterException {
    return getUserTimeline(new Paging(-1L));
}

From source file:com.github.moko256.mastodon.MastodonTwitterImpl.java

License:Apache License

@Override
public ResponseList<Status> getHomeTimeline() throws TwitterException {
    return getHomeTimeline(new Paging(-1L));
}

From source file:com.ikungolf.java.javatwitter.directmessage.GetDirectMessages.java

License:Apache License

private String getLastestMessage() {
    Twitter twitter = new TwitterFactory().getInstance();
    String msg = new String();
    try {//from   ww  w.  jav  a  2 s .  c  o  m
        Paging paging = new Paging(1);
        List<DirectMessage> messages;

        messages = twitter.getDirectMessages(paging);
        System.out.println(messages.size());
        DirectMessage dm = messages.get(0);

        System.out.println("Message: " + dm.getText());
        messageId = dm.getId();
        if (messageId != tempMsgId) {
            tempMsgId = messageId;
        }
        msg = dm.getText();

    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to get messages: " + te.getMessage());
        System.exit(-1);
    }

    return msg;
}

From source file:com.ikungolf.java.javatwitter.directmessage.GetSentDirectMessages.java

License:Apache License

/**
 * Usage: java twitter4j.examples.directmessages.GetSentDirectMessages
 *
 * @param args message/*from   w ww .  java 2  s  .  c  o m*/
 */
public static void main(String[] args) {
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        Paging page = new Paging(1);
        List<DirectMessage> directMessages;
        do {
            directMessages = twitter.getSentDirectMessages(page);
            for (DirectMessage message : directMessages) {
                System.out.println("To: @" + message.getRecipientScreenName() + " id:" + message.getId() + " - "
                        + message.getText());
            }
            page.setPage(page.getPage() + 1);
        } while (directMessages.size() > 0 && page.getPage() < 10);
        System.out.println("done.");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to get sent messages: " + te.getMessage());
        System.exit(-1);
    }
}

From source file:com.illusionaryone.TwitterAPI.java

License:Open Source License

public List<Status> getUserTimeline(long sinceId) {
    if (accessToken == null) {
        com.gmt2001.Console.debug.println("Access Token is NULL");
        return null;
    }//ww w.  j  a  v a 2 s. co m

    try {
        com.gmt2001.Console.debug.println("Polling Data");
        if (sinceId != 0L) {
            Paging paging = new Paging(sinceId);
            List<Status> statuses = twitter.getUserTimeline(paging);
            if (statuses.isEmpty()) {
                return null;
            }
            return statuses;
        } else {
            List<Status> statuses = twitter.getUserTimeline();
            if (statuses.isEmpty()) {
                return null;
            }
            return statuses;
        }
    } catch (TwitterException ex) {
        com.gmt2001.Console.err.println("Failed: " + ex.getMessage());
        return null;
    }
}

From source file:com.illusionaryone.TwitterAPI.java

License:Open Source License

public List<Status> getHomeTimeline(long sinceId) {
    if (accessToken == null) {
        com.gmt2001.Console.debug.println("Access Token is NULL");
        return null;
    }/*from   w w  w .  j  a va  2s .  c  om*/

    try {
        com.gmt2001.Console.debug.println("Polling Data");
        if (sinceId != 0L) {
            Paging paging = new Paging(sinceId);
            List<Status> statuses = twitter.getHomeTimeline(paging);
            if (statuses.isEmpty()) {
                return null;
            }
            return statuses;
        } else {
            List<Status> statuses = twitter.getHomeTimeline();
            if (statuses.isEmpty()) {
                return null;
            }
            return statuses;
        }
    } catch (TwitterException ex) {
        com.gmt2001.Console.err.println("Failed: " + ex.getMessage());
        return null;
    }
}

From source file:com.illusionaryone.TwitterAPI.java

License:Open Source License

public List<Status> getRetweetsOfMe(long sinceId) {
    if (accessToken == null) {
        com.gmt2001.Console.debug.println("Access Token is NULL");
        return null;
    }/*from   w w  w.  j  a v  a2  s. c  o m*/

    try {
        com.gmt2001.Console.debug.println("Polling Data");
        if (sinceId != 0L) {
            Paging paging = new Paging(sinceId);
            List<Status> statuses = twitter.getRetweetsOfMe(paging);
            if (statuses.isEmpty()) {
                return null;
            }
            return statuses;
        } else {
            List<Status> statuses = twitter.getRetweetsOfMe();
            if (statuses.isEmpty()) {
                return null;
            }
            return statuses;
        }
    } catch (TwitterException ex) {
        com.gmt2001.Console.err.println("Failed: " + ex.getMessage());
        return null;
    }
}