Skip to content

Commit

Permalink
Start-SubmissionMonitor should return the final submission retrieved
Browse files Browse the repository at this point in the history
We now return the final submission object that was retrieved as part
of the loop if the `-PassThru` switch is provided.

Resolves Issue #43: Start-SubmissionMonitor should allow the shell to know the result
  • Loading branch information
HowardWolosky committed May 2, 2017
1 parent 0b260c4 commit d5dee77
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Documentation/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ Multiple email addresses are separated by a comma

Start-SubmissionMonitor -AppId <appId> -SubmissionId <submissionId> -EmailNotifyTo <emailAddress1>,<emailAddress2>

> By default, `Start-SubmissionMonitor` does not return any result.
> You can provide the `-PassThru` switch if you'd like it to return back the final submission object
> that caused it to end its monitoring loop. You can then capture that result and do additional
> processing on it if so desired.
### Status Progression

The following explains the common progression of a submission by status:
Expand Down
2 changes: 1 addition & 1 deletion StoreBroker/StoreBroker.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
CompanyName = 'Microsoft Corporation'
Copyright = 'Copyright (C) Microsoft Corporation. All rights reserved.'

ModuleVersion = '1.8.0'
ModuleVersion = '1.8.1'
Description = 'Provides command-line access to the Windows Store Submission REST API.'

RootModule = 'StoreIngestionApi'
Expand Down
21 changes: 20 additions & 1 deletion StoreBroker/StoreIngestionApi.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,16 @@ function Start-SubmissionMonitor
with no commandline status update. When not specified, those commands run in
the background, enabling the command prompt to provide status information.
.PARAMETER PassThru
Returns the final submission object that was retrieved when checking submission
status. By default, this function does not generate any output.
.OUTPUTS
None or PSCustomObject
By default, this does not generate any output. If you use the PassThru parameter,
it generates a PSCustomObject object that represents the last retrieved submission
which can be inspected for submission status.
.EXAMPLE
Start-SubmissionMonitor 0ABCDEF12345 1234567890123456789
Checks that submission every 60 seconds until the submission enters a Failed state
Expand Down Expand Up @@ -1178,7 +1188,9 @@ function Start-SubmissionMonitor
Position=0)]
[string] $IapId,

[switch] $NoStatus
[switch] $NoStatus,

[switch] $PassThru
)

Write-Log "Executing: $($MyInvocation.Line)" -Level Verbose
Expand Down Expand Up @@ -1224,6 +1236,8 @@ function Start-SubmissionMonitor
}
}

$submission = $null

# We can safely assume this is being used on a recently committed submission.
# If it isn't we'll report that to the user and update this value during the first
# run through our loop.
Expand Down Expand Up @@ -1371,6 +1385,11 @@ function Start-SubmissionMonitor
Start-Sleep -Seconds $secondsBetweenChecks
}
}

if ($PassThru)
{
return $submission
}
}

function Open-DevPortal
Expand Down
14 changes: 13 additions & 1 deletion StoreBroker/StoreIngestionFlightingApi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,16 @@ function Start-ApplicationFlightSubmissionMonitor
with no commandline status update. When not specified, those commands run in
the background, enabling the command prompt to provide status information.
.PARAMETER PassThru
Returns the final submission object that was retrieved when checking submission
status. By default, this function does not generate any output.
.OUTPUTS
None or PSCustomObject
By default, this does not generate any output. If you use the PassThru parameter,
it generates a PSCustomObject object that represents the last retrieved submission
which can be inspected for submission status.
.EXAMPLE
Start-ApplicationFlightSubmissionMonitor 0ABCDEF12345 01234567-89ab-cdef-0123-456789abcdef 1234567890123456789
Expand Down Expand Up @@ -1959,7 +1969,9 @@ function Start-ApplicationFlightSubmissionMonitor

[string[]] $EmailNotifyTo = @(),

[switch] $NoStatus
[switch] $NoStatus,

[switch] $PassThru
)

Start-SubmissionMonitor @PSBoundParameters
Expand Down
16 changes: 14 additions & 2 deletions StoreBroker/StoreIngestionIapApi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,16 @@ function Start-InAppProductSubmissionMonitor
with no commandline status update. When not specified, those commands run in
the background, enabling the command prompt to provide status information.
.PARAMETER PassThru
Returns the final submission object that was retrieved when checking submission
status. By default, this function does not generate any output.
.OUTPUTS
None or PSCustomObject
By default, this does not generate any output. If you use the PassThru parameter,
it generates a PSCustomObject object that represents the last retrieved submission
which can be inspected for submission status.
.EXAMPLE
Start-InAppProductSubmissionMonitor 0ABCDEF12345 1234567890123456789
Expand Down Expand Up @@ -1953,8 +1963,10 @@ function Start-InAppProductSubmissionMonitor

[string[]] $EmailNotifyTo = @(),

[switch] $NoStatus
[switch] $NoStatus,

[switch] $PassThru
)

Start-SubmissionMonitor @PSBoundParameters
}
}

0 comments on commit d5dee77

Please sign in to comment.