private/Get-FootballDataFileUri.ps1
function Get-FootballDataFileUri { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Competition ) process{ $ErrorActionPreference = 'Stop' try { switch ($Competition) { 'eng-premier' { $Uri = 'https://www.football-data.co.uk/mmz4281/2425/E0.csv' } 'eng-championship' { $Uri = 'https://www.football-data.co.uk/mmz4281/2425/E1.csv' } 'sco-premier' { $Uri = 'https://www.football-data.co.uk/mmz4281/2425/SC0.csv' } 'ger-bundesliga' { $Uri = 'https://www.football-data.co.uk/mmz4281/2425/D1.csv' } 'ita-seriea' { $Uri = 'https://www.football-data.co.uk/mmz4281/2425/I1.csv' } 'esp-laliga' { $Uri = 'https://www.football-data.co.uk/mmz4281/2425/SP1.csv' } 'nld-eredivisie' { $Uri = 'https://www.football-data.co.uk/mmz4281/2425/N1.csv' } 'fra-ligue1' { $Uri = 'https://www.football-data.co.uk/mmz4281/2425/F1.csv' } default { $Uri = 'NotFound' } } return $Uri } catch { $_.Exception } } # process } # function |