Apps/Get-JASP.ps1

Function Get-JASP {
    <#
        .SYNOPSIS
            Returns the available JASP versions.
 
        .NOTES
            Author: Andrew Cooper
            Twitter: @adotcoop
    #>

    [OutputType([System.Management.Automation.PSObject])]
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "")]
    [CmdletBinding(SupportsShouldProcess = $False)]
    param (
        [Parameter(Mandatory = $False, Position = 0)]
        [ValidateNotNull()]
        [System.Management.Automation.PSObject]
        $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]),

        [Parameter(Mandatory = $False, Position = 1)]
        [ValidateNotNull()]
        [System.String] $Filter
    )

    # Pass the repo releases API URL and return a formatted object
    $params = @{
        Uri               = $res.Get.Update.Uri
        MatchVersion      = $res.Get.Update.MatchVersion
        Filter            = $res.Get.Update.MatchFileTypes
        ReturnVersionOnly = $True
    }
    $object = Get-GitHubRepoRelease @params

    # Build the output object
    If ($Null -ne $object) {
        $PSObject = [PSCustomObject] @{
            Version = $object.Version
            URI     = $res.Get.Download.Uri -replace $res.Get.Download.ReplaceText, $object.Version
        }
        Write-Output -InputObject $PSObject
    }
}