|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.social.oauth2.AbstractOAuth2ApiBinding org.springframework.social.facebook.api.impl.FacebookTemplate
public class FacebookTemplate
This is the central class for interacting with Facebook.
There are some operations, such as searching, that do not require OAuth
authentication. In those cases, you may use a FacebookTemplate
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.
Field Summary |
---|
Fields inherited from interface org.springframework.social.facebook.api.GraphApi |
---|
GRAPH_API_URL |
Constructor Summary | |
---|---|
FacebookTemplate()
Create a new instance of FacebookTemplate. |
|
FacebookTemplate(String accessToken)
Create a new instance of FacebookTemplate. |
|
FacebookTemplate(String accessToken,
String applicationNamespace)
|
Method Summary | ||
---|---|---|
CommentOperations |
commentOperations()
API for reading and posting comments. |
|
protected void |
configureRestTemplate(RestTemplate restTemplate)
|
|
void |
delete(String objectId)
Deletes an object. |
|
void |
delete(String objectId,
String connectionType)
Deletes an object connection. |
|
EventOperations |
eventOperations()
API for performing operations on events. |
|
FeedOperations |
feedOperations()
API for performing operations on feeds. |
|
|
fetchConnections(String objectId,
String connectionType,
Class<T> type,
MultiValueMap<String,String> queryParameters)
Fetches connections, extracting them into a collection of the given Java type Requires appropriate permission to fetch the object connection. |
|
|
fetchConnections(String objectId,
String connectionType,
Class<T> type,
MultiValueMap<String,String> queryParameters,
String... fields)
Fetches connections, extracting them into a collection of the given Java type Requires appropriate permission to fetch the object connection. |
|
|
fetchConnections(String objectId,
String connectionType,
Class<T> type,
String... fields)
Fetches connections, extracting them into a collection of the given Java type Requires appropriate permission to fetch the object connection. |
|
byte[] |
fetchImage(String objectId,
String connectionType,
ImageType type)
Fetches an image as an array of bytes. |
|
|
fetchObject(String objectId,
Class<T> type)
Fetches an object, extracting it into the given Java type Requires appropriate permission to fetch the object. |
|
|
fetchObject(String objectId,
Class<T> type,
MultiValueMap<String,String> queryParameters)
Fetches an object, extracting it into the given Java type Requires appropriate permission to fetch the object. |
|
|
fetchPagedConnections(String objectId,
String connectionType,
Class<T> type,
MultiValueMap<String,String> queryParameters)
|
|
FqlOperations |
fqlOperations()
API for performing Facebook Query Language (FQL) queries. |
|
FriendOperations |
friendOperations()
API for performing operations with a user's set of friends. |
|
String |
getApplicationNamespace()
|
|
protected MappingJackson2HttpMessageConverter |
getJsonMessageConverter()
|
|
protected org.springframework.social.oauth2.OAuth2Version |
getOAuth2Version()
|
|
GroupOperations |
groupOperations()
API for performing operations on groups. |
|
LikeOperations |
likeOperations()
API for performing operations against user likes and interests. |
|
MediaOperations |
mediaOperations()
API for performing operations on albums, photos, and videos. |
|
OpenGraphOperations |
openGraphOperations()
API for working with OpenGraph actions. |
|
PageOperations |
pageOperations()
API for working with Facebook pages. |
|
PlacesOperations |
placesOperations()
API for performing Facebook Places checkin operations. |
|
void |
post(String objectId,
String connectionType,
MultiValueMap<String,String> data)
Publishes data to an object's connection. |
|
String |
publish(String objectId,
String connectionType,
MultiValueMap<String,Object> data)
Publishes data to an object's connection. |
|
QuestionOperations |
questionOperations()
API for performing question operations. |
|
RestOperations |
restOperations()
Returns the underlying RestOperations object allowing for consumption of Facebook endpoints that may not be otherwise covered by the API binding. |
|
void |
setRequestFactory(ClientHttpRequestFactory requestFactory)
|
|
UserOperations |
userOperations()
API for performing operations on Facebook user profiles. |
Methods inherited from class org.springframework.social.oauth2.AbstractOAuth2ApiBinding |
---|
getByteArrayMessageConverter, getFormMessageConverter, getMessageConverters, getRestTemplate, isAuthorized |
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 |
---|
public FacebookTemplate()
NotAuthorizedException
.
public FacebookTemplate(String accessToken)
accessToken
- An access token given by Facebook after a successful OAuth 2 authentication (or through Facebook's JS library).public FacebookTemplate(String accessToken, String applicationNamespace)
Method Detail |
---|
public void setRequestFactory(ClientHttpRequestFactory requestFactory)
setRequestFactory
in class org.springframework.social.oauth2.AbstractOAuth2ApiBinding
public UserOperations userOperations()
Facebook
userOperations
in interface Facebook
public PlacesOperations placesOperations()
Facebook
placesOperations
in interface Facebook
public LikeOperations likeOperations()
Facebook
likeOperations
in interface Facebook
public FriendOperations friendOperations()
Facebook
friendOperations
in interface Facebook
public FeedOperations feedOperations()
Facebook
feedOperations
in interface Facebook
public GroupOperations groupOperations()
Facebook
groupOperations
in interface Facebook
public CommentOperations commentOperations()
Facebook
commentOperations
in interface Facebook
public EventOperations eventOperations()
Facebook
eventOperations
in interface Facebook
public MediaOperations mediaOperations()
Facebook
mediaOperations
in interface Facebook
public PageOperations pageOperations()
Facebook
pageOperations
in interface Facebook
public RestOperations restOperations()
Facebook
RestOperations
object allowing for consumption of Facebook endpoints that may not be otherwise covered by the API binding.
The RestOperations object returned is configured to include an OAuth 2 "Authorization" header on all requests.
restOperations
in interface Facebook
public FqlOperations fqlOperations()
Facebook
fqlOperations
in interface Facebook
public QuestionOperations questionOperations()
Facebook
questionOperations
in interface Facebook
public OpenGraphOperations openGraphOperations()
Facebook
openGraphOperations
in interface Facebook
public String getApplicationNamespace()
getApplicationNamespace
in interface Facebook
getApplicationNamespace
in interface GraphApi
public <T> T fetchObject(String objectId, Class<T> type)
GraphApi
fetchObject
in interface GraphApi
objectId
- the Facebook object's IDtype
- the Java type to fetch
public <T> T fetchObject(String objectId, Class<T> type, MultiValueMap<String,String> queryParameters)
GraphApi
fetchObject
in interface GraphApi
objectId
- the Facebook object's IDtype
- the Java type to fetchqueryParameters
- query parameters to include in the request
public <T> PagedList<T> fetchConnections(String objectId, String connectionType, Class<T> type, String... fields)
GraphApi
fetchConnections
in interface GraphApi
objectId
- the ID of the object to retrieve the connections for.connectionType
- the connection name.type
- the Java type of each connection.fields
- the fields to include in the response.
public <T> PagedList<T> fetchConnections(String objectId, String connectionType, Class<T> type, MultiValueMap<String,String> queryParameters)
GraphApi
fetchConnections
in interface GraphApi
objectId
- the ID of the object to retrieve the connections for.connectionType
- the connection name.type
- the Java type of each connection.queryParameters
- query parameters to include in the request
public <T> PagedList<T> fetchPagedConnections(String objectId, String connectionType, Class<T> type, MultiValueMap<String,String> queryParameters)
public <T> PagedList<T> fetchConnections(String objectId, String connectionType, Class<T> type, MultiValueMap<String,String> queryParameters, String... fields)
GraphApi
fetchConnections
in interface GraphApi
objectId
- the ID of the object to retrieve the connections for.connectionType
- the connection name.type
- the Java type of each connection.queryParameters
- query parameters to include in the requestfields
- the fields to include in the response.
public byte[] fetchImage(String objectId, String connectionType, ImageType type)
GraphApi
fetchImage
in interface GraphApi
objectId
- the object IDconnectionType
- the connection nametype
- the type of image to retrieve (eg., small, normal, large, or square)
public String publish(String objectId, String connectionType, MultiValueMap<String,Object> data)
GraphApi
publish
in interface GraphApi
objectId
- the object ID to publish to.connectionType
- the connection name to publish to.data
- the data to publish to the connection.
public void post(String objectId, String connectionType, MultiValueMap<String,String> data)
GraphApi
post
in interface GraphApi
objectId
- the object ID to publish to.connectionType
- the connection name to publish to.data
- the data to publish to the connection.public void delete(String objectId)
GraphApi
delete
in interface GraphApi
objectId
- the object IDpublic void delete(String objectId, String connectionType)
GraphApi
delete
in interface GraphApi
objectId
- the object IDconnectionType
- the connection nameprotected org.springframework.social.oauth2.OAuth2Version getOAuth2Version()
getOAuth2Version
in class org.springframework.social.oauth2.AbstractOAuth2ApiBinding
protected void configureRestTemplate(RestTemplate restTemplate)
configureRestTemplate
in class org.springframework.social.oauth2.AbstractOAuth2ApiBinding
protected MappingJackson2HttpMessageConverter getJsonMessageConverter()
getJsonMessageConverter
in class org.springframework.social.oauth2.AbstractOAuth2ApiBinding
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |