4040import com .microsoft .graph .http .IHttpRequest ;
4141import com .microsoft .graph .options .HeaderOption ;
4242
43+ /** Respresents the content of a JSON batch request */
4344public class BatchRequestContent {
45+ /** Steps part of the batch request */
4446 @ Expose
4547 @ SerializedName ("requests" )
4648 public List <BatchRequestStep <?>> requests ;
4749
50+ /**
51+ * Adds a request as a step to the current batch. Defaults to GET if the HTTP method is not set in the request.
52+ * @param request the request to add as a step
53+ * @return the id of the step that was just added to the batch
54+ */
4855 @ Nonnull
4956 public String addBatchRequestStep (@ Nonnull final IHttpRequest request ) {
5057 Objects .requireNonNull (request , "request parameter cannot be null" );
5158 return addBatchRequestStep (request , request .getHttpMethod () == null ? HttpMethod .GET : request .getHttpMethod ());
5259 }
60+ /**
61+ * Adds a request as a step to the current batch
62+ * @param request the request to add as a step
63+ * @param httpMethod the HttpMethod to execute the request with
64+ * @return the id of the step that was just added to the batch
65+ */
5366 @ Nonnull
5467 public String addBatchRequestStep (@ Nonnull final IHttpRequest request , @ Nonnull final HttpMethod httpMethod ) {
5568 return addBatchRequestStep (request , httpMethod , null );
5669 }
70+ /**
71+ * Adds a request as a step to the current batch
72+ * @param request the request to add as a step
73+ * @param httpMethod the HttpMethod to execute the request with
74+ * @param <T> the type of the request body
75+ * @param serializableBody the body of the request to be serialized
76+ * @return the id of the step that was just added to the batch
77+ */
5778 @ Nonnull
5879 public <T > String addBatchRequestStep (@ Nonnull final IHttpRequest request , @ Nonnull final HttpMethod httpMethod , @ Nullable final T serializableBody ) {
5980 return addBatchRequestStep (request , httpMethod , serializableBody , null );
6081 }
82+ /**
83+ * Adds a request as a step to the current batch
84+ * @param request the request to add as a step
85+ * @param httpMethod the HttpMethod to execute the request with
86+ * @param <T> the type of the request body
87+ * @param serializableBody the body of the request to be serialized
88+ * @param dependsOnRequestsIds the ids of steps this request depends on
89+ * @return the id of the step that was just added to the batch
90+ */
6191 public <T > String addBatchRequestStep (@ Nonnull final IHttpRequest request , @ Nonnull final HttpMethod httpMethod , @ Nullable final T serializableBody , @ Nullable final HashSet <String > dependsOnRequestsIds ) {
6292 Objects .requireNonNull (request , "request parameter cannot be null" );
6393 Objects .requireNonNull (httpMethod , "httpMethod parameter cannot be null" );
@@ -87,6 +117,10 @@ public <T> String addBatchRequestStep(@Nonnull final IHttpRequest request, @Nonn
87117 requests .add (step );
88118 return step .id ;
89119 }
120+ /**
121+ * Removes requests from the requests to be executed by the batch. Also removes any dependency references that might exist.
122+ * @param stepIds ids of steps to be removed.
123+ */
90124 public void removeBatchRequestStepWithId (@ Nonnull final String ...stepIds ) {
91125 if (requests == null ) return ;
92126
@@ -102,6 +136,12 @@ public void removeBatchRequestStepWithId(@Nonnull final String ...stepIds) {
102136 }
103137 }
104138 }
139+ /**
140+ * Gets a step by its step id
141+ * @param <T> the type of the request body
142+ * @param stepId the request step id returned from the add method
143+ * @return the request corresponding to the provided id or null
144+ */
105145 @ Nullable
106146 @ SuppressWarnings ("unchecked" )
107147 public <T > BatchRequestStep <T > getStepById (@ Nonnull final String stepId ) {
0 commit comments