|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.code.facebookapi.ExtensibleClient<java.lang.Object>
com.google.code.facebookapi.FacebookJsonRestClient
public class FacebookJsonRestClient
A FacebookRestClient that uses the JSON result format. This means results from calls to the Facebook API are returned as JSON and
transformed into Java Object's.
| Field Summary | |
|---|---|
protected org.json.JSONArray |
cacheFriendsList
|
protected static org.apache.commons.logging.Log |
log
|
| Fields inherited from class com.google.code.facebookapi.ExtensibleClient |
|---|
_apiKey, _isDesktop, _readTimeout, _secret, _serverUrl, _timeout, BATCH_LIMIT, batchMode, cacheAppAdded, cacheAppUser, cacheSessionExpires, cacheSessionKey, cacheSessionSecret, cacheUserId, CRLF, HTTPS_SERVER_URL, JAXB_CONTEXT, MARKETPLACE_STATUS_DEFAULT, MARKETPLACE_STATUS_NOT_SUCCESS, MARKETPLACE_STATUS_SUCCESS, permissionsApiKey, PREF, queries, rawResponse, SERVER_URL, UPLOAD_BUFFER_SIZE |
| Fields inherited from interface com.google.code.facebookapi.IFacebookRestClient |
|---|
ERROR_TAG, FB_SERVER, HTTPS_SERVER_ADDR, SERVER_ADDR, TARGET_API_VERSION |
| Constructor Summary | |
|---|---|
FacebookJsonRestClient(java.lang.String apiKey,
java.lang.String secret)
Constructor. |
|
FacebookJsonRestClient(java.lang.String apiKey,
java.lang.String secret,
int connectionTimeout)
Constructor. |
|
FacebookJsonRestClient(java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey)
Constructor. |
|
FacebookJsonRestClient(java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey,
int connectionTimeout)
Constructor. |
|
FacebookJsonRestClient(java.lang.String serverAddr,
java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey)
Constructor. |
|
FacebookJsonRestClient(java.lang.String serverAddr,
java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey,
int connectionTimeout)
Constructor. |
|
FacebookJsonRestClient(java.net.URL serverUrl,
java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey)
Constructor. |
|
FacebookJsonRestClient(java.net.URL serverUrl,
java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey,
int connectionTimeout)
Constructor. |
|
FacebookJsonRestClient(java.net.URL serverUrl,
java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey,
int connectionTimeout,
int readTimeout)
Constructor. |
|
| Method Summary | |
|---|---|
java.lang.String |
admin_getAppPropertiesAsString(java.util.Collection<ApplicationProperty> properties)
Retrieve application properties. |
java.lang.String |
auth_getSession(java.lang.String authToken)
Sets the session information (sessionKey) using the token from auth_createToken. |
java.util.List<? extends java.lang.Object> |
executeBatch(boolean serial)
Executes a batch of queries. |
protected boolean |
extractBoolean(java.lang.Object val)
Extracts a Boolean from a result that consists of a Boolean only. |
protected int |
extractInt(java.lang.Object val)
Extracts an Integer from a result that consists of an Integer only. |
protected java.lang.Long |
extractLong(java.lang.Object val)
Extracts a Long from a result that consists of an Long only. |
java.lang.String |
extractString(java.lang.Object val)
Extracts a String from a result consisting entirely of a String. |
protected java.net.URL |
extractURL(java.lang.Object url)
Extracts a URL from a result that consists of a URL only. |
org.json.JSONArray |
friends_get()
Retrieves the friends of the currently logged in user. |
org.json.JSONArray |
getCacheFriendsList()
Return the object's 'friendsList' property. |
java.lang.String |
getResponseFormat()
The response format in which results to FacebookMethod calls are returned |
java.util.List<Listing> |
marketplace_getListings(java.util.List<java.lang.Long> listingIds,
java.util.List<java.lang.Long> uids)
Retrieve listings from the marketplace. |
java.util.List<java.lang.String> |
marketplace_getSubCategories()
Return a list of all valid Marketplace subcategories. |
java.util.List<Listing> |
marketplace_search(MarketListingCategory category,
MarketListingSubcategory subcategory,
java.lang.String searchTerm)
Search the marketplace listings by category, subcategory, and keyword. |
protected java.lang.Object |
parseCallResult(java.io.InputStream data,
IFacebookMethod method)
Parses the result of an API call from JSON into Java Objects. |
void |
setCacheFriendsList(java.util.List<java.lang.Long> ids)
Set/override the list of friends stored in the client. |
static org.json.JSONArray |
toFriendsGetResponse(java.util.List<java.lang.Long> ids)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
protected org.json.JSONArray cacheFriendsList
| Constructor Detail |
|---|
public FacebookJsonRestClient(java.lang.String apiKey,
java.lang.String secret)
apiKey - your Facebook API keysecret - your 'secret' Facebook key
public FacebookJsonRestClient(java.lang.String apiKey,
java.lang.String secret,
int connectionTimeout)
apiKey - your Facebook API keysecret - your 'secret' Facebook keyconnectionTimeout - the connection timeout to apply when making API requests to Facebook, in milliseconds
public FacebookJsonRestClient(java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey)
apiKey - your Facebook API keysecret - your 'secret' Facebook keysessionKey - the session-id to use
public FacebookJsonRestClient(java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey,
int connectionTimeout)
apiKey - your Facebook API keysecret - your 'secret' Facebook keysessionKey - the session-id to useconnectionTimeout - the connection timeout to apply when making API requests to Facebook, in milliseconds
public FacebookJsonRestClient(java.lang.String serverAddr,
java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey)
throws java.net.MalformedURLException
serverAddr - the URL of the Facebook API server to useapiKey - your Facebook API keysecret - your 'secret' Facebook keysessionKey - the session-id to use
java.net.MalformedURLException - if you specify an invalid URL
public FacebookJsonRestClient(java.lang.String serverAddr,
java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey,
int connectionTimeout)
throws java.net.MalformedURLException
serverAddr - the URL of the Facebook API server to useapiKey - your Facebook API keysecret - your 'secret' Facebook keysessionKey - the session-id to useconnectionTimeout - the connection timeout to apply when making API requests to Facebook, in milliseconds
java.net.MalformedURLException - if you specify an invalid URL
public FacebookJsonRestClient(java.net.URL serverUrl,
java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey)
serverUrl - the URL of the Facebook API server to useapiKey - your Facebook API keysecret - your 'secret' Facebook keysessionKey - the session-id to use
public FacebookJsonRestClient(java.net.URL serverUrl,
java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey,
int connectionTimeout)
serverUrl - the URL of the Facebook API server to useapiKey - your Facebook API keysecret - your 'secret' Facebook keysessionKey - the session-id to useconnectionTimeout - the connection timeout to apply when making API requests to Facebook, in milliseconds
public FacebookJsonRestClient(java.net.URL serverUrl,
java.lang.String apiKey,
java.lang.String secret,
java.lang.String sessionKey,
int connectionTimeout,
int readTimeout)
serverUrl - the URL of the Facebook API server to useapiKey - your Facebook API keysecret - your 'secret' Facebook keysessionKey - the session-id to useconnectionTimeout - the connection timeout to apply when making API requests to Facebook, in millisecondsreadTimeout - the read timeout to apply when making API requests to Facebook, in milliseconds| Method Detail |
|---|
public java.lang.String getResponseFormat()
getResponseFormat in class ExtensibleClient<java.lang.Object>public java.lang.String extractString(java.lang.Object val)
extractString in class ExtensibleClient<java.lang.Object>val -
public java.lang.String auth_getSession(java.lang.String authToken)
throws FacebookException
auth_getSession in interface IFacebookRestClient<java.lang.Object>auth_getSession in class ExtensibleClient<java.lang.Object>authToken - the token returned by auth_createToken or passed back to your callback_url.
FacebookException
java.io.IOExceptionhttp://wiki.developers.facebook.com/index.php/Auth.getSession
protected java.lang.Object parseCallResult(java.io.InputStream data,
IFacebookMethod method)
throws FacebookException,
java.io.IOException
parseCallResult in class ExtensibleClient<java.lang.Object>data - an InputStream with the results of a request to the Facebook serversmethod - the method
FacebookException - if data represents an error
java.io.IOException - if data is not readableJSONObject
protected java.net.URL extractURL(java.lang.Object url)
throws java.io.IOException
extractURL in class ExtensibleClient<java.lang.Object>url -
java.io.IOExceptionprotected int extractInt(java.lang.Object val)
extractInt in class ExtensibleClient<java.lang.Object>val -
protected boolean extractBoolean(java.lang.Object val)
extractBoolean in class ExtensibleClient<java.lang.Object>val -
protected java.lang.Long extractLong(java.lang.Object val)
extractLong in class ExtensibleClient<java.lang.Object>val -
public java.util.List<Listing> marketplace_getListings(java.util.List<java.lang.Long> listingIds,
java.util.List<java.lang.Long> uids)
throws FacebookException
IFacebookRestClient
listingIds - the ids of listings to filter by, only listings matching the specified ids will be returned.uids - the ids of users to filter by, only listings submitted by those users will be returned.
FacebookException - if an error happens when executing the API call.
public java.util.List<java.lang.String> marketplace_getSubCategories()
throws FacebookException
IFacebookRestClient
FacebookException - if an error happens when executing the API call.
public java.util.List<Listing> marketplace_search(MarketListingCategory category,
MarketListingSubcategory subcategory,
java.lang.String searchTerm)
throws FacebookException
IFacebookRestClient
category - the category to search in, optional (unless subcategory is specified).subcategory - the subcategory to search in, optional.searchTerm - the keyword to search for, optional.
FacebookException - if an error happens when executing the API call.
public java.lang.String admin_getAppPropertiesAsString(java.util.Collection<ApplicationProperty> properties)
throws FacebookException
IFacebookRestClient
properties - a collection indicating the properties you are interested in retrieving.
FacebookException
public java.util.List<? extends java.lang.Object> executeBatch(boolean serial)
throws FacebookException
serial - set to true, and your batch queries will always execute serially, in the same order in which your specified them. If set to false, the Facebook API
server may execute your queries in parallel and/or out of order in order to improve performance.
FacebookException
java.io.IOExceptionpublic org.json.JSONArray getCacheFriendsList()
public void setCacheFriendsList(java.util.List<java.lang.Long> ids)
friendsList - the new list to use.public static org.json.JSONArray toFriendsGetResponse(java.util.List<java.lang.Long> ids)
public org.json.JSONArray friends_get()
throws FacebookException
IFacebookRestClient
friends_get in interface IFacebookRestClient<java.lang.Object>friends_get in class ExtensibleClient<java.lang.Object>FacebookExceptionhttp://wiki.developers.facebook.com/index.php/Friends.get
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||