public/Get-FootballDataBookmaker.ps1
function Get-FootballDataBookmaker { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [ValidateSet('bet365')] [string]$Bookmaker, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Competition, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [int]$PreviousCount, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$SourcePath, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$TargetPath ) process{ $Uri = Get-FootballDataFileUrl -Competition $Competition $FileName = $Uri.Split('/')[-1] $FullPath = "$SourcePath\$FileName" Invoke-WebRequest -Uri $Uri -OutFile $FullPath $Fixutres = Import-Csv -Path $FullPath switch ($Bookmaker) { 'bet365' { $Bookermaker = $Fixutres | Select-Object -Property Div,Date,Time,HomeTeam,AwayTeam,FTR,B365H,B365D,B365A | Select-Object -Last $PreviousCount } } $Bookermaker | Export-Csv -Path "$TargetPath\$Competition-bookmaker.csv" -Force -Verbose return $Bookermaker } # process } # function |