-
Notifications
You must be signed in to change notification settings - Fork 211
Stream Support Improvements #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
is this correct? shouldn't it be infile? Upload drive item content.Set-MgDriveItemContent -DriveId $driveId -DriveItemId $itemId -OutFile "c:\tmp\updatedDoc.docx" |
do we need this support for Invoke-GraphRequest too? |
IGR had it baked in, however, I can run the tests @peombwa has run and confirm all is well. |
This should be InFile. |
@peombwa What is $itemid in the above examples? |
This PR proposes the following changes to properly handle file upload and download with the generated commands.
Adds
FileUploadCmdlet
class. This will be the base class for all cmdlets that upload files i.e.-BodyParameter
is of typeStream
and name starts withSet-*
.FileUploadCmdlet
class performs the following :-InFile
parameter to all cmdlets that derive fromFileUploadCmdlet
.GetFileAsStream
handles getting a resolved path to the file and returns a thread safe stream.Adds
PSCmdletExtensions
class. This class provides helper methods that handle retrieval of valid paths and writing of streams to a file on disk.Adds directives to replace broken file upload and download logic in generated cmdlets.
For file download, the directive:
WriteToFile
inPSCmdletExtensions
.For file upload, the directive:
FileUploadCmdlet
.bodyParameter
optional sinceFileUploadCmdlet
adds a mandatory-InFile
parameter.GetFileAsStream
in `FileUploadCmdlet.Updates modules mapping tags and onpremisespublishingprofile directives.
Proposed Usage
These changes we tested against the OpenAPI docs in staging. Thanks @irvinesunday!
Closes #54 and #182