Example usage for twitter4j Status getContributors

List of usage examples for twitter4j Status getContributors

Introduction

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

Prototype

long[] getContributors();

Source Link

Document

Returns an array of contributors, or null if no contributor is associated with this status.

Usage

From source file:twitterswingclient.TwitterClient.java

private void updateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateActionPerformed
    // TODO add your handling code here:
    String consKey = "Your key";
    String consSecret = "Your secret";
    String accToken = "Your key";
    String accSecret = "Your secret";
    try {//  w  w  w  .java  2s.  c o  m

        TwitterFactory twitterFactory = new TwitterFactory();

        Twitter twitter = twitterFactory.getInstance();

        twitter.setOAuthConsumer(consKey, consSecret);

        twitter.setOAuthAccessToken(new AccessToken(accToken, accSecret));

        StatusUpdate statusUpdate = new StatusUpdate(status.getText());

        statusUpdate.setMedia("Feeling great",
                new URL("http://media3.giphy.com/media/el1tH0BzEWm4w/giphy.gif").openStream());

        Status stat = twitter.updateStatus(statusUpdate);

        textArea.append("status.toString() = " + stat.toString());
        textArea.append("status.getInReplyToScreenName() = " + stat.getInReplyToScreenName());
        textArea.append("status.getSource() = " + stat.getSource());
        textArea.append("status.getText() = " + stat.getText());
        textArea.append("status.getContributors() = " + Arrays.toString(stat.getContributors()));
        textArea.append("status.getCreatedAt() = " + stat.getCreatedAt());
        textArea.append("status.getCurrentUserRetweetId() = " + stat.getCurrentUserRetweetId());
        textArea.append("status.getGeoLocation() = " + stat.getGeoLocation());
        textArea.append("status.getId() = " + stat.getId());
        textArea.append("status.getInReplyToStatusId() = " + stat.getInReplyToStatusId());
        textArea.append("status.getInReplyToUserId() = " + stat.getInReplyToUserId());
        textArea.append("status.getPlace() = " + stat.getPlace());
        textArea.append("status.getRetweetCount() = " + stat.getRetweetCount());
        textArea.append("status.getRetweetedStatus() = " + stat.getRetweetedStatus());
        textArea.append("status.getUser() = " + stat.getUser());
        textArea.append("status.getAccessLevel() = " + stat.getAccessLevel());
        textArea.append("status.getHashtagEntities() = " + Arrays.toString(stat.getHashtagEntities()));
        textArea.append("status.getMediaEntities() = " + Arrays.toString(stat.getMediaEntities()));

        if (stat.getRateLimitStatus() != null) {
            textArea.append("status.getRateLimitStatus().getLimit() = " + stat.getRateLimitStatus().getLimit());
            textArea.append(
                    "status.getRateLimitStatus().getRemaining() = " + stat.getRateLimitStatus().getRemaining());
            textArea.append("status.getRateLimitStatus().getResetTimeInSeconds() = "
                    + stat.getRateLimitStatus().getResetTimeInSeconds());
            textArea.append("status.getRateLimitStatus().getSecondsUntilReset() = "
                    + stat.getRateLimitStatus().getSecondsUntilReset());
            textArea.append("status.getRateLimitStatus().getRemainingHits() = "
                    + stat.getRateLimitStatus().getRemaining());
        }
        textArea.append("status.getURLEntities() = " + Arrays.toString(stat.getURLEntities()));
        textArea.append("status.getUserMentionEntities() = " + Arrays.toString(stat.getUserMentionEntities()));

    } catch (IOException ex) {
        textArea.append("IO Exception");
    } catch (TwitterException tw) {
        textArea.append("Twitter Exception");
    }
}