Skip to content

TralahM/football-data.org

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Build Status License: GPLv3 Organization PRs Welcome GitHub pull-requests Language Donate using Liberapay

football-data.org.

A Go Client for the Football-data.org API.

Installation

# In terminal do:
$ go get -u github.com/tralahm/football-data.org

Usage

package main

import (
	"fmt"

	football_data "github.com/tralahm/football-data.org"
)

func main() {

	XAuthToken := "your football-data api key"

	apiClient := football_data.NewAPIClient(XAuthToken)

	leaguesResponse := apiClient.GetLeagues()
	fmt.Println(leaguesResponse.Competitions[0])
	LeagueID := "2018"
	competition := apiClient.GetLeague(LeagueID)
	fmt.Println(competition)
	gamesResponse := apiClient.GetGames(LeagueID)
	fmt.Println(gamesResponse.Matches[0])
	teamsResponse := apiClient.GetTeams(LeagueID)
	fmt.Println(teamsResponse.Teams[0])
	GameID := "239019"
	gameR := apiClient.GetGameDetails(GameID)
	fmt.Println(gameR.Head2Head, gameR.Match)
	standingsResponse := apiClient.GetLeague(LeagueID)
	fmt.Println(standingsResponse.Standings[0])
}

LICENCE

Read the license here

Self-Promotion

TralahM TralahM

Blog

TralahTek