Package com.microsoft.graph.content
Class BatchRequestContent
java.lang.Object
com.microsoft.graph.content.BatchRequestContent
Respresents the content of a JSON batch request
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Patternpattern to replace the protocol and host part of the request if specifiedList<BatchRequestStep<?>>Steps part of the batch request -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBatchRequestStep(IHttpRequest request) Adds a request as a step to the current batch.addBatchRequestStep(IHttpRequest request, HttpMethod httpMethod) Adds a request as a step to the current batch<T> StringaddBatchRequestStep(IHttpRequest request, HttpMethod httpMethod, T serializableBody) Adds a request as a step to the current batch<T> StringaddBatchRequestStep(IHttpRequest request, HttpMethod httpMethod, T serializableBody, String... dependsOnRequestsIds) Adds a request as a step to the current batchprotected StringGenerates a randomly available request id<T> BatchRequestStep<T>getStepById(String stepId) Gets a step by its step idvoidremoveBatchRequestStepWithId(String... stepIds) Removes requests from the requests to be executed by the batch.
-
Field Details
-
requests
Steps part of the batch request -
protocolAndHostReplacementPattern
pattern to replace the protocol and host part of the request if specified
-
-
Constructor Details
-
BatchRequestContent
public BatchRequestContent()
-
-
Method Details
-
addBatchRequestStep
Adds a request as a step to the current batch. Defaults to GET if the HTTP method is not set in the request.- Parameters:
request- the request to add as a step- Returns:
- the id of the step that was just added to the batch
-
addBatchRequestStep
@Nonnull public String addBatchRequestStep(@Nonnull IHttpRequest request, @Nonnull HttpMethod httpMethod) Adds a request as a step to the current batch- Parameters:
request- the request to add as a stephttpMethod- the HttpMethod to execute the request with- Returns:
- the id of the step that was just added to the batch
-
addBatchRequestStep
@Nonnull public <T> String addBatchRequestStep(@Nonnull IHttpRequest request, @Nonnull HttpMethod httpMethod, @Nullable T serializableBody) Adds a request as a step to the current batch- Type Parameters:
T- the type of the request body- Parameters:
request- the request to add as a stephttpMethod- the HttpMethod to execute the request withserializableBody- the body of the request to be serialized- Returns:
- the id of the step that was just added to the batch
-
addBatchRequestStep
@Nonnull public <T> String addBatchRequestStep(@Nonnull IHttpRequest request, @Nonnull HttpMethod httpMethod, @Nullable T serializableBody, @Nullable String... dependsOnRequestsIds) Adds a request as a step to the current batch- Type Parameters:
T- the type of the request body- Parameters:
request- the request to add as a stephttpMethod- the HttpMethod to execute the request withserializableBody- the body of the request to be serializeddependsOnRequestsIds- the ids of steps this request depends on- Returns:
- the id of the step that was just added to the batch
-
removeBatchRequestStepWithId
Removes requests from the requests to be executed by the batch. Also removes any dependency references that might exist.- Parameters:
stepIds- ids of steps to be removed.
-
getStepById
Gets a step by its step id- Type Parameters:
T- the type of the request body- Parameters:
stepId- the request step id returned from the add method- Returns:
- the request corresponding to the provided id or null
-
getNextRequestId
Generates a randomly available request id- Returns:
- a random request id
-