Package com.restfb.batch
Class BatchRequest
- java.lang.Object
-
- com.restfb.batch.BatchRequest
-
public class BatchRequest extends Object
Encapsulates a discrete part of an entire Facebook Batch API request.Must be constructed by
BatchRequest.BatchRequestBuilder
.- Since:
- 1.6.5
- Author:
- Mark Allen
- See Also:
BatchRequest.BatchRequestBuilder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BatchRequest.BatchRequestBuilder
Builder pattern implementation used to construct instances ofBatchRequest
.
-
Constructor Summary
Constructors Modifier Constructor Description protected
BatchRequest(String relativeUrl, List<Parameter> parameters, String method, List<BatchHeader> headers, List<Parameter> bodyParameters, String attachedFiles, String dependsOn, String name, boolean omitResponseOnSuccess)
Designed to be invoked by instances ofBatchRequest.BatchRequestBuilder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object that)
protected String
generateParameterString(List<Parameter> parameters)
For a list of parameters, generate a URL query string.String
getAttachedFiles()
Names of any attached files for this call, for example"cat1, cat2"
.String
getBody()
The request body, for example"message=Test status update"
.String
getDependsOn()
Another call in the current batch upon which this call depends, for example"get-friends"
.List<BatchHeader>
getHeaders()
HTTP Headers to be sent as part of this request.String
getMethod()
The HTTP method to use, for example"GET"
.String
getName()
The logical name for this request, for example"get-friends"
.String
getRelativeUrl()
The endpoint to hit, for example"me/friends?limit=10"
.int
hashCode()
boolean
isOmitResponseOnSuccess()
Will the batch response for this request benull
?String
toString()
-
-
-
Constructor Detail
-
BatchRequest
protected BatchRequest(String relativeUrl, List<Parameter> parameters, String method, List<BatchHeader> headers, List<Parameter> bodyParameters, String attachedFiles, String dependsOn, String name, boolean omitResponseOnSuccess)
Designed to be invoked by instances ofBatchRequest.BatchRequestBuilder
.- Parameters:
relativeUrl
- The endpoint to hit, for example"me/friends"
.parameters
- Optional list of URL parameters to be added to the value specified inrelativeUrl
.method
- The HTTP method to use, for example"GET"
.headers
- The list of HTTP headers for the request.bodyParameters
- The parameters that comprise the request body, for example"message=Test status update"
.attachedFiles
- Names of any attached files for this call, for example"cat1, cat2"
.name
- The logical name of this request, for example"get-friends"
.dependsOn
- If this call depends on the completion of another call in the current batch, for example"get-friends"
.omitResponseOnSuccess
- To make sure FB returns JSON in the event that this request completes successfully, set this tofalse
.- Throws:
IllegalArgumentException
- IfrelativeUrl
isnull
.
-
-
Method Detail
-
generateParameterString
protected String generateParameterString(List<Parameter> parameters)
For a list of parameters, generate a URL query string.Does not include a leading "?" character.
- Parameters:
parameters
- The parameters to stringify.- Returns:
- A URL query string representation of the given
parameters
.
-
getMethod
public String getMethod()
The HTTP method to use, for example"GET"
.- Returns:
- The HTTP method to use.
-
getRelativeUrl
public String getRelativeUrl()
The endpoint to hit, for example"me/friends?limit=10"
.- Returns:
- The endpoint to hit.
-
getBody
public String getBody()
The request body, for example"message=Test status update"
.- Returns:
- The request body.
-
getAttachedFiles
public String getAttachedFiles()
Names of any attached files for this call, for example"cat1, cat2"
.- Returns:
- Names of any attached files for this call.
-
getName
public String getName()
The logical name for this request, for example"get-friends"
.- Returns:
- The logical name for this request.
-
getDependsOn
public String getDependsOn()
Another call in the current batch upon which this call depends, for example"get-friends"
.- Returns:
- Another call in the current batch upon which this call depends.
-
isOmitResponseOnSuccess
public boolean isOmitResponseOnSuccess()
Will the batch response for this request benull
?- Returns:
true
if the batch response for this request will benull
,false
otherwise.
-
getHeaders
public List<BatchHeader> getHeaders()
HTTP Headers to be sent as part of this request.- Returns:
- HTTP Headers to be sent as part of this request.
-
-