org.springframework.integration.twitter.core
Class Twitter4jTemplate

java.lang.Object
  extended by org.springframework.integration.twitter.core.Twitter4jTemplate
All Implemented Interfaces:
TwitterOperations

public class Twitter4jTemplate
extends java.lang.Object
implements TwitterOperations

Implementation of TwitterOperations that delegates to Twitter4J.

Since:
2.0

Constructor Summary
Twitter4jTemplate()
          Used to construct this template to perform Twitter API calls that do not require authorization.
Twitter4jTemplate(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String accessToken, java.lang.String accessTokenSecret)
          Used to construct this template with OAuth authentication/authorization to perform Twitter API calls that do require authorization (e.g., send/receive DirectMessage)
 
Method Summary
 java.util.List<Tweet> getDirectMessages()
           
 java.util.List<Tweet> getDirectMessages(long sinceId)
           
 java.util.List<Tweet> getMentions()
           
 java.util.List<Tweet> getMentions(long sinceId)
           
 java.lang.String getProfileId()
          Retrieves the user's Twitter screen name.
 java.util.List<Tweet> getTimeline()
           
 java.util.List<Tweet> getTimeline(long sinceId)
           
 twitter4j.Twitter getUnderlyingTwitter()
          Temporary method.
 SearchResults search(java.lang.String query)
          Searches Twitter, returning the first page of Tweets
 SearchResults search(java.lang.String query, long sinceId)
          Searches Twitter, returning a specific page out of the complete set of results.
 void sendDirectMessage(int userId, java.lang.String text)
           
 void sendDirectMessage(java.lang.String userName, java.lang.String text)
           
 void updateStatus(java.lang.String statusTweet)
          Updates the user's status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Twitter4jTemplate

public Twitter4jTemplate()
Used to construct this template to perform Twitter API calls that do not require authorization. (e.g., search)


Twitter4jTemplate

public Twitter4jTemplate(java.lang.String consumerKey,
                         java.lang.String consumerSecret,
                         java.lang.String accessToken,
                         java.lang.String accessTokenSecret)
Used to construct this template with OAuth authentication/authorization to perform Twitter API calls that do require authorization (e.g., send/receive DirectMessage)

Parameters:
consumerKey -
consumerSecret -
accessToken -
accessTokenSecret -
Method Detail

getProfileId

public java.lang.String getProfileId()
Description copied from interface: TwitterOperations
Retrieves the user's Twitter screen name.

Specified by:
getProfileId in interface TwitterOperations
Returns:
the user's screen name at Twitter

getDirectMessages

public java.util.List<Tweet> getDirectMessages()
Specified by:
getDirectMessages in interface TwitterOperations

getDirectMessages

public java.util.List<Tweet> getDirectMessages(long sinceId)
Specified by:
getDirectMessages in interface TwitterOperations

getMentions

public java.util.List<Tweet> getMentions()
Specified by:
getMentions in interface TwitterOperations

getMentions

public java.util.List<Tweet> getMentions(long sinceId)
Specified by:
getMentions in interface TwitterOperations

getTimeline

public java.util.List<Tweet> getTimeline()
Specified by:
getTimeline in interface TwitterOperations

getTimeline

public java.util.List<Tweet> getTimeline(long sinceId)
Specified by:
getTimeline in interface TwitterOperations

sendDirectMessage

public void sendDirectMessage(java.lang.String userName,
                              java.lang.String text)
Specified by:
sendDirectMessage in interface TwitterOperations

sendDirectMessage

public void sendDirectMessage(int userId,
                              java.lang.String text)
Specified by:
sendDirectMessage in interface TwitterOperations

updateStatus

public void updateStatus(java.lang.String statusTweet)
Description copied from interface: TwitterOperations
Updates the user's status.

Specified by:
updateStatus in interface TwitterOperations
Parameters:
statusTweet - The status message

search

public SearchResults search(java.lang.String query)
Description copied from interface: TwitterOperations
Searches Twitter, returning the first page of Tweets

Specified by:
search in interface TwitterOperations
Parameters:
query - The search query string
Returns:
a SearchResults containing Tweets

search

public SearchResults search(java.lang.String query,
                            long sinceId)
Description copied from interface: TwitterOperations
Searches Twitter, returning a specific page out of the complete set of results.

Specified by:
search in interface TwitterOperations
Parameters:
query - The search query string
sinceId - The minimum Tweet ID to return in the results
Returns:
a SearchResults containing Tweets

getUnderlyingTwitter

public twitter4j.Twitter getUnderlyingTwitter()
Description copied from interface: TwitterOperations
Temporary method. Should be removed one migrated to Spring Social

Specified by:
getUnderlyingTwitter in interface TwitterOperations