public/Get-FootballFixturePredictedScore.ps1

function Get-FootballFixturePredictedScore {

    [CmdletBinding()]
    param(

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Competition,

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Date,
        
        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Path

    )
    process{

        $ErrorActionPreference = 'Stop'

        try {

            $Predictions = Import-Csv -Path "$Path\sportsmonk-predictions\$Competition\$Date\$Competition-240-$Date.csv"
            [PSCustomObject]$PredictionPSObjects =@()
            $Predictions | ForEach-Object { 

                $FixtureName = $_.FixtureName
                $FixtureId = $_.FixtureId

                $_.PSObject.Properties | Where-Object { $_.Name -match '^\d+-\d+$' } | ForEach-Object {

                    $PredictionPSObject = [PSCustomObject]@{
                        FixtureId = $FixtureId
                        FixtureName = $FixtureName
                        Result  = $_.Name
                        Percentage = $_.Value
                    }

                    $PredictionPSObjects += $PredictionPSObject

                }

            }

            $PredictionPSObjects

        }
        catch {

            "$($MyInvocation.MyCommand.Name): $_.Exception.Message"

        } # trycatch

    } # process

} # function