Package com.restfb.batch
Class BatchRequest.BatchRequestBuilder
java.lang.Object
com.restfb.batch.BatchRequest.BatchRequestBuilder
- Enclosing class:
- BatchRequest
Builder pattern implementation used to construct instances of
BatchRequest
.
See the Facebook Batch API documentation for more details on what a batch request looks like.
- Since:
- 1.6.5
- Author:
- Mark Allen
-
Constructor Summary
ConstructorDescriptionBatchRequestBuilder
(String relativeUrl) Creates a batch request builder using the provided FB endpoint. -
Method Summary
Modifier and TypeMethodDescriptionattachedFiles
(String attachedFiles) Sets the comma-delimited names of any attached files for this builder, for example"cat1, cat2"
.Sets the request body parameters for the request generated by this builder, for exampleParameter.with("message", "Test status update")
.build()
Generates an instance ofBatchRequest
.Specifies if the request generated by this builder depends on the completion of another call in the current batch, for example"first"
.headers
(BatchHeader... headers) Sets the list of HTTP headers for the request generated by this builder.Sets the HTTP method for the request generated by this builder, for example"POST"
(GET
is the default value for this builder).Sets the logical name for the request generated by this builder.omitResponseOnSuccess
(boolean omitResponseOnSuccess) To make sure FB returns JSON in the event that this builder's request completes successfully, set this tofalse
.parameters
(Parameter... parameters) Specifies URL parameters for the request generated by this builder.
-
Constructor Details
-
BatchRequestBuilder
Creates a batch request builder using the provided FB endpoint.You can explicitly specify URL parameters here, or use
parameters(Parameter...)
instead if you prefer to have the query string constructed programmatically.- Parameters:
relativeUrl
- The endpoint to hit, for example"me/friends"
.
-
-
Method Details
-
method
Sets the HTTP method for the request generated by this builder, for example"POST"
(GET
is the default value for this builder).- Parameters:
method
- The HTTP method.- Returns:
- This builder.
-
name
Sets the logical name for the request generated by this builder. Useful for specifying dependencies between operations - the generated request can be referenced by name.- Parameters:
name
- The logical name of the request generated by this builder.- Returns:
- This builder.
-
headers
Sets the list of HTTP headers for the request generated by this builder.- Parameters:
headers
- The HTTP headers.- Returns:
- This builder.
-
body
Sets the request body parameters for the request generated by this builder, for exampleParameter.with("message", "Test status update")
.- Parameters:
parameters
- The request body parameters.- Returns:
- This builder.
-
attachedFiles
Sets the comma-delimited names of any attached files for this builder, for example"cat1, cat2"
.- Parameters:
attachedFiles
- The names of any attached files for this builder.- Returns:
- This builder.
-
dependsOn
Specifies if the request generated by this builder depends on the completion of another call in the current batch, for example"first"
.- Parameters:
dependsOn
- A reference to another request in the batch that this builder's request depends on.- Returns:
- This builder.
-
omitResponseOnSuccess
To make sure FB returns JSON in the event that this builder's request completes successfully, set this tofalse
.- Parameters:
omitResponseOnSuccess
- Set this tofalse
to make sure FB returns JSON in the event that this builder's request completes successfully,- Returns:
- This builder.
-
parameters
Specifies URL parameters for the request generated by this builder.- Parameters:
parameters
- The URL parameters.- Returns:
- This builder.
-
build
Generates an instance ofBatchRequest
.- Returns:
- An instance of
BatchRequest
.
-