Spring Social Facebook

org.springframework.social.facebook.api
Interface GraphApi

All Known Subinterfaces:
Facebook
All Known Implementing Classes:
FacebookTemplate

public interface GraphApi

Defines low-level operations against Facebook's Graph API

Author:
Craig Walls

Field Summary
static java.lang.String GRAPH_API_URL
           
 
Method Summary
 void delete(java.lang.String objectId)
          Deletes an object.
 void delete(java.lang.String objectId, java.lang.String connectionName)
          Deletes an object connection.
<T> java.util.List<T>
fetchConnections(java.lang.String objectId, java.lang.String connectionName, java.lang.Class<T> type, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> queryParameters)
          Fetches connections, extracting them into a collection of the given Java type Requires appropriate permission to fetch the object connection.
<T> java.util.List<T>
fetchConnections(java.lang.String objectId, java.lang.String connectionName, java.lang.Class<T> type, java.lang.String... fields)
          Fetches connections, extracting them into a collection of the given Java type Requires appropriate permission to fetch the object connection.
 byte[] fetchImage(java.lang.String objectId, java.lang.String connectionName, ImageType imageType)
          Fetches an image as an array of bytes.
<T> T
fetchObject(java.lang.String objectId, java.lang.Class<T> type)
          Fetches an object, extracting it into the given Java type Requires appropriate permission to fetch the object.
<T> T
fetchObject(java.lang.String objectId, java.lang.Class<T> type, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> queryParameters)
          Fetches an object, extracting it into the given Java type Requires appropriate permission to fetch the object.
 void post(java.lang.String objectId, java.lang.String connectionName, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> data)
          Publishes data to an object's connection.
 java.lang.String publish(java.lang.String objectId, java.lang.String connectionName, org.springframework.util.MultiValueMap<java.lang.String,java.lang.Object> data)
          Publishes data to an object's connection.
 

Field Detail

GRAPH_API_URL

static final java.lang.String GRAPH_API_URL
See Also:
Constant Field Values
Method Detail

fetchObject

<T> T fetchObject(java.lang.String objectId,
                  java.lang.Class<T> type)
Fetches an object, extracting it into the given Java type Requires appropriate permission to fetch the object.

Parameters:
objectId - the Facebook object's ID
type - the Java type to fetch
Returns:
an Java object representing the requested Facebook object.

fetchObject

<T> T fetchObject(java.lang.String objectId,
                  java.lang.Class<T> type,
                  org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> queryParameters)
Fetches an object, extracting it into the given Java type Requires appropriate permission to fetch the object.

Parameters:
objectId - the Facebook object's ID
type - the Java type to fetch
queryParameters - query parameters to include in the request
Returns:
an Java object representing the requested Facebook object.

fetchConnections

<T> java.util.List<T> fetchConnections(java.lang.String objectId,
                                       java.lang.String connectionName,
                                       java.lang.Class<T> type,
                                       java.lang.String... fields)
Fetches connections, extracting them into a collection of the given Java type Requires appropriate permission to fetch the object connection.

Parameters:
objectId - the ID of the object to retrieve the connections for.
connectionName - the connection name.
type - the Java type of each connection.
fields - the fields to include in the response.
Returns:
a list of Java objects representing the Facebook objects in the connections.

fetchConnections

<T> java.util.List<T> fetchConnections(java.lang.String objectId,
                                       java.lang.String connectionName,
                                       java.lang.Class<T> type,
                                       org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> queryParameters)
Fetches connections, extracting them into a collection of the given Java type Requires appropriate permission to fetch the object connection.

Parameters:
objectId - the ID of the object to retrieve the connections for.
connectionName - the connection name.
type - the Java type of each connection.
queryParameters - query parameters to include in the request
Returns:
a list of Java objects representing the Facebook objects in the connections.

fetchImage

byte[] fetchImage(java.lang.String objectId,
                  java.lang.String connectionName,
                  ImageType imageType)
Fetches an image as an array of bytes.

Parameters:
objectId - the object ID
connectionName - the connection name
imageType - the type of image to retrieve (eg., small, normal, large, or square)
Returns:
an image as an array of bytes.

publish

java.lang.String publish(java.lang.String objectId,
                         java.lang.String connectionName,
                         org.springframework.util.MultiValueMap<java.lang.String,java.lang.Object> data)
Publishes data to an object's connection. Requires appropriate permission to publish to the object connection.

Parameters:
objectId - the object ID to publish to.
connectionName - the connection name to publish to.
data - the data to publish to the connection.
Returns:
the ID of the newly published object.

post

void post(java.lang.String objectId,
          java.lang.String connectionName,
          org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> data)
Publishes data to an object's connection. Requires appropriate permission to publish to the object connection. This differs from publish() only in that it doesn't attempt to extract the ID from the response. This is because some publish operations do not return an ID in the response.

Parameters:
objectId - the object ID to publish to.
connectionName - the connection name to publish to.
data - the data to publish to the connection.

delete

void delete(java.lang.String objectId)
Deletes an object. Requires appropriate permission to delete the object.

Parameters:
objectId - the object ID

delete

void delete(java.lang.String objectId,
            java.lang.String connectionName)
Deletes an object connection. Requires appropriate permission to delete the object connection.

Parameters:
objectId - the object ID
connectionName - the connection name

Spring Social Facebook