Public/Get-JiraPriority.ps1
function Get-JiraPriority { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( DefaultParameterSetName = '_All' )] param( [Parameter( Position = 0, Mandatory, ValueFromPipeline, ParameterSetName = '_Search' )] [Int[]] $Id, [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential = [System.Management.Automation.PSCredential]::Empty ) begin { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started" $server = Get-JiraConfigServer -ErrorAction Stop $resourceURi = "$server/rest/api/latest/priority{0}" } process { Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] ParameterSetName: $($PsCmdlet.ParameterSetName)" Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)" switch ($PSCmdlet.ParameterSetName) { '_All' { $parameter = @{ URI = $resourceURi -f "" Method = "GET" Credential = $Credential } Write-Debug "[$($MyInvocation.MyCommand.Name)] Invoking JiraMethod with `$parameter" $result = Invoke-JiraMethod @parameter Write-Output (ConvertTo-JiraPriority -InputObject $result) } '_Search' { foreach ($_id in $Id) { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Processing [$_id]" Write-Debug "[$($MyInvocation.MyCommand.Name)] Processing `$_id [$_id]" $parameter = @{ URI = $resourceURi -f "/$_id" Method = "GET" Credential = $Credential } Write-Debug "[$($MyInvocation.MyCommand.Name)] Invoking JiraMethod with `$parameter" $result = Invoke-JiraMethod @parameter Write-Output (ConvertTo-JiraPriority -InputObject $result) } } } } end { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete" } } |