Skip to content

matheustex/football-data-sdk

Repository files navigation

football-data-sdk

football-data-sdk (latest SemVer) GoDoc Test Status

football-data-sdk is a Go client library for accessing the Football Data API.

Successful queries return native Go structs.

Services

  • Areas
  • Competitions
  • Matches
  • Players
  • Teams

Installation

football-data-sdk is compatible with modern Go releases in module mode, with Go installed:

go get github.com/matheus-tex/football-data-sdk

will resolve and add the package to the current development module, along with its dependencies.

Alternatively the same can be achieved if you use import in a package:

import "github.com/matheus-tex/football-data-sdk"

and run go get without parameters.

Usage

import "github.com/matheus-tex/football-data-sdk"
client := football.NewClient()

// list all competitions
competitions, err := client.Competitions.List(context.Background(), nil)

Some API methods have optional parameters that can be passed. For example:

client := github.NewClient(nil)

// list public matches for a player
filters := &football.PlayerFiltersOptions{Limit: "5"}
matches, err := client.Players.Matches(context.Background(), "1", filters)

Make sure to export the env FOOTBALL_API_TOKEN with your API_TOKEN.

License

This library is distributed under the MIT license found in the LICENSE file.