Skip to content

Commit 128d095

Browse files
committed
- revamps method to return step id
1 parent a4ce2f2 commit 128d095

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/com/microsoft/graph/content/MSBatchRequestContent.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ public boolean addBatchRequestStep(final MSBatchRequestStep batchRequestStep) {
6363
* Add steps to batch from OkHttp.Request
6464
* @param request the request to add to the batch
6565
* @param arrayOfDependsOnIds ids of steps this step depends on
66-
* @return whether the step was added to the batch or not
66+
* @return the step id
6767
*/
68-
public boolean addBatchRequestStep(final Request request, final String... arrayOfDependsOnIds) {
68+
public String addBatchRequestStep(final Request request, final String... arrayOfDependsOnIds) {
6969
String requestId;
7070
do {
7171
requestId = Integer.toString(ThreadLocalRandom.current().nextInt());
7272
} while(batchRequestStepsHashMap.keySet().contains(requestId));
73-
return addBatchRequestStep(new MSBatchRequestStep(requestId, request, Arrays.asList(arrayOfDependsOnIds)));
73+
if(addBatchRequestStep(new MSBatchRequestStep(requestId, request, Arrays.asList(arrayOfDependsOnIds))))
74+
return requestId;
75+
else
76+
throw new IllegalArgumentException("unable to add step to batch. Number of batch request steps cannot exceed " + MAX_NUMBER_OF_REQUESTS);
7477
}
7578

7679
/*

0 commit comments

Comments
 (0)