public/Get-FootballData.ps1
function Get-FootballData { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Competition, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$TargetPath ) process{ try { $Uri = Get-FootballDataFileUri -Competition $Competition if ($Uri -ne 'NotFound') { $Hash1 =@{ Competition = $Competition Uri = $Uri } $Hash1 $FileName = $Uri.Split('/')[-1] $FullPath = "$TargetPath\$FileName" Invoke-WebRequest -Uri $Uri -Method Get -OutFile $FullPath } else { Write-Warning -Message "$Compettion Uri not found." } } catch { throw "$($MyInvocation.MyCommand.Name): $_.Exception.Message" } # try catch } # process } # function |