|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FacebookClient
Specifies how a Facebook Graph API client must operate.
Projects that need to access the old REST API
should use LegacyFacebookClient
instead. You might choose to do this
because you have a legacy codebase or you need functionality that is not yet
available in the Graph API.
If you'd like to...
fetchObject(String, Class, Parameter...)
or
fetchObjects(List, Class, Parameter...)
fetchConnection(String, Class, Parameter...)
executeQuery(String, Class, Parameter...)
or
executeMultiquery(Map, Class, Parameter...)
executeBatch(BatchRequest...)
or executeBatch(List, List)
publish(String, Class, Parameter...)
or
publish(String, Class, BinaryAttachment, Parameter...)
deleteObject(String)
Nested Class Summary | |
---|---|
static class |
FacebookClient.AccessToken
Represents an access token/expiration date pair. |
Method Summary | ||
---|---|---|
List<FacebookClient.AccessToken> |
convertSessionKeysToAccessTokens(String appId,
String secretKey,
String... sessionKeys)
Converts an arbitrary number of sessionKeys to OAuth access tokens. |
|
boolean |
deleteObject(String object)
Performs a Graph API delete operation on the given object . |
|
List<BatchResponse> |
executeBatch(BatchRequest... batchRequests)
Executes operations as a batch using the Batch API. |
|
List<BatchResponse> |
executeBatch(List<BatchRequest> batchRequests,
List<BinaryAttachment> binaryAttachments)
Executes operations as a batch with binary attachments using the Batch API. |
|
|
executeMultiquery(Map<String,String> queries,
Class<T> objectType,
Parameter... parameters)
Executes an FQL multiquery, which allows you to batch multiple queries into a single request. |
|
|
executeQuery(String query,
Class<T> objectType,
Parameter... parameters)
Executes an FQL query, mapping the resultset to a List of instances of objectType . |
|
|
fetchConnection(String connection,
Class<T> connectionType,
Parameter... parameters)
Fetches a Graph API Connection type, mapping the result to an
instance of connectionType . |
|
|
fetchConnectionPage(String connectionPageUrl,
Class<T> connectionType)
Fetches a previous/next page of a Graph API Connection type,
mapping the result to an instance of connectionType . |
|
|
fetchObject(String object,
Class<T> objectType,
Parameter... parameters)
Fetches a single Graph API object, mapping the result to an instance of objectType . |
|
|
fetchObjects(List<String> ids,
Class<T> objectType,
Parameter... parameters)
Fetches multiple Graph API objects in a single call, mapping the results to an instance of objectType . |
|
JsonMapper |
getJsonMapper()
Gets the JsonMapper used to convert Facebook JSON to Java objects. |
|
WebRequestor |
getWebRequestor()
Gets the WebRequestor used to talk to the Facebook API endpoints. |
|
|
publish(String connection,
Class<T> objectType,
BinaryAttachment binaryAttachment,
Parameter... parameters)
Performs a Graph API publish operation on the given connection and includes a file -
a photo, for example - in the publish request, and mapping the result to an
instance of objectType . |
|
|
publish(String connection,
Class<T> objectType,
Parameter... parameters)
Performs a Graph API publish operation on the given connection , mapping the result
to an instance of objectType . |
Method Detail |
---|
<T> T fetchObject(String object, Class<T> objectType, Parameter... parameters)
objectType
.
T
- Java type to map to.object
- ID of the object to fetch, e.g. "me"
.objectType
- Object type token.parameters
- URL parameters to include in the API call (optional).
objectType
which contains the requested
object's data.
FacebookException
- If an error occurs while performing the API call.<T> T fetchObjects(List<String> ids, Class<T> objectType, Parameter... parameters)
objectType
.
You'll need to write your own container type (objectType
) to hold
the results. See http://restfb.com for an
example of how to do this.
T
- Java type to map to.ids
- IDs of the objects to fetch, e.g. "me", "arjun"
.objectType
- Object type token.parameters
- URL parameters to include in the API call (optional).
objectType
which contains the requested
objects' data.
FacebookException
- If an error occurs while performing the API call.<T> Connection<T> fetchConnection(String connection, Class<T> connectionType, Parameter... parameters)
Connection
type, mapping the result to an
instance of connectionType
.
T
- Java type to map to.connection
- The name of the connection, e.g. "me/feed"
.connectionType
- Connection type token.parameters
- URL parameters to include in the API call (optional).
connectionType
which contains the
requested Connection's data.
FacebookException
- If an error occurs while performing the API call.<T> Connection<T> fetchConnectionPage(String connectionPageUrl, Class<T> connectionType)
Connection
type,
mapping the result to an instance of connectionType
.
T
- Java type to map to.connectionPageUrl
- The URL of the connection page to fetch, usually retrieved via
Connection.getPreviousPageUrl()
or
Connection.getNextPageUrl()
.connectionType
- Connection type token.
connectionType
which contains the
requested Connection's data.
FacebookException
- If an error occurs while performing the API call.<T> List<T> executeQuery(String query, Class<T> objectType, Parameter... parameters)
List
of instances of objectType
.
T
- Java type to map to.query
- The FQL query to execute, e.g.
"SELECT name FROM user WHERE uid=220439 or uid=7901103"
.objectType
- Resultset object type token.parameters
- URL parameters to include in the API call (optional).
objectType
which map to the query
results.
FacebookException
- If an error occurs while performing the API call.<T> T executeMultiquery(Map<String,String> queries, Class<T> objectType, Parameter... parameters)
You'll need to write your own container type (objectType
) to hold
the results. See http://restfb.com for an
example of how to do this.
T
- Java type to map to.queries
- A mapping of query names to queries. This is marshaled to JSON and
sent over the wire to the Facebook API endpoint as the
queries
parameter.objectType
- Object type token.parameters
- URL parameters to include in the API call (optional).
objectType
which contains the requested
objects' data.
FacebookException
- If an error occurs while performing the API call.List<BatchResponse> executeBatch(BatchRequest... batchRequests)
batchRequests
- The operations to execute.
List<BatchResponse> executeBatch(List<BatchRequest> batchRequests, List<BinaryAttachment> binaryAttachments)
batchRequests
- The operations to execute.binaryAttachments
- Binary attachments referenced by the batch requests.
<T> T publish(String connection, Class<T> objectType, Parameter... parameters)
connection
, mapping the result
to an instance of objectType
.
T
- Java type to map to.connection
- The Connection to publish to.objectType
- Object type token.parameters
- URL parameters to include in the API call.
objectType
which contains the Facebook
response to your publish request.
FacebookException
- If an error occurs while performing the API call.<T> T publish(String connection, Class<T> objectType, BinaryAttachment binaryAttachment, Parameter... parameters)
connection
and includes a file -
a photo, for example - in the publish request, and mapping the result to an
instance of objectType
.
T
- Java type to map to.connection
- The Connection to publish to.objectType
- Object type token.binaryAttachment
- The file to include in the publish request.parameters
- URL parameters to include in the API call.
objectType
which contains the Facebook
response to your publish request.
FacebookException
- If an error occurs while performing the API call.boolean deleteObject(String object)
object
.
object
- The ID of the object to delete.
true
if Facebook indicated that the object was successfully
deleted, false
otherwise.
FacebookException
- If an error occurred while attempting to delete the object.List<FacebookClient.AccessToken> convertSessionKeysToAccessTokens(String appId, String secretKey, String... sessionKeys)
sessionKeys
to OAuth access tokens.
See the Facebook Platform Upgrade Guide for details on how this process works and why you should convert your application's session keys if you haven't already.
appId
- A Facebook application ID.secretKey
- A Facebook application secret key.sessionKeys
- The Old REST API session keys to be converted to OAuth access
tokens.
sessionKeys
argument list.
FacebookException
- If an error occurs while attempting to convert the session keys
to API keys.JsonMapper getJsonMapper()
JsonMapper
used to convert Facebook JSON to Java objects.
JsonMapper
used to convert Facebook JSON to Java
objects.WebRequestor getWebRequestor()
WebRequestor
used to talk to the Facebook API endpoints.
WebRequestor
used to talk to the Facebook API
endpoints.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |