Private/Find-NugetPackage.ps1

# All credit and major props to Joel Bennett for this simplified solution that doesn't depend on PowerShellGet
# https://gist.github.com/Jaykul/1caf0d6d26380509b04cf4ecef807355
function Find-NugetPackage {
    [CmdletBinding()]
    param(
        # The name of a package to find
        [Parameter(Mandatory)]
        $Name,
        # The repository api URL -- like https://www.powershellgallery.com/api/v2/ or https://www.nuget.org/api/v2/
        $PackageSourceUrl = 'https://www.powershellgallery.com/api/v2/',

        #If specified takes precedence over version
        [switch]$IsLatest,

        [string]$Version
    )

    #Ugly way to do this. Prefer islatest, otherwise look for version, otherwise grab all matching modules
    if($IsLatest)
    {
        Write-Verbose "Searching for latest [$name] module"
        $URI = "${PackageSourceUrl}Packages?`$filter=Id eq '$name' and IsLatestVersion"
    }
    elseif($PSBoundParameters.ContainsKey($Version))
    {
        Write-Verbose "Searching for version [$version] of [$name]"
        $URI = "${PackageSourceUrl}Packages?`$filter=Id eq '$name' and Version eq '$Version'"
    }
    else
    {
        Write-Verbose "Searching for all versions of [$name] module"
        $URI = "${PackageSourceUrl}Packages?`$filter=Id eq '$name'"
    }

    Invoke-RestMethod $URI | 
    Select-Object @{n='Name';ex={$_.title.('#text')}},
                  @{n='Author';ex={$_.author.name}},
                  @{n='Version';ex={$_.properties.NormalizedVersion}},
                  @{n='Uri';ex={$_.Content.src}},
                  @{n='Description';ex={$_.properties.Description}},
                  @{n='Properties';ex={$_.properties}}
}