Private/ConvertFrom-SIAResponse.ps1

function ConvertFrom-SIAResponse {
    <#
    Stamps a PSTypeName onto parsed API responses so downstream cmdlets,
    format data, and Get-Member all agree on what an object is. Does not
    rename or drop API properties - psSIA never loses information a response
    actually returned.
    #>

    [CmdletBinding()]
    [OutputType([pscustomobject])]
    param(
        [Parameter(Mandatory, ValueFromPipeline)]
        [AllowNull()]
        $InputObject,

        [string]$TypeName
    )

    process {
        if ($null -eq $InputObject) {
            return
        }

        if ($TypeName) {
            foreach ($item in @($InputObject)) {
                if ($item -is [pscustomobject]) {
                    $item.PSObject.TypeNames.Insert(0, $TypeName)
                }
                $item
            }
        } else {
            $InputObject
        }
    }
}