public/Get-FootballProbabilityPerformance.ps1
function Get-FootballProbabilityPerformance { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Competition, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [Object]$Header, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Token ) process{ $ErrorActionPreference = 'Stop' try { $LeagueIdentifier = Get-LeagueIdentifier -Competition $Competition $UriToUse = 'https://api.sportmonks.com/v3/football/predictions/predictability/leagues/'+$LeagueIdentifier+"?api_token=$Token&include=type;league" $Response = Invoke-RestMethod -Uri $UriToUse -Method 'GET' -Headers $Header $ResponseData = $($Response.data) foreach ($Object in $ResponseData) { $($Object.league) $($Object.type) $($Object.data) } # foreach } catch { "$($MyInvocation.MyCommand.Name): $_.Exception.Message" } # trycatch } # process } # function |