-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New-HaloOutcome and Get-HaloOutcome support the ticket actions /Outcome (TOutcome) endpoint to retrieve and create ticket actions.
- Loading branch information
1 parent
8a2787b
commit 54c87d4
Showing
3 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Get-HaloOutcome.ps1 | ||
function Get-HaloOutcome { | ||
[CmdletBinding( DefaultParameterSetName = 'Multi' )] | ||
[OutputType([Object])] | ||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'Uses dynamic parameter parsing.')] | ||
Param( | ||
[Parameter( ParameterSetName = 'Single', Mandatory = $True )] | ||
[int64]$OutcomeID, | ||
[Parameter( ParameterSetName = 'Multi' )] | ||
[int64]$Count, | ||
[Parameter( ParameterSetName = 'Multi' )] | ||
[Alias('pageinate')] | ||
[switch]$Paginate, | ||
[Parameter( ParameterSetName = 'Multi' )] | ||
[Alias('page_size')] | ||
[int32]$PageSize, | ||
[Parameter( ParameterSetName = 'Multi' )] | ||
[Alias('page_no')] | ||
[int32]$PageNo, | ||
[Parameter( ParameterSetName = 'Multi' )] | ||
[string]$Order, | ||
[Parameter( ParameterSetName = 'Multi' )] | ||
[switch]$OrderDesc, | ||
[Parameter( ParameterSetName = 'Single' )] | ||
[switch]$IncludeDetails | ||
) | ||
Invoke-HaloPreFlightCheck | ||
$CommandName = $MyInvocation.MyCommand.Name | ||
$Parameters = (Get-Command -Name $CommandName).Parameters | ||
|
||
if ($OutcomeID) { | ||
$Parameters.Remove('OutcomeID') | Out-Null | ||
} | ||
try { | ||
if ($OutcomeID) { | ||
Write-Verbose "Running in single-item mode because '-OutcomeID' was provided." | ||
$QSCollection = New-HaloQuery -CommandName $CommandName -Parameters $Parameters | ||
$Resource = "api/Outcome/$($OutcomeID)" | ||
$RequestParams = @{ | ||
Method = 'GET' | ||
Resource = $Resource | ||
AutoPaginateOff = $True | ||
QSCollection = $QSCollection | ||
ResourceType = 'Outcome' | ||
} | ||
} else { | ||
Write-Verbose 'Running in multi-item mode.' | ||
$QSCollection = New-HaloQuery -CommandName $CommandName -Parameters $Parameters -IsMulti | ||
$Resource = 'api/Outcome' | ||
$RequestParams = @{ | ||
Method = 'GET' | ||
Resource = $Resource | ||
AutoPaginateOff = $Paginate | ||
QSCollection = $QSCollection | ||
ResourceType = 'Outcome' | ||
} | ||
} | ||
$OutcomeResults = New-HaloGETRequest @RequestParams | ||
Return $OutcomeResults | ||
} catch { | ||
New-HaloError -ErrorRecord $_ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# New-HaloOutcome.ps1 | ||
Function New-HaloOutcome { | ||
[CmdletBinding( SupportsShouldProcess = $True )] | ||
[OutputType([Object[]])] | ||
Param ( | ||
[Parameter( Mandatory = $True )] | ||
[Object[]]$Outcome | ||
) | ||
Invoke-HaloPreFlightCheck | ||
try { | ||
if ($PSCmdlet.ShouldProcess($Outcome -is [Array] ? 'Outcomes' : 'Outcome', 'Create')) { | ||
New-HaloPOSTRequest -Object $Outcome -Endpoint 'Outcome' | ||
} | ||
} catch { | ||
New-HaloError -ErrorRecord $_ | ||
} | ||
} |