Skip to content

Commit 75bc313

Browse files
committed
- adds missing javadoc comments for new batch infrastructure
1 parent 918129d commit 75bc313

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

‎src/main/java/com/microsoft/graph/content/BatchRequestContent.java‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,54 @@
4040
import com.microsoft.graph.http.IHttpRequest;
4141
import com.microsoft.graph.options.HeaderOption;
4242

43+
/** Respresents the content of a JSON batch request */
4344
public 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) {

‎src/main/java/com/microsoft/graph/content/BatchRequestStep.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ public class BatchRequestStep<T> extends BatchStep<T> {
3737
@Expose
3838
@SerializedName("url")
3939
public String url;
40+
/** The HTTP method to use to execute the request */
4041
@Expose
4142
@SerializedName("method")
4243
public HttpMethod method;
44+
/** The IDs of the steps this step depends on before being executed */
4345
@Expose
4446
@SerializedName("dependsOn")
4547
public HashSet<String> dependsOn;

‎src/main/java/com/microsoft/graph/content/BatchResponseContent.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,19 @@
3131
import com.google.gson.annotations.Expose;
3232
import com.google.gson.annotations.SerializedName;
3333

34+
/** Respresents the result of a JSON batch request */
3435
public class BatchResponseContent {
36+
/** Responses to the steps from the request */
3537
@Expose
3638
@SerializedName("responses")
3739
public List<BatchResponseStep<?>> responses;
3840

41+
/**
42+
* Gets a response to a request in the batch by its id
43+
* @param <T> Type of the response body
44+
* @param stepId Id of the request step in the batch request
45+
* @return The step response corresponding to the ID or null
46+
*/
3947
@Nullable
4048
@SuppressWarnings("unchecked")
4149
public <T> BatchResponseStep<T> getResponseById(@Nonnull final String stepId) {

0 commit comments

Comments
 (0)