com.restfb
Interface LegacyFacebookClient

All Known Implementing Classes:
DefaultLegacyFacebookClient

public interface LegacyFacebookClient

Specifies how a Legacy Facebook API client must operate.

Implementors must support Legacy authentication (API Key, Application Secret, and Session Key) as well as the new OAuth authentication method. Using OAuth authentication is much simpler and strongly recommended.

Green-field projects should use the new Facebook Graph API via FacebookClient instead.

Author:
Mark Allen

Method Summary
<T> T
execute(String method, Class<T> resultType, Parameter... parameters)
          Executes a Facebook API method with the given parameters, mapping the API response to a single instance of type resultType.
 void execute(String method, Parameter... parameters)
          Executes a Facebook API method with the given parameters, ignoring the response.
<T> T
execute(String method, String sessionKey, Class<T> resultType, Parameter... parameters)
          Deprecated. Use execute(String, Class, Parameter...) instead. Facebook is moving to OAuth and will stop supporting the old session key authentication scheme soon.
 void execute(String method, String sessionKey, Parameter... parameters)
          Deprecated. Use execute(String, Parameter...) instead. Facebook is moving to OAuth and will stop supporting the old session key authentication scheme soon.
<T> List<T>
executeForList(String method, Class<T> resultType, Parameter... parameters)
          Executes a Facebook API method with the given parameters, mapping the API response to a List of instances of type resultType.
<T> List<T>
executeForList(String method, String sessionKey, Class<T> resultType, Parameter... parameters)
          Deprecated. Use executeForList(String, Class, Parameter...) instead. Facebook is moving to OAuth and will stop supporting the old session key authentication scheme soon.
<T> T
executeMultiquery(Map<String,String> queries, Class<T> resultType, Parameter... additionalParameters)
          Executes the fql.multiquery API call, mapping the API response to a single instance of type resultType.
<T> T
executeMultiquery(Map<String,String> queries, String sessionKey, Class<T> resultType, Parameter... additionalParameters)
          Deprecated. Use executeMultiquery(Map, Class, Parameter...) instead. Facebook is moving to OAuth and will stop supporting the old session key authentication scheme soon.
 

Method Detail

execute

void execute(String method,
             Parameter... parameters)
Executes a Facebook API method with the given parameters, ignoring the response.

Parameters:
method - The Facebook API method to call, e.g. fql.query.
parameters - Parameters to include in the API call.
Throws:
FacebookException - If an error occurs while performing the API call.

execute

@Deprecated
void execute(String method,
                        String sessionKey,
                        Parameter... parameters)
Deprecated. Use execute(String, Parameter...) instead. Facebook is moving to OAuth and will stop supporting the old session key authentication scheme soon.

Executes a Facebook API method with the given parameters, ignoring the response.

Parameters:
method - The Facebook API method to call, e.g. fql.query.
sessionKey - A Facebook API session key if you're using the legacy API key/Secret key authentication scheme. Must be null if using OAuth access token authentication.
parameters - Parameters to include in the API call.
Throws:
FacebookException - If an error occurs while performing the API call.
IllegalArgumentException - If sessionKey is provided when using OAuth access token authentication.

execute

<T> T execute(String method,
              Class<T> resultType,
              Parameter... parameters)
Executes a Facebook API method with the given parameters, mapping the API response to a single instance of type resultType.

Type Parameters:
T - Java type to map to.
Parameters:
method - The Facebook API method to call, e.g. fql.query.
resultType - Result type token.
parameters - Parameters to include in the API call.
Returns:
An instance of type resultType which contains API response data.
Throws:
FacebookException - If an error occurs while performing the API call.

execute

@Deprecated
<T> T execute(String method,
                         String sessionKey,
                         Class<T> resultType,
                         Parameter... parameters)
Deprecated. Use execute(String, Class, Parameter...) instead. Facebook is moving to OAuth and will stop supporting the old session key authentication scheme soon.

Executes a Facebook API method with the given parameters, mapping the API response to a single instance of type resultType.

Type Parameters:
T - Java type to map to.
Parameters:
method - The Facebook API method to call, e.g. fql.query.
sessionKey - A Facebook API session key if you're using the legacy API key/Secret key authentication scheme. Must be null if using OAuth access token authentication.
resultType - Result type token.
parameters - Parameters to include in the API call.
Returns:
An instance of type resultType which contains API response data.
Throws:
FacebookException - If an error occurs while performing the API call.
IllegalArgumentException - If sessionKey is provided when using OAuth access token authentication.

executeForList

<T> List<T> executeForList(String method,
                           Class<T> resultType,
                           Parameter... parameters)
Executes a Facebook API method with the given parameters, mapping the API response to a List of instances of type resultType.

Type Parameters:
T - Java type to map to.
Parameters:
method - The Facebook API method to call, e.g. fql.query.
resultType - Result type token.
parameters - Parameters to include in the API call.
Returns:
A List of instances of type resultType which contain API response data.
Throws:
FacebookException - If an error occurs while performing the API call.

executeForList

@Deprecated
<T> List<T> executeForList(String method,
                                      String sessionKey,
                                      Class<T> resultType,
                                      Parameter... parameters)
Deprecated. Use executeForList(String, Class, Parameter...) instead. Facebook is moving to OAuth and will stop supporting the old session key authentication scheme soon.

Executes a Facebook API method with the given parameters, mapping the API response to a List of instances of type resultType.

Type Parameters:
T - Java type to map to.
Parameters:
method - The Facebook API method to call, e.g. fql.query.
sessionKey - A Facebook API session key if you're using the legacy API key/Secret key authentication scheme. Must be null if using OAuth access token authentication.
resultType - Result type token.
parameters - Parameters to include in the API call.
Returns:
A List of instances of type resultType which contain API response data.
Throws:
FacebookException - If an error occurs while performing the API call.
IllegalArgumentException - If sessionKey is provided when using OAuth access token authentication.

executeMultiquery

<T> T executeMultiquery(Map<String,String> queries,
                        Class<T> resultType,
                        Parameter... additionalParameters)
Executes the fql.multiquery API call, mapping the API response to a single instance of type resultType.

This method exists because the standard execute(String, Parameter...) and executeForList(String, Class, Parameter...) family of methods are not expressive enough to handle fql.multiquery in a non-verbose way.

Type Parameters:
T - Java type to map to.
Parameters:
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.
resultType - Result type token.
additionalParameters - Additional parameters to include in the API call.
Returns:
An instance of type resultType which contains API response data.
Throws:
FacebookException - If an error occurs while performing the API call.
Since:
1.1

executeMultiquery

@Deprecated
<T> T executeMultiquery(Map<String,String> queries,
                                   String sessionKey,
                                   Class<T> resultType,
                                   Parameter... additionalParameters)
Deprecated. Use executeMultiquery(Map, Class, Parameter...) instead. Facebook is moving to OAuth and will stop supporting the old session key authentication scheme soon.

Executes the fql.multiquery API call, mapping the API response to a single instance of type resultType.

This method exists because the standard execute(String, Parameter...) and executeForList(String, Class, Parameter...) family of methods are not expressive enough to handle fql.multiquery in a non-verbose way.

Type Parameters:
T - Java type to map to.
Parameters:
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.
sessionKey - A Facebook API session key if you're using the legacy API key/Secret key authentication scheme. Must be null if using OAuth access token authentication.
resultType - Result type token.
additionalParameters - Additional parameters to include in the API call.
Returns:
An instance of type resultType which contains API response data.
Throws:
FacebookException - If an error occurs while performing the API call.
IllegalArgumentException - If sessionKey is provided when using OAuth access token authentication.
Since:
1.1


Copyright © 2010-2011. All Rights Reserved.