public class TwitterTemplate extends org.springframework.social.oauth1.AbstractOAuth1ApiBinding implements Twitter
Most (not all) Twitter operations require OAuth authentication. To perform
such operations, TwitterTemplate
must be constructed with the minimal
amount of information required to sign requests to Twitter's API with an
OAuth Authorization
header.
Constructor and Description |
---|
TwitterTemplate(String clientToken)
Create a new instance of TwitterTemplate.
|
TwitterTemplate(String consumerKey,
String consumerSecret)
Create a new instance of TwitterTemplate.
|
TwitterTemplate(String consumerKey,
String consumerSecret,
String accessToken,
String accessTokenSecret)
Create a new instance of TwitterTemplate.
|
Modifier and Type | Method and Description |
---|---|
BlockOperations |
blockOperations() |
protected void |
configureRestTemplate(RestTemplate restTemplate) |
DirectMessageOperations |
directMessageOperations() |
FriendOperations |
friendOperations() |
GeoOperations |
geoOperations() |
protected FormHttpMessageConverter |
getFormMessageConverter() |
protected MappingJackson2HttpMessageConverter |
getJsonMessageConverter() |
RestTemplate |
getRestTemplate() |
ListOperations |
listOperations() |
RestOperations |
restOperations()
Returns the underlying
RestOperations object allowing for consumption of Twitter endpoints that may not be otherwise covered by the API binding. |
SearchOperations |
searchOperations() |
StreamingOperations |
streamingOperations() |
TimelineOperations |
timelineOperations() |
UserOperations |
userOperations() |
getByteArrayMessageConverter, getMessageConverters, isAuthorized, setRequestFactory
public TwitterTemplate(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret)
consumerKey
- the application's API keyconsumerSecret
- the application's API secretaccessToken
- an access token acquired through OAuth authentication with TwitteraccessTokenSecret
- an access token secret acquired through OAuth authentication with Twitterpublic TwitterTemplate(String clientToken)
OAuth2Operations.authenticateClient()
.clientToken
- an access token obtained through OAuth 2 client credentials grant with Twitter.public TwitterTemplate(String consumerKey, String consumerSecret)
OAuth2Operations.authenticateClient()
.consumerKey
- the application's API keyconsumerSecret
- the application's API secretpublic TimelineOperations timelineOperations()
timelineOperations
in interface Twitter
public FriendOperations friendOperations()
friendOperations
in interface Twitter
public ListOperations listOperations()
listOperations
in interface Twitter
public SearchOperations searchOperations()
searchOperations
in interface Twitter
public DirectMessageOperations directMessageOperations()
directMessageOperations
in interface Twitter
public UserOperations userOperations()
userOperations
in interface Twitter
public BlockOperations blockOperations()
blockOperations
in interface Twitter
public GeoOperations geoOperations()
geoOperations
in interface Twitter
public StreamingOperations streamingOperations()
streamingOperations
in interface Twitter
public RestOperations restOperations()
Twitter
RestOperations
object allowing for consumption of Twitter endpoints that may not be otherwise covered by the API binding.
The RestOperations object returned is configured to include an OAuth "Authorization" header on all requests.restOperations
in interface Twitter
public RestTemplate getRestTemplate()
getRestTemplate
in class org.springframework.social.oauth1.AbstractOAuth1ApiBinding
protected MappingJackson2HttpMessageConverter getJsonMessageConverter()
getJsonMessageConverter
in class org.springframework.social.oauth1.AbstractOAuth1ApiBinding
protected FormHttpMessageConverter getFormMessageConverter()
getFormMessageConverter
in class org.springframework.social.oauth1.AbstractOAuth1ApiBinding
protected void configureRestTemplate(RestTemplate restTemplate)
configureRestTemplate
in class org.springframework.social.oauth1.AbstractOAuth1ApiBinding