org.springframework.social.facebook.api
Interface GraphApi

All Known Subinterfaces:
FacebookApi
All Known Implementing Classes:
FacebookTemplate

public interface GraphApi

Defines low-level operations against Facebook's Graph API


Field Summary
static java.lang.String CONNECTION_URL
           
static java.lang.String GRAPH_API_URL
           
static java.lang.String OBJECT_URL
           
 
Method Summary
 void delete(java.lang.String objectId)
          Deletes an object.
 void delete(java.lang.String objectId, java.lang.String connectionType)
          Deletes an object connection.
<T> T
fetchConnections(java.lang.String objectId, java.lang.String connectionType, java.lang.Class<T> type, java.lang.String... fields)
          Fetches connections, extracting them into a Java type via the given ResponseExtractor.
 byte[] fetchImage(java.lang.String objectId, java.lang.String connectionType, 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 type via the given ResponseExtractor.
 void post(java.lang.String objectId, java.lang.String connectionType, 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 connectionType, MultiValueMap<java.lang.String,java.lang.String> 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

OBJECT_URL

static final java.lang.String OBJECT_URL
See Also:
Constant Field Values

CONNECTION_URL

static final java.lang.String CONNECTION_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 type via the given ResponseExtractor. 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.

fetchConnections

<T> T fetchConnections(java.lang.String objectId,
                       java.lang.String connectionType,
                       java.lang.Class<T> type,
                       java.lang.String... fields)
Fetches connections, extracting them into a Java type via the given ResponseExtractor. Requires appropriate permission to fetch the object connection.

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

fetchImage

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

Parameters:
objectId - the object ID
connectionType - the connection type
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 connectionType,
                         MultiValueMap<java.lang.String,java.lang.String> 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.
connectionType - the connection type 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 connectionType,
          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.
connectionType - the connection type 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 connectionType)
Deletes an object connection. Requires appropriate permission to delete the object connection.

Parameters:
objectId - the object ID
connectionType - the connection type