A single request to be sent to the Facebook Platform through either the Graph API or REST API. The Request class provides functionality relating to serializing and deserializing requests and responses, making calls in batches (with a single round-trip to the service) and making calls asynchronously.
The particular service endpoint that a request targets is determined by either a graph path (see the setGraphPath.setGraphPath(String) method) or a REST method name (see the setRestMethod.setRestMethod(String) method); a single request may not target both.
A Request can be executed either anonymously or representing an authenticated user. In the former case, no Session needs to be specified, while in the latter, a Session that is in an opened state must be provided. If requests are executed in a batch, a Facebook application ID must be associated with the batch, either by supplying a Session for at least one of the requests in the batch (the first one found in the batch will be used) or by calling the setDefaultBatchApplicationId.setDefaultBatchApplicationId(String) method.
After completion of a request, its Session, if any, will be checked to determine if its Facebook access token needs to be extended; if so, a request to extend it will be issued in the background.
ขยาย: | Object |
แพ็คเกจ: | facebook |
Request()
Constructs a request without a session, graph path, or any other parameters.
public Request()
Request(Session, String)
Constructs a request with a Session to retrieve a particular graph path. A Session need not be provided, in which case the request is sent without an access token and thus is not executed in the context of any particular user. Only certain graph requests can be expected to succeed in this case. If a Session is provided, it must be in an opened state or the request will fail.
public Request(Session session, String graphPath)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null |
graphPath | The graph path to retrieve |
Request(Session, String, Bundle, HttpMethod)
Constructs a request with a specific Session, graph path, parameters, and HTTP method. A Session need not be provided, in which case the request is sent without an access token and thus is not executed in the context of any particular user. Only certain graph requests can be expected to succeed in this case. If a Session is provided, it must be in an opened state or the request will fail.
Depending on the httpMethod parameter, the object at the graph path may be retrieved, created, or deleted.
public Request(Session session, String graphPath, Bundle parameters, HttpMethod httpMethod)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null |
graphPath | The graph path to retrieve, create, or delete |
parameters | Additional parameters to pass along with the Graph API request; parameters must be Strings, Numbers, Bitmaps, Dates, or Byte arrays. |
httpMethod | The HttpMethod to use for the request, or null for default (HttpMethod.GET) |
Request(Session, String, Bundle, HttpMethod, Callback)
Constructs a request with a specific Session, graph path, parameters, and HTTP method. A Session need not be provided, in which case the request is sent without an access token and thus is not executed in the context of any particular user. Only certain graph requests can be expected to succeed in this case. If a Session is provided, it must be in an opened state or the request will fail.
Depending on the httpMethod parameter, the object at the graph path may be retrieved, created, or deleted.
public Request(Session session, String graphPath, Bundle parameters, HttpMethod httpMethod, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null |
graphPath | The graph path to retrieve, create, or delete |
parameters | Additional parameters to pass along with the Graph API request; parameters must be Strings, Numbers, Bitmaps, Dates, or Byte arrays. |
httpMethod | The HttpMethod to use for the request, or null for default (HttpMethod.GET) |
callback | A callback that will be called when the request is completed to handle success or error conditions |
Request(Session, String, Bundle, HttpMethod, Callback, String)
Constructs a request with a specific Session, graph path, parameters, and HTTP method. A Session need not be provided, in which case the request is sent without an access token and thus is not executed in the context of any particular user. Only certain graph requests can be expected to succeed in this case. If a Session is provided, it must be in an opened state or the request will fail.
Depending on the httpMethod parameter, the object at the graph path may be retrieved, created, or deleted.
public Request(Session session, String graphPath, Bundle parameters, HttpMethod httpMethod, Callback callback, String version)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null |
graphPath | The graph path to retrieve, create, or delete |
parameters | Additional parameters to pass along with the Graph API request; parameters must be Strings, Numbers, Bitmaps, Dates, or Byte arrays. |
httpMethod | The HttpMethod to use for the request, or null for default (HttpMethod.GET) |
callback | A callback that will be called when the request is completed to handle success or error conditions |
version | The version of the Graph API |
newPostRequest(Session, String, GraphObject, Callback)
Creates a new Request configured to post a GraphObject to a particular graph path, to either create or update the object at that path.
public static Request newPostRequest(Session session, String graphPath, GraphObject graphObject, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
graphPath | The graph path to retrieve, create, or delete |
graphObject | The GraphObject to create or update |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newRestRequest(Session, String, Bundle, HttpMethod)
Creates a new Request configured to make a call to the Facebook REST API.
public static Request newRestRequest(Session session, String restMethod, Bundle parameters, HttpMethod httpMethod)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
restMethod | The method in the Facebook REST API to execute |
parameters | Additional parameters to pass along with the Graph API request; parameters must be Strings, Numbers, Bitmaps, Dates, or Byte arrays. |
httpMethod | The HTTP method to use for the request; must be one of GET, POST, or DELETE |
newMeRequest(Session, GraphUserCallback)
Creates a new Request configured to retrieve a user's own profile.
public static Request newMeRequest(Session session, GraphUserCallback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newMyFriendsRequest(Session, GraphUserListCallback)
Creates a new Request configured to retrieve a user's friend list.
public static Request newMyFriendsRequest(Session session, GraphUserListCallback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newUploadPhotoRequest(Session, Bitmap, Callback)
Creates a new Request configured to upload a photo to the user's default photo album.
public static Request newUploadPhotoRequest(Session session, Bitmap image, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
image | The image to upload |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newUploadPhotoRequest(Session, File, Callback)
Creates a new Request configured to upload a photo to the user's default photo album. The photo will be read from the specified stream.
public static Request newUploadPhotoRequest(Session session, File file, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
file | The file containing the photo to upload |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newUploadVideoRequest(Session, File, Callback)
Creates a new Request configured to upload a photo to the user's default photo album. The photo will be read from the specified file descriptor.
public static Request newUploadVideoRequest(Session session, File file, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
file | The file to upload |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newGraphPathRequest(Session, String, Callback)
Creates a new Request configured to retrieve a particular graph path.
public static Request newGraphPathRequest(Session session, String graphPath, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
graphPath | The graph path to retrieve |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newPlacesSearchRequest(Session, Location, int, int, String, GraphPlaceListCallback)
Creates a new Request that is configured to perform a search for places near a specified location via the Graph API. At least one of location or searchText must be specified.
public static Request newPlacesSearchRequest(Session session, Location location, int radiusInMeters, int resultsLimit, String searchText, GraphPlaceListCallback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
location | The location around which to search; only the latitude and longitude components of the location are meaningful |
radiusInMeters | The radius around the location to search, specified in meters; this is ignored if no location is specified |
resultsLimit | The maximum number of results to return |
searchText | Optional text to search for as part of the name or type of an object |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newStatusUpdateRequest(Session, String, Callback)
Creates a new Request configured to post a status update to a user's feed.
public static Request newStatusUpdateRequest(Session session, String message, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
message | The text of the status update |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newStatusUpdateRequest(Session, String, GraphPlace, List, Callback)
Creates a new Request configured to post a status update to a user's feed.
public static Request newStatusUpdateRequest(Session session, String message, GraphPlace place, List tags, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
message | The text of the status update |
place | An optional place to associate with the post |
tags | An optional list of users to tag in the post |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newCustomAudienceThirdPartyIdRequest(Session, Context, Callback)
Creates a new Request configured to retrieve an App User ID for the app's Facebook user. Callers will send this ID back to their own servers, collect up a set to create a Facebook Custom Audience with, and then use the resultant Custom Audience to target ads.
The GraphObject in the response will include an "custom_audience_third_party_id" property, with the value being the ID retrieved. This ID is an encrypted encoding of the Facebook user's ID and the invoking Facebook app ID. Multiple calls with the same user will return different IDs, thus these IDs cannot be used to correlate behavior across devices or applications, and are only meaningful when sent back to Facebook for creating Custom Audiences.
The ID retrieved represents the Facebook user identified in the following way: if the specified session
(or activeSession if the specified session is null
) is open, the ID will represent the user associated with
the activeSession; otherwise the ID will represent the user logged into the native Facebook app on the device.
A null
ID will be provided into the callback if a) there is no native Facebook app, b) no one is logged into
it, or c) the app has previously called
Settings.setLimitEventAndDataUsage(android.content.Context, boolean) with true
for this user.
public static Request newCustomAudienceThirdPartyIdRequest(Session session, Context context, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to issue the Request on, or null; if non-null, the session must be in an opened state. If there is no logged-in Facebook user, null is the expected choice. |
context | The Application context from which the app ID will be pulled, and from which the 'attribution ID' for the Facebook user is determined. If there has been no app ID set, an exception will be thrown. |
callback | A callback that will be called when the request is completed to handle success or error conditions. The GraphObject in the Response will contain a "custom_audience_third_party_id" property that represents the user as described above. |
newCustomAudienceThirdPartyIdRequest(Session, Context, String, Callback)
Creates a new Request configured to retrieve an App User ID for the app's Facebook user. Callers will send this ID back to their own servers, collect up a set to create a Facebook Custom Audience with, and then use the resultant Custom Audience to target ads.
The GraphObject in the response will include an "custom_audience_third_party_id" property, with the value being the ID retrieved. This ID is an encrypted encoding of the Facebook user's ID and the invoking Facebook app ID. Multiple calls with the same user will return different IDs, thus these IDs cannot be used to correlate behavior across devices or applications, and are only meaningful when sent back to Facebook for creating Custom Audiences.
The ID retrieved represents the Facebook user identified in the following way: if the specified session
(or activeSession if the specified session is null
) is open, the ID will represent the user associated with
the activeSession; otherwise the ID will represent the user logged into the native Facebook app on the device.
A null
ID will be provided into the callback if a) there is no native Facebook app, b) no one is logged into
it, or c) the app has previously called
Settings.setLimitEventAndDataUsage(android.content.Context, boolean) ;} with true
for this user.
public static Request newCustomAudienceThirdPartyIdRequest(Session session, Context context, String applicationId, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to issue the Request on, or null; if non-null, the session must be in an opened state. If there is no logged-in Facebook user, null is the expected choice. |
context | The Application context from which the app ID will be pulled, and from which the 'attribution ID' for the Facebook user is determined. If there has been no app ID set, an exception will be thrown. |
applicationId | Explicitly specified Facebook App ID. If null, and there's a valid session, then the application ID from the session will be used, otherwise the application ID from metadata will be used. |
callback | A callback that will be called when the request is completed to handle success or error conditions. The GraphObject in the Response will contain a "custom_audience_third_party_id" property that represents the user as described above. |
newUploadStagingResourceWithImageRequest(Session, Bitmap, Callback)
Creates a new Request configured to upload an image to create a staging resource. Staging resources allow you to post binary data such as images, in preparation for a post of an Open Graph object or action which references the image. The URI returned when uploading a staging resource may be passed as the image property for an Open Graph object or action.
public static Request newUploadStagingResourceWithImageRequest(Session session, Bitmap image, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
image | The image to upload |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newUploadStagingResourceWithImageRequest(Session, File, Callback)
Creates a new Request configured to upload an image to create a staging resource. Staging resources allow you to post binary data such as images, in preparation for a post of an Open Graph object or action which references the image. The URI returned when uploading a staging resource may be passed as the image property for an Open Graph object or action.
public static Request newUploadStagingResourceWithImageRequest(Session session, File file, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
file | The file containing the image to upload |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newPostOpenGraphObjectRequest(Session, OpenGraphObject, Callback)
Creates a new Request configured to create a user owned Open Graph object.
public static Request newPostOpenGraphObjectRequest(Session session, OpenGraphObject openGraphObject, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
openGraphObject | The Open Graph object to create; must not be null, and must have a non-empty type and title |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newPostOpenGraphObjectRequest(Session, String, String, String, String, String, GraphObject, Callback)
Creates a new Request configured to create a user owned Open Graph object.
public static Request newPostOpenGraphObjectRequest(Session session, String type, String title, String imageUrl, String url, String description, GraphObject objectProperties, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
type | The fully-specified Open Graph object type (e.g., my_app_namespace:my_object_name); must not be null |
title | The title of the Open Graph object; must not be null |
imageUrl | The link to an image to be associated with the Open Graph object; may be null |
url | The url to be associated with the Open Graph object; may be null |
description | The description to be associated with the object; may be null |
objectProperties | Any additional type-specific properties for the Open Graph object; may be null |
callback | A callback that will be called when the request is completed to handle success or error conditions; may be null |
newPostOpenGraphActionRequest(Session, OpenGraphAction, Callback)
Creates a new Request configured to publish an Open Graph action.
public static Request newPostOpenGraphActionRequest(Session session, OpenGraphAction openGraphAction, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
openGraphAction | The Open Graph object to create; must not be null, and must have a non-empty 'type' |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newDeleteObjectRequest(Session, String, Callback)
Creates a new Request configured to delete a resource through the Graph API.
public static Request newDeleteObjectRequest(Session session, String id, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
id | The id of the object to delete |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newUpdateOpenGraphObjectRequest(Session, OpenGraphObject, Callback)
Creates a new Request configured to update a user owned Open Graph object.
public static Request newUpdateOpenGraphObjectRequest(Session session, OpenGraphObject openGraphObject, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
openGraphObject | The Open Graph object to update, which must have a valid 'id' property |
callback | A callback that will be called when the request is completed to handle success or error conditions |
newUpdateOpenGraphObjectRequest(Session, String, String, String, String, String, GraphObject, Callback)
Creates a new Request configured to update a user owned Open Graph object.
public static Request newUpdateOpenGraphObjectRequest(Session session, String id, String title, String imageUrl, String url, String description, GraphObject objectProperties, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
id | The id of the Open Graph object |
title | The title of the Open Graph object |
imageUrl | The link to an image to be associated with the Open Graph object |
url | The url to be associated with the Open Graph object |
description | The description to be associated with the object |
objectProperties | Any additional type-specific properties for the Open Graph object |
callback | A callback that will be called when the request is completed to handle success or error conditions |
getDefaultBatchApplicationId()
Gets the default Facebook application ID that will be used to submit batched requests if none of those requests specifies a Session. Batched requests require an application ID, so either at least one request in a batch must specify a Session or the application ID must be specified explicitly.
public static final String getDefaultBatchApplicationId()
setDefaultBatchApplicationId(String)
Sets the default application ID that will be used to submit batched requests if none of those requests specifies a Session. Batched requests require an application ID, so either at least one request in a batch must specify a Session or the application ID must be specified explicitly.
public static final void setDefaultBatchApplicationId(String applicationId)
พารามิเตอร์ | คำอธิบาย |
---|---|
applicationId | The Facebook application ID to use for batched requests if none can be determined |
executePostRequestAsync(Session, String, GraphObject, Callback)
Starts a new Request configured to post a GraphObject to a particular graph path, to either create or update the object at that path.
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newPostRequest(...).executeAsync();
public static RequestAsyncTask executePostRequestAsync(Session session, String graphPath, GraphObject graphObject, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
graphPath | The graph path to retrieve, create, or delete |
graphObject | The GraphObject to create or update |
callback | A callback that will be called when the request is completed to handle success or error conditions |
executeRestRequestAsync(Session, String, Bundle, HttpMethod)
Starts a new Request configured to make a call to the Facebook REST API.
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newRestRequest(...).executeAsync();
public static RequestAsyncTask executeRestRequestAsync(Session session, String restMethod, Bundle parameters, HttpMethod httpMethod)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
restMethod | The method in the Facebook REST API to execute |
parameters | Additional parameters to pass along with the Graph API request; parameters must be Strings, Numbers, Bitmaps, Dates, or Byte arrays. |
httpMethod | The HTTP method to use for the request; must be one of GET, POST, or DELETE |
executeMeRequestAsync(Session, GraphUserCallback)
Starts a new Request configured to retrieve a user's own profile.
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newMeRequest(...).executeAsync();
public static RequestAsyncTask executeMeRequestAsync(Session session, GraphUserCallback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
callback | A callback that will be called when the request is completed to handle success or error conditions |
executeMyFriendsRequestAsync(Session, GraphUserListCallback)
Starts a new Request configured to retrieve a user's friend list.
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newMyFriendsRequest(...).executeAsync();
public static RequestAsyncTask executeMyFriendsRequestAsync(Session session, GraphUserListCallback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
callback | A callback that will be called when the request is completed to handle success or error conditions |
executeUploadPhotoRequestAsync(Session, Bitmap, Callback)
Starts a new Request configured to upload a photo to the user's default photo album.
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newUploadPhotoRequest(...).executeAsync();
public static RequestAsyncTask executeUploadPhotoRequestAsync(Session session, Bitmap image, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
image | The image to upload |
callback | A callback that will be called when the request is completed to handle success or error conditions |
executeUploadPhotoRequestAsync(Session, File, Callback)
Starts a new Request configured to upload a photo to the user's default photo album. The photo will be read from the specified stream.
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newUploadPhotoRequest(...).executeAsync();
public static RequestAsyncTask executeUploadPhotoRequestAsync(Session session, File file, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
file | The file containing the photo to upload |
callback | A callback that will be called when the request is completed to handle success or error conditions |
executeGraphPathRequestAsync(Session, String, Callback)
Starts a new Request configured to retrieve a particular graph path.
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newGraphPathRequest(...).executeAsync();
public static RequestAsyncTask executeGraphPathRequestAsync(Session session, String graphPath, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
graphPath | The graph path to retrieve |
callback | A callback that will be called when the request is completed to handle success or error conditions |
executePlacesSearchRequestAsync(Session, Location, int, int, String, GraphPlaceListCallback)
Starts a new Request that is configured to perform a search for places near a specified location via the Graph API.
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newPlacesSearchRequest(...).executeAsync();
public static RequestAsyncTask executePlacesSearchRequestAsync(Session session, Location location, int radiusInMeters, int resultsLimit, String searchText, GraphPlaceListCallback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
location | The location around which to search; only the latitude and longitude components of the location are meaningful |
radiusInMeters | The radius around the location to search, specified in meters |
resultsLimit | The maximum number of results to return |
searchText | Optional text to search for as part of the name or type of an object |
callback | A callback that will be called when the request is completed to handle success or error conditions |
executeStatusUpdateRequestAsync(Session, String, Callback)
Starts a new Request configured to post a status update to a user's feed.
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newStatusUpdateRequest(...).executeAsync();
public static RequestAsyncTask executeStatusUpdateRequestAsync(Session session, String message, Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use, or null; if non-null, the session must be in an opened state |
message | The text of the status update |
callback | A callback that will be called when the request is completed to handle success or error conditions |
toHttpConnection(Request)
Serializes one or more requests but does not execute them. The resulting HttpURLConnection can be executed explicitly by the caller.
public static HttpURLConnection toHttpConnection(Request requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
requests | One or more Requests to serialize |
toHttpConnection(Collection)
Serializes one or more requests but does not execute them. The resulting HttpURLConnection can be executed explicitly by the caller.
public static HttpURLConnection toHttpConnection(Collection requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
requests | One or more Requests to serialize |
toHttpConnection(RequestBatch)
Serializes one or more requests but does not execute them. The resulting HttpURLConnection can be executed explicitly by the caller.
public static HttpURLConnection toHttpConnection(RequestBatch requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
requests | A RequestBatch to serialize |
executeAndWait(Request)
Executes a single request on the current thread and returns the response.
This should only be used if you have transitioned off the UI thread.
public static Response executeAndWait(Request request)
พารามิเตอร์ | คำอธิบาย |
---|---|
request | The Request to execute |
executeBatchAndWait(Request)
Executes requests on the current thread as a single batch and returns the responses.
This should only be used if you have transitioned off the UI thread.
public static List executeBatchAndWait(Request requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
requests | The Requests to execute |
executeBatchAndWait(Collection)
Executes requests as a single batch on the current thread and returns the responses.
This should only be used if you have transitioned off the UI thread.
public static List executeBatchAndWait(Collection requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
requests | The Requests to execute |
executeBatchAndWait(RequestBatch)
Executes requests on the current thread as a single batch and returns the responses.
This should only be used if you have transitioned off the UI thread.
public static List executeBatchAndWait(RequestBatch requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
requests | The batch of Requests to execute |
executeBatchAsync(Request)
Executes requests as a single batch asynchronously. This function will return immediately, and the requests will be processed on a separate thread. In order to process results of a request, or determine whether a request succeeded or failed, a callback must be specified (see the setCallback.setCallback(Callback) method).
This should only be called from the UI thread.
public static RequestAsyncTask executeBatchAsync(Request requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
requests | The Requests to execute |
executeBatchAsync(Collection)
Executes requests as a single batch asynchronously. This function will return immediately, and the requests will be processed on a separate thread. In order to process results of a request, or determine whether a request succeeded or failed, a callback must be specified (see the setCallback.setCallback(Callback) method).
This should only be called from the UI thread.
public static RequestAsyncTask executeBatchAsync(Collection requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
requests | The Requests to execute |
executeBatchAsync(RequestBatch)
Executes requests as a single batch asynchronously. This function will return immediately, and the requests will be processed on a separate thread. In order to process results of a request, or determine whether a request succeeded or failed, a callback must be specified (see the setCallback.setCallback(Callback) method).
This should only be called from the UI thread.
public static RequestAsyncTask executeBatchAsync(RequestBatch requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
requests | The RequestBatch to execute |
executeConnectionAndWait(HttpURLConnection, Collection)
Executes requests that have already been serialized into an HttpURLConnection. No validation is done that the contents of the connection actually reflect the serialized requests, so it is the caller's responsibility to ensure that it will correctly generate the desired responses.
This should only be called if you have transitioned off the UI thread.
public static List executeConnectionAndWait(HttpURLConnection connection, Collection requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
connection | The HttpURLConnection that the requests were serialized into |
requests | The requests represented by the HttpURLConnection |
executeConnectionAndWait(HttpURLConnection, RequestBatch)
Executes requests that have already been serialized into an HttpURLConnection. No validation is done that the contents of the connection actually reflect the serialized requests, so it is the caller's responsibility to ensure that it will correctly generate the desired responses.
This should only be called if you have transitioned off the UI thread.
public static List executeConnectionAndWait(HttpURLConnection connection, RequestBatch requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
connection | The HttpURLConnection that the requests were serialized into |
requests | The RequestBatch represented by the HttpURLConnection |
executeConnectionAsync(HttpURLConnection, RequestBatch)
Asynchronously executes requests that have already been serialized into an HttpURLConnection. No validation is done that the contents of the connection actually reflect the serialized requests, so it is the caller's responsibility to ensure that it will correctly generate the desired responses. This function will return immediately, and the requests will be processed on a separate thread. In order to process results of a request, or determine whether a request succeeded or failed, a callback must be specified (see the setCallback.setCallback(Callback) method).
This should only be called from the UI thread.
public static RequestAsyncTask executeConnectionAsync(HttpURLConnection connection, RequestBatch requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
connection | The HttpURLConnection that the requests were serialized into |
requests | The requests represented by the HttpURLConnection |
executeConnectionAsync(Handler, HttpURLConnection, RequestBatch)
Asynchronously executes requests that have already been serialized into an HttpURLConnection. No validation is done that the contents of the connection actually reflect the serialized requests, so it is the caller's responsibility to ensure that it will correctly generate the desired responses. This function will return immediately, and the requests will be processed on a separate thread. In order to process results of a request, or determine whether a request succeeded or failed, a callback must be specified (see the setCallback.setCallback(Callback) method)
This should only be called from the UI thread.
public static RequestAsyncTask executeConnectionAsync(Handler callbackHandler, HttpURLConnection connection, RequestBatch requests)
พารามิเตอร์ | คำอธิบาย |
---|---|
callbackHandler | A Handler that will be used to post calls to the callback for each request; if null, a Handler will be instantiated on the calling thread |
connection | The HttpURLConnection that the requests were serialized into |
requests | The requests represented by the HttpURLConnection |
getGraphObject()
Returns the GraphObject, if any, associated with this request.
public final GraphObject getGraphObject()
setGraphObject(GraphObject)
Sets the GraphObject associated with this request. This is meaningful only for POST requests.
public final void setGraphObject(GraphObject graphObject)
พารามิเตอร์ | คำอธิบาย |
---|---|
graphObject | The GraphObject to upload along with this request |
getGraphPath()
Returns the graph path of this request, if any.
public final String getGraphPath()
setGraphPath(String)
Sets the graph path of this request. A graph path may not be set if a REST method has been specified.
public final void setGraphPath(String graphPath)
พารามิเตอร์ | คำอธิบาย |
---|---|
graphPath | The graph path for this request |
getHttpMethod()
Returns the HttpMethod to use for this request.
public final HttpMethod getHttpMethod()
setHttpMethod(HttpMethod)
Sets the HttpMethod to use for this request.
public final void setHttpMethod(HttpMethod httpMethod)
พารามิเตอร์ | คำอธิบาย |
---|---|
httpMethod | The HttpMethod, or null for the default (HttpMethod.GET). |
getVersion()
Returns the version of the API that this request will use. By default this is the current API at the time the SDK is released.
public final String getVersion()
setVersion(String)
Set the version to use for this request. By default the version will be the current API at the time the SDK is released. Only use this if you need to explicitly override.
public final void setVersion(String version)
พารามิเตอร์ | คำอธิบาย |
---|---|
version | The version to use. Should look like "v2.0" |
getParameters()
Returns the parameters for this request.
public final Bundle getParameters()
setParameters(Bundle)
Sets the parameters for this request.
public final void setParameters(Bundle parameters)
พารามิเตอร์ | คำอธิบาย |
---|---|
parameters | The parameters |
getRestMethod()
Returns the REST method to call for this request.
public final String getRestMethod()
setRestMethod(String)
Sets the REST method to call for this request. A REST method may not be set if a graph path has been specified.
public final void setRestMethod(String restMethod)
พารามิเตอร์ | คำอธิบาย |
---|---|
restMethod | The REST method to call |
getSession()
Returns the Session associated with this request.
public final Session getSession()
setSession(Session)
Sets the Session to use for this request. The Session does not need to be opened at the time it is specified, but it must be opened by the time the request is executed.
public final void setSession(Session session)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The Session to use for this request |
getBatchEntryName()
Returns the name of this request's entry in a batched request.
public final String getBatchEntryName()
setBatchEntryName(String)
Sets the name of this request's entry in a batched request. This value is only used if this request is submitted as part of a batched request. It can be used to specified dependencies between requests. See Batch Requests in the Graph API documentation for more details.
public final void setBatchEntryName(String batchEntryName)
พารามิเตอร์ | คำอธิบาย |
---|---|
batchEntryName | The name of this request's entry in a batched request, which must be unique within a particular batch of requests |
getBatchEntryDependsOn()
Returns the name of the request that this request entry explicitly depends on in a batched request.
public final String getBatchEntryDependsOn()
setBatchEntryDependsOn(String)
Sets the name of the request entry that this request explicitly depends on in a batched request. This value is only used if this request is submitted as part of a batched request. It can be used to specified dependencies between requests. See Batch Requests in the Graph API documentation for more details.
public final void setBatchEntryDependsOn(String batchEntryDependsOn)
พารามิเตอร์ | คำอธิบาย |
---|---|
batchEntryDependsOn | The name of the request entry that this entry depends on in a batched request |
getBatchEntryOmitResultOnSuccess()
Returns whether or not this batch entry will return a response if it is successful. Only applies if another request entry in the batch specifies this entry as a dependency.
public final boolean getBatchEntryOmitResultOnSuccess()
setBatchEntryOmitResultOnSuccess(boolean)
Sets whether or not this batch entry will return a response if it is successful. Only applies if another request entry in the batch specifies this entry as a dependency. See Batch Requests in the Graph API documentation for more details.
public final void setBatchEntryOmitResultOnSuccess(boolean batchEntryOmitResultOnSuccess)
พารามิเตอร์ | คำอธิบาย |
---|---|
batchEntryOmitResultOnSuccess | The name of the request entry that this entry depends on in a batched request |
getCallback()
Returns the callback which will be called when the request finishes.
public final Callback getCallback()
setCallback(Callback)
Sets the callback which will be called when the request finishes.
public final void setCallback(Callback callback)
พารามิเตอร์ | คำอธิบาย |
---|---|
callback | The callback |
setTag(Object)
Sets the tag on the request; this is an application-defined object that can be used to distinguish between different requests. Its value has no effect on the execution of the request.
public final void setTag(Object tag)
พารามิเตอร์ | คำอธิบาย |
---|---|
tag | An object to serve as a tag, or null |
getTag()
Gets the tag on the request; this is an application-defined object that can be used to distinguish between different requests. Its value has no effect on the execution of the request.
public final Object getTag()
executeAndWait()
Executes this request and returns the response.
This should only be called if you have transitioned off the UI thread.
public final Response executeAndWait()
executeAsync()
Executes this request and returns the response.
This should only be called from the UI thread.
public final RequestAsyncTask executeAsync()
MAXIMUM_BATCH_SIZE
public static final int MAXIMUM_BATCH_SIZE
TAG
public static final String TAG