public/Get-FootballFixtureProbabilityType.ps1

function Get-FootballFixtureProbabilityType {
    <#
        .SYNOPSIS
            Retrieves the prediction probability types.
 
        .EXAMPLE
            Get-FootballFixtureProbabilityType -Header $Headers -Token $Token -FixtureId 19134546
 
        .INPUTS
            - [Object] Header
 
    #>

    [CmdletBinding()]
    param(

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

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [Object]$Header,

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Token

    )
    process{

        $ErrorActionPreference = 'Stop'


        try {

            $Response = Invoke-RestMethod -Uri "https://api.sportmonks.com/v3/football/predictions/probabilities/fixtures/$($FixtureId)?api_token=$Token" -Method 'GET' -Headers $Header
            $Types = $($Response.data.type_id)

            foreach ($Type in $Types) {

                $TypeUri = 'https://api.sportmonks.com/v3/core/types/'+$Type+'?api_token='+$Token
                $TypeResponse = Invoke-RestMethod $TypeUri -Method 'GET' -Headers $Headers
                $($TypeResponse.data)

            }

        }
        catch {

            $_.Exception.Message

        } # try catch

    } # process

} # function