1418 TBA Libraries // Python // Go // Ruby
Go library for interfacing with The Blue Alliance API (v3).
go get github.com/frc1418/tbago
To use it in your project:
import (
...
"github.com/frc1418/tbago"
...
)
Data retrieval may appear somewhat complicated at first, as it uses a builder pattern scheme to structure requests. However, once you gain an understanding of this system the library is quite simple to use.
Before retrieving data, you must instantiate the library, providing a valid TBA API key. The Blue Alliance's API requires that all applications identify themselves with an auth key when retrieving data. To obtain an auth key, visit TBA's Account page.
tba, err := tbago.New(token)
// Always handle errors
There are several base requests you can make: Status()
, Teams(page int)
, Teams(number int)
, Events(year int)
, Event(id string)
, Match(key string)
, Districts(year int)
, and District(abbreviation string, year int)
.
If you like, you can stop there:
team, err := tba.Team(1418).Get()
// Handle error
However, you can also modify those requests before sending them. Many requests support Simple()
or Year()
modifiers for optional request parameters.
In addition, if you want to, say, get a list of the teams present at a given event, you would form your request thus:
teams, err := tba.Event("2017chcmp").Teams().Get()
Specific options can be found by searching through the source code.
tbago
was originally published as tba
by Carl Colglazier.
Development is now led by Erik Boesen through Team 1418.
This software is available under the terms of the ISC License.