Request/Resolution/Get-SDPRequestResolution.ps1

Function Get-SDPRequestResolution
{
    <#
    .SYNOPSIS
        Get note by id
 
    .PARAMETER RequestId
        Request id
 
    .EXAMPLE
        $Resolution = Get-SDPRequestResolution -RequestId 54321
 
    .NOTES
        Author: Michal Gajda
    #>

    [CmdletBinding(
        SupportsShouldProcess=$True,
        ConfirmImpact="Low"
    )]
    param (
        [String]$UriSDP,
        [String]$ApiKey,
        [Parameter(Mandatory=$true,
            ValueFromPipeline)]
        [Int]$RequestId
    )

    Begin
    {
        #Create headers
        if(!$MyInvocation.BoundParameters.ContainsKey("UriSDP")) { $UriSDP = $Global:UriSDP }
        if(!$MyInvocation.BoundParameters.ContainsKey("ApiKey")) { $ApiKey = $Global:ApiKey }
    }

    Process
    {
        #Get by ID
        $InvokeParams = @{
            UriSDP = $UriSDP
            ApiKey = $ApiKey
            Method = "GET"
            EntityUri = "/api/v3/requests/$RequestId/resolutions"
        }

        #Send request
        If ($PSCmdlet.ShouldProcess($RequestId,"Get resolution from request id"))
        {
            $Result = Invoke-SDPAPIEntity @InvokeParams
            $Results = $Result.resolution
        }

        #Return result
        if($MyInvocation.BoundParameters.ContainsKey("Debug"))
        {
            Return $Result
        } else {
            Return $Results
        }
    }

    End{}
}