Class BatchRequestContent

java.lang.Object
com.microsoft.graph.content.BatchRequestContent

public class BatchRequestContent extends Object
Respresents the content of a JSON batch request
  • Field Details

    • requests

      @Expose @Nullable @SerializedName("requests") public List<BatchRequestStep<?>> requests
      Steps part of the batch request
    • protocolAndHostReplacementPattern

      @Nonnull protected static final Pattern protocolAndHostReplacementPattern
      pattern to replace the protocol and host part of the request if specified
  • Constructor Details

    • BatchRequestContent

      public BatchRequestContent()
  • Method Details

    • addBatchRequestStep

      @Nonnull public String addBatchRequestStep(@Nonnull IHttpRequest request)
      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 step
      httpMethod - 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 step
      httpMethod - the HttpMethod to execute the request with
      serializableBody - 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 step
      httpMethod - the HttpMethod to execute the request with
      serializableBody - the body of the request to be serialized
      dependsOnRequestsIds - the ids of steps this request depends on
      Returns:
      the id of the step that was just added to the batch
    • removeBatchRequestStepWithId

      public void removeBatchRequestStepWithId(@Nonnull String... stepIds)
      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

      @Nullable public <T> BatchRequestStep<T> getStepById(@Nonnull String stepId)
      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

      @Nonnull protected String getNextRequestId()
      Generates a randomly available request id
      Returns:
      a random request id