|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.restfb.DefaultFacebookClient
public class DefaultFacebookClient
Default implementation of a Facebook Graph API client.
| Constructor Summary | |
|---|---|
DefaultFacebookClient()
Creates a Facebook Graph API client with no access token. |
|
DefaultFacebookClient(String accessToken)
Creates a Facebook Graph API client with the given accessToken. |
|
DefaultFacebookClient(String accessToken,
WebRequestor webRequestor,
JsonMapper jsonMapper)
Creates a Facebook Graph API client with the given accessToken,
webRequestor, and jsonMapper. |
|
| Method Summary | ||
|---|---|---|
boolean |
deleteObject(String object)
Performs a Graph API delete operation on the given object. |
|
|
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. |
|
|
fetchConnection(String connection,
Class<T> connectionType,
Parameter... parameters)
Fetches a Graph API Connection type. |
|
|
fetchObject(String object,
Class<T> objectType,
Parameter... parameters)
Fetches a single Graph API object. |
|
|
fetchObjects(List<String> ids,
Class<T> objectType,
Parameter... parameters)
Fetches multiple Graph API objects in a single call. |
|
|
publish(String connection,
Class<T> objectType,
InputStream binaryAttachment,
Parameter... parameters)
Performs a Graph API publish operation on the given connection and include a file -
a photo, for example - in the publish request. |
|
|
publish(String connection,
Class<T> objectType,
Parameter... parameters)
Performs a Graph API publish operation on the given connection. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultFacebookClient()
Without an access token, you can view and search public graph data but can't do much else.
public DefaultFacebookClient(String accessToken)
accessToken.
accessToken - A Facebook OAuth2 access token.
public DefaultFacebookClient(String accessToken,
WebRequestor webRequestor,
JsonMapper jsonMapper)
accessToken,
webRequestor, and jsonMapper.
accessToken - A Facebook OAuth2 access token.webRequestor - The WebRequestor implementation to use for sending
requests to the API endpoint.jsonMapper - The JsonMapper implementation to use for mapping API
response JSON to Java objects.
NullPointerException - If jsonMapper or webRequestor is null.| Method Detail |
|---|
public boolean deleteObject(String object)
throws FacebookException
FacebookClientobject.
deleteObject in interface FacebookClientobject - 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.FacebookClient.deleteObject(java.lang.String)
public <T> Connection<T> fetchConnection(String connection,
Class<T> connectionType,
Parameter... parameters)
throws FacebookException
FacebookClientConnection type.
fetchConnection in interface FacebookClientT - 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.FacebookClient.fetchConnection(java.lang.String,
java.lang.Class, com.restfb.Parameter[])
public <T> T fetchObject(String object,
Class<T> objectType,
Parameter... parameters)
throws FacebookException
FacebookClient
fetchObject in interface FacebookClientT - 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.FacebookClient.fetchObject(java.lang.String,
java.lang.Class, com.restfb.Parameter[])
public <T> T fetchObjects(List<String> ids,
Class<T> objectType,
Parameter... parameters)
throws FacebookException
FacebookClient
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.
fetchObjects in interface FacebookClientT - 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.FacebookClient.fetchObjects(java.util.List,
java.lang.Class, com.restfb.Parameter[])
public <T> T publish(String connection,
Class<T> objectType,
InputStream binaryAttachment,
Parameter... parameters)
throws FacebookException
FacebookClientconnection and include a file -
a photo, for example - in the publish request.
publish in interface FacebookClientT - Java type to map to.connection - The Connection to publish to.objectType - Object type token.binaryAttachment - The file to include in the publish request - a photo, for example.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.FacebookClient.publish(java.lang.String, java.lang.Class,
java.io.InputStream, com.restfb.Parameter[])
public <T> T publish(String connection,
Class<T> objectType,
Parameter... parameters)
throws FacebookException
FacebookClientconnection.
publish in interface FacebookClientT - 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.FacebookClient.publish(java.lang.String, java.lang.Class,
com.restfb.Parameter[])
public <T> T executeMultiquery(Map<String,String> queries,
Class<T> objectType,
Parameter... parameters)
throws FacebookException
FacebookClient
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.
executeMultiquery in interface FacebookClientT - 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.FacebookClient.executeMultiquery(java.util.Map,
java.lang.Class, com.restfb.Parameter[])
public <T> List<T> executeQuery(String query,
Class<T> objectType,
Parameter... parameters)
throws FacebookException
FacebookClient
executeQuery in interface FacebookClientT - 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.FacebookClient.executeQuery(java.lang.String,
java.lang.Class, com.restfb.Parameter[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||