functions/Save-S1CurrentPackage.ps1

<#
.SYNOPSIS
    Short description
.DESCRIPTION
    Long description
.EXAMPLE
    PS C:\> <example usage>
    Explanation of what the example does
.INPUTS
    Inputs (if any)
.OUTPUTS
    Output (if any)
.NOTES
    General notes
#>

function Save-S1CurrentPackage {
    [CmdletBinding()]
    param (
        [Switch]$GetLatest,
        [switch]$Force
    )
     
    process {
        
        $url = "https://downloads.sentryone.com/downloads/epi/current.s1package"
        $OutFile = [IO.Path]::Combine((Get-S1ConfigureAppPath),"packages","current.s1package")
        Write-Verbose "OutFile $OutFile"
        $PackageName = "s1package"
        $Header = "ETag"

        if ($GetLatest -or -not (Test-path $OutFile)) {
            $output = Save-PackageFromUrl -Url $url -OutFile $outFile -packagename $PackageName -header $Header -Force:$Force
        }
        else{ $output =[PSCustomObject]@{Message="Not downloaded"}}
        return $output
    }
}