|
Spring Social Twitter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.social.oauth1.AbstractOAuth1ApiBinding
org.springframework.social.twitter.api.impl.TwitterTemplate
public class TwitterTemplate
This is the central class for interacting with 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.
There are some operations, such as searching, that do not require OAuth
authentication. In those cases, you may use a TwitterTemplate
that is
created through the default constructor and without any OAuth details.
Attempts to perform secured operations through such an instance, however,
will result in NotAuthorizedException
being thrown.
Constructor Summary | |
---|---|
TwitterTemplate()
Deprecated. Because all resources now require authorization, this constructor isn't very useful. It will be removed in Spring Social Twitter 1.1.0. |
|
TwitterTemplate(java.lang.String clientToken)
Create a new instance of TwitterTemplate. |
|
TwitterTemplate(java.lang.String consumerKey,
java.lang.String consumerSecret,
java.lang.String accessToken,
java.lang.String accessTokenSecret)
Create a new instance of TwitterTemplate. |
Method Summary | |
---|---|
BlockOperations |
blockOperations()
Returns the portion of the Twitter API containing the block operations. |
protected void |
configureRestTemplate(org.springframework.web.client.RestTemplate restTemplate)
|
DirectMessageOperations |
directMessageOperations()
Returns the portion of the Twitter API containing the direct message operations. |
FriendOperations |
friendOperations()
Returns the portion of the Twitter API containing the friends and followers operations. |
GeoOperations |
geoOperations()
Returns the portion of the Twitter API containing the geo location operations. |
protected org.springframework.http.converter.json.MappingJacksonHttpMessageConverter |
getJsonMessageConverter()
|
org.springframework.web.client.RestTemplate |
getRestTemplate()
|
ListOperations |
listOperations()
Returns the portion of the Twitter API containing the user list operations. |
org.springframework.web.client.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()
Returns the portion of the Twitter API containing the search operations. |
TimelineOperations |
timelineOperations()
Returns the portion of the Twitter API containing the tweet and timeline operations. |
UserOperations |
userOperations()
Returns the portion of the Twitter API containing the user operations. |
Methods inherited from class org.springframework.social.oauth1.AbstractOAuth1ApiBinding |
---|
getByteArrayMessageConverter, getFormMessageConverter, getMessageConverters, isAuthorized, setRequestFactory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.social.ApiBinding |
---|
isAuthorized |
Constructor Detail |
---|
@Deprecated public TwitterTemplate()
NotAuthorizedException
.
As of v1.1 of Twitter's API, all resources require authorization. Therefore, any instance of TwitterTemplate
created with this constructor will be effectively useless.
public TwitterTemplate(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String accessToken, java.lang.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(java.lang.String clientToken)
OAuth2Operations.authenticateClient()
.
clientToken
- an access token obtained through OAuth 2 client credentials grant with Twitter.Method Detail |
---|
public TimelineOperations timelineOperations()
Twitter
timelineOperations
in interface Twitter
public FriendOperations friendOperations()
Twitter
friendOperations
in interface Twitter
public ListOperations listOperations()
Twitter
listOperations
in interface Twitter
public SearchOperations searchOperations()
Twitter
searchOperations
in interface Twitter
public DirectMessageOperations directMessageOperations()
Twitter
directMessageOperations
in interface Twitter
public UserOperations userOperations()
Twitter
userOperations
in interface Twitter
public BlockOperations blockOperations()
Twitter
blockOperations
in interface Twitter
public GeoOperations geoOperations()
Twitter
geoOperations
in interface Twitter
public org.springframework.web.client.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 org.springframework.web.client.RestTemplate getRestTemplate()
getRestTemplate
in class org.springframework.social.oauth1.AbstractOAuth1ApiBinding
protected org.springframework.http.converter.json.MappingJacksonHttpMessageConverter getJsonMessageConverter()
getJsonMessageConverter
in class org.springframework.social.oauth1.AbstractOAuth1ApiBinding
protected void configureRestTemplate(org.springframework.web.client.RestTemplate restTemplate)
configureRestTemplate
in class org.springframework.social.oauth1.AbstractOAuth1ApiBinding
|
Spring Social Twitter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |