tba

package module
v0.0.0-...-8a76c6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2020 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const BASE = "https://thebluealliance.com/api/v3/"

BASE URL for The Blue Alliance API. We are on v3 at the moment.

Variables

This section is empty.

Functions

This section is empty.

Types

type Award

type Award struct {
	Name          string `json:"name"`
	AwardType     int    `json:"award_type"`
	EventKey      string `json:"event_key"`
	RecipientList []struct {
		TeamKey string `json:"team_key"`
		Awardee string `json:"awardee"`
	} `json:"recipient_list"`
	Year int `json:"year"`
}

type District

type District struct {
	Abbreviation string `json:"abbreviation"`
	DisplayName  string `json:"display_name"`
	Key          string `json:"key"`
	Year         int    `json:"year"`
}

type Event

type Event struct {
	Key             string   `json:"key"`
	Name            string   `json:"name"`
	EventCode       string   `json:"event_code"`
	EventType       int      `json:"event_type"`
	District        District `json:"district"`
	City            string   `json:"city"`
	StateProv       string   `json:"state_prov"`
	PostalCode      string   `json:"postal_code"`
	Country         string   `json:"country"`
	Address         string   `json:"address"`
	StartDate       string   `json:"start_date"`
	EndDate         string   `json:"end_date"`
	Year            int      `json:"year"`
	ShortName       string   `json:"short_name"`
	EventTypeString string   `json:"event_type_string"`
	Week            int      `json:"week"`
	GMapsPlaceID    string   `json:"gmaps_place_id"`
	GMapsURL        string   `json:"gmaps_url"`
	Latitude        float64  `json:"lat"`
	Longitude       float64  `json:"lng"`
	LocationName    string   `json:"location_name"`
	Timezone        string   `json:"timezone"`
	DivisionKeys    []string `json:"division_keys"`
	Website         string   `json:"website"`
	FIRSTEventID    string   `json:"first_event_id"`
	FIRSTEventCode  string   `json:"first_event_code"`
	Webcasts        []struct {
		Channel string `json:"channel"`
		Type    string `json:"type"`
	} `json:"webcasts"`
	ParentEventKey    string `json:"parent_event_key"`
	PlayoffType       int    `json:"playoff_type"`
	PlayoffTypeString string `json:"playoff_type_string"`
}

type Match

type Match struct {
	Key         string `json:"key"`
	CompLevel   string `json:"comp_level"`
	SetNumber   int    `json:"set_number"`
	MatchNumber int    `json:"match_number"`
	Alliances   struct {
		Blue struct {
			DQTeams        []string `json:"dq_team_keys"`
			Score          int      `json:"score"`
			SurrogateTeams []string `json:"surrogate_team_keys"`
			TeamKeys       []string `json:"team_keys"`
		} `json:"blue"`
		Red struct {
			DQTeams        []string `json:"dq_team_keys"`
			Score          int      `json:"score"`
			SurrogateTeams []string `json:"surrogate_team_keys"`
			TeamKeys       []string `json:"team_keys"`
		} `json:"red"`
	} `json:"alliances"`
	WinningAlliance string                 `json:"winning_alliance"`
	EventKey        string                 `json:"event_key"`
	Time            int64                  `json:"time"`
	ActualTime      int64                  `json:"actual_time"`
	PredictedTime   int64                  `json:"predicted_time"`
	PostResultTime  int64                  `json:"post_result_time"`
	ScoreBreakdown  map[string]interface{} `json:"score_breakdown"`
	Videos          []struct {
		Type string `json:"type"`
		Key  string `json:"key"`
	} `json:"videos"`
}

type TBACall

type TBACall struct {
	Modified string
	Body     string
}

/ TBACall is n API call item for the cache.

type Team

type Team struct {
	Key              string         `json:"key"`
	TeamNumber       int            `json:"team_number"`
	Nickname         string         `json:"nickname"`
	Name             string         `json:"name"`
	City             string         `json:"city"`
	StateProv        string         `json:"state_prov"`
	Country          string         `json:"country"`
	Address          string         `json:"address"`
	PostalCode       string         `json:"postal_code"`
	GMapsPlaceID     string         `json:"gmaps_place_id"`
	GMapsURL         string         `json:"gmaps_url"`
	Latitude         float64        `json:"lat"`
	Longitude        float64        `json:"lng"`
	LocationName     string         `json:"location_name"`
	Website          string         `json:"website"`
	Motto            string         `json:"motto"`
	RookieYear       int            `json:"rookie_year"`
	HomeChampionship map[int]string `json:"home_championship"`
}

type TheBlueAlliance

type TheBlueAlliance struct {
	Key string
	// contains filtered or unexported fields
}

/ TheBlueAlliance strores the access key; caches responses.

func NewTba

func NewTba(key string) *TheBlueAlliance

NewTba creates a new TheBlueAlliance object and initialize the cache. Note: the Key is super required because you can't access the API without it.

func (*TheBlueAlliance) Close

func (tba *TheBlueAlliance) Close()

func (*TheBlueAlliance) GetAllEventMatches

func (tba *TheBlueAlliance) GetAllEventMatches(year int) (chan []Match, error, int)

func (*TheBlueAlliance) GetAllEvents

func (tba *TheBlueAlliance) GetAllEvents(year int) ([]Event, error)

func (*TheBlueAlliance) GetAllOfficialEvents

func (tba *TheBlueAlliance) GetAllOfficialEvents(year int) ([]Event, error)

func (*TheBlueAlliance) GetAllTeams

func (tba *TheBlueAlliance) GetAllTeams() ([]Team, error)

func (*TheBlueAlliance) GetEventMatches

func (tba *TheBlueAlliance) GetEventMatches(key string) ([]Match, error)

func (*TheBlueAlliance) Team

func (tba *TheBlueAlliance) Team(s string) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL