Azure / Azure/autorest.powershell

[FeatureRequest] ParameterSet/parameter that returns `HttpRequestMessage` object without making a call

Open
#895 3 comments 2 reactions 0 assignees View on GitHub
feature-request P2
Dominant language
C#
Stars
123
Forks
99
PR merge metrics
No merged PRs in 30d

Description

We are considering adding [OData batch request](https://docs.microsoft.com/en-us/graph/json-batching) support to our PowerShell SDK generated using AutoREST.PowerShell. To do this, we need to access the `HttpRequestMessage` object for each cmdlet that participates in the batch request without making a call to the service.

### Proposal
Add a `WithHttpRequestOutput` AutoREST configuration that customers can use to specify whether AutoREST should generate a parameterSet that returns an `HttpRequestMessage` object. This should be an opt-in config that generates a parameterSet with` -OutputRequest` switch parameter.

Our proposed batch request implementation will utilize the new parameterSet as such:
``` powershell
$managerRequest = Get-MgUserManager -UserId $userId -OutputRequest
$updateUserRequest = Update-MgUserSetting -UserId $userId -ContributionToContentDiscoveryAsOrganizationDisabled -OutputRequest
$removeGroupRequest = Remove-MgGroup -GroupId $groupId -OutputRequest
Invoke-MgBatchRequest -Request $managerRequest, $updateUserRequest, $removeGroupRequest
```

Related to https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/116

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.