Skip to content

Conversation

@andrueastman
Copy link
Contributor

@andrueastman andrueastman commented Oct 15, 2019

This PR closes #46

Changes proposed in this PR

Adds request builder for the batch endpoint to base client so that the following scenario is possible. Where we use the graphServiceClient to send out the batchRequest content like this:

// Add batch request steps to BatchRequestContent.
BatchRequestContent batchRequestContent = new BatchRequestContent(batchRequestStep1, batchRequestStep2);

/* Use the Request builders :) */
BatchResponseContent returnedResponse = await graphServiceClient.Batch.Request().PostAsync(batchRequestContent);

/* Read the responses :) */
HttpResponseMessage firstResponse = await returnedResponse.GetResponseByIdAsync("1");
            HttpResponseMessage secondResponse = await returnedResponse.GetResponseByIdAsync("2");

Rather than calling PostAsync of a httpclient like this:

// Send batch request with BatchRequestContent.
HttpResponseMessage response = await httpClient.PostAsync("https://graph.microsoft.com/v1.0/$batch", batchRequestContent);

// Handle http responses using BatchResponseContent.
BatchResponseContent batchResponseContent = new BatchResponseContent(response);

@andrueastman andrueastman marked this pull request as ready for review October 15, 2019 12:39
@andrueastman andrueastman added this to the 1.19.0 milestone Oct 15, 2019
@andrueastman andrueastman self-assigned this Oct 15, 2019
@MIchaelMainer MIchaelMainer requested a review from peombwa October 15, 2019 20:54
Copy link
Collaborator

@MIchaelMainer MIchaelMainer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@andrueastman andrueastman merged commit a2a7e2b into dev Oct 17, 2019
@andrueastman andrueastman deleted the andrueastman/add-batch-request-builders branch October 17, 2019 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Batch RequestBuilder to baseClient

3 participants