go-footballdata: github.com/icedream/go-footballdata Index | Examples | Files

package footballdata

import "github.com/icedream/go-footballdata"

Code:

// Create client (optionally with auth token)
client := new(footballdata.Client).
    WithToken("<insert your api token here>")

// Get list of seasons...
competitions, err := client.Competitions().Do()
if err != nil {
    panic(err)
}

// ... and print them.
for _, competition := range competitions {
    fmt.Println(competition.Id, competition.Caption)
}

Index

Examples

Package Files

api_methods.go api_types.go api_url.go client.go req_competition.go req_competition_fixtures.go req_competition_leaguetable.go req_competition_teams.go req_competitions.go req_fixture.go req_fixtures.go req_soccerseason.go req_soccerseason_fixtures.go req_soccerseason_leaguetable.go req_soccerseason_teams.go req_soccerseasons.go req_team.go req_team_fixtures.go req_team_players.go response_meta.go util.go

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

Provides a high-level client implementation to talk to the API that football-data.org offers.

A new instance of Client will by default use the default HTTP client and no authentication token. To configure this, Client provides methods to set the token and the HTTP client. For more information, see the respective documentation of SetHttpClient and SetToken, or take a look at the fluent-style companion methods WithHttpClient and WithToken.

Code:

// Create client (optionally with auth token)
client := new(footballdata.Client).
    WithToken("<insert your api token here>")

// Tell it to use our API token (optional)
client.SetToken("<insert your api token here>")

// Do something with the client instance...
// Here we just fetch the listed soccer seasons on the API
competitions, err := client.Competitions().Do()
if err != nil {
    panic(err)
}
for _, competition := range competitions {
    fmt.Println(competition.Id, competition.Caption)
}

Code:

// Create client
client := new(footballdata.Client)

// If you have an API token, you can tell the Client instance to use it
client.SetToken("<insert your api token here>")

// The Client instance also allows you to use your own HTTP client configuration
client.SetHttpClient(&http.Client{
    Transport: &http.Transport{
        DisableCompression: true,
    }})

Code:

// Create client with custom token and wrapping a custom HTTP client
client := new(footballdata.Client).
    WithToken("<insert your api token here>").
    WithHttpClient(&http.Client{
        Transport: &http.Transport{
            DisableCompression: true,
        }})

// Do something with the client instance here...
_ = client

func NewClient Uses

func NewClient(h *http.Client) *Client

NewClient creates a new Client instance that wraps around the given HTTP client.

A call to this method is not necessary in order to create a working instance of Client. `new(footballdata.Client)` works just as fine.

func (*Client) Competition Uses

func (c *Client) Competition(id uint64) CompetitionRequest

Competition prepares a request to fetch the complete list of soccer seasons.

func (*Client) Competitions Uses

func (c *Client) Competitions() CompetitionsRequest

Competitions prepares a request to fetch the list of competitions for the current season or for any specified season (via the "Season" submethod).

func (*Client) Fixture Uses

func (c *Client) Fixture(id uint64) FixtureRequest

Fixture prepares a request to fetch the fixtures of a soccer season.

func (*Client) Fixtures Uses

func (c *Client) Fixtures() FixturesRequest

Fixtures prepares a request to fetch the fixtures of a soccer season.

func (*Client) FixturesOfCompetition Uses

func (c *Client) FixturesOfCompetition(soccerSeasonId uint64) CompetitionFixturesRequest

FixturesOfCompetition prepares a request to fetch the fixtures of a soccer season.

func (*Client) FixturesOfSoccerSeason Uses

func (c *Client) FixturesOfSoccerSeason(soccerSeasonId uint64) SoccerSeasonFixturesRequest

DEPRECATED.

FixturesOfSoccerSeason prepares a request to fetch the fixtures of a soccer season.

func (*Client) FixturesOfTeam Uses

func (c *Client) FixturesOfTeam(id uint64) TeamFixturesRequest

FixturesOfTeam prepares a request to fetch the fixtures of a soccer season.

func (*Client) LeagueTableOfCompetition Uses

func (c *Client) LeagueTableOfCompetition(soccerSeasonId uint64) CompetitionLeagueTableRequest

LeagueTableOfCompetition prepares a new request to fetch the league table of a given soccer season.

func (*Client) LeagueTableOfSoccerSeason Uses

func (c *Client) LeagueTableOfSoccerSeason(soccerSeasonId uint64) SoccerSeasonLeagueTableRequest

DEPRECATED.

LeagueTableOfSoccerSeason prepares a new request to fetch the league table of a given soccer season.

func (*Client) PlayersOfTeam Uses

func (c *Client) PlayersOfTeam(id uint64) TeamPlayersRequest

PlayersOfTeam prepares a request to fetch a team's players.

func (*Client) SetHttpClient Uses

func (c *Client) SetHttpClient(client *http.Client)

SetHttpClient sets the client that should be used to send out requests. Calling this method is *optional*.

func (*Client) SetToken Uses

func (c *Client) SetToken(authToken string)

SetToken sets the authentication token. Calling this method is *optional*.

func (*Client) SoccerSeason Uses

func (c *Client) SoccerSeason(id uint64) SoccerSeasonRequest

DEPRECATED.

SoccerSeason prepares a request to fetch the complete list of soccer seasons.

func (*Client) SoccerSeasons Uses

func (c *Client) SoccerSeasons() SoccerSeasonsRequest

DEPRECATED.

SoccerSeasons prepares a request to fetch the list of soccer seasons for the current season or for any specified season (via the "Season" submethod).

func (*Client) Team Uses

func (c *Client) Team(id uint64) TeamRequest

Team prepares a request to fetch a team's information.

func (*Client) TeamsOfCompetition Uses

func (c *Client) TeamsOfCompetition(soccerSeasonId uint64) CompetitionTeamsRequest

TeamsOfCompetition prepares a new request to fetch the league table of a given soccer season.

func (*Client) TeamsOfSoccerSeason Uses

func (c *Client) TeamsOfSoccerSeason(soccerSeasonId uint64) SoccerSeasonTeamsRequest

DEPRECATED.

TeamsOfSoccerSeason prepares a new request to fetch the league table of a given soccer season.

func (Client) WithHttpClient Uses

func (c Client) WithHttpClient(client *http.Client) *Client

WithHttpClient sets the client that should be used to send out requests on a copy of the current Client instance.

This method allows for easy fluent-style usage.

func (Client) WithToken Uses

func (c Client) WithToken(authToken string) *Client

WithToken sets the authentication token on a copy of the current Client instance.

This method allows for easy fluent-style usage.

type Competition Uses

type Competition struct {
    Id                uint64
    Caption           string
    League            string
    Year              string
    CurrentMatchday   uint16
    NumberOfMatchdays uint16
    NumberOfTeams     uint16
    NumberOfGames     uint16
    LastUpdated       time.Time
}

Contains information about a competition.

type CompetitionFixturesRequest Uses

type CompetitionFixturesRequest struct {
    // contains filtered or unexported fields
}

func (CompetitionFixturesRequest) Do Uses

func (r CompetitionFixturesRequest) Do() (s FixtureList, err error)

Do executes the request.

func (CompetitionFixturesRequest) Matchday Uses

func (r CompetitionFixturesRequest) Matchday(matchday uint16) CompetitionFixturesRequest

Matchday modifies the request to specify a match day.

func (CompetitionFixturesRequest) TimeFrame Uses

func (r CompetitionFixturesRequest) TimeFrame(timeframe time.Duration) CompetitionFixturesRequest

TimeFrame modifies the request to specify a specific relative time frame.

func (CompetitionFixturesRequest) TimeFrameEnd Uses

func (r CompetitionFixturesRequest) TimeFrameEnd(date time.Time) CompetitionFixturesRequest

TimeFrameEnd modifies the request to specify the end of the time frame filter for the returned results.

Only the year, month and day of the Time value will be used for the request.

func (CompetitionFixturesRequest) TimeFrameStart Uses

func (r CompetitionFixturesRequest) TimeFrameStart(date time.Time) CompetitionFixturesRequest

TimeFrameStart modifies the request to specify the beginning of the time frame filter for the returned results.

Only the year, month and day of the Time value will be used for the request.

type CompetitionLeagueTableRequest Uses

type CompetitionLeagueTableRequest struct {
    // contains filtered or unexported fields
}

func (CompetitionLeagueTableRequest) Do Uses

func (r CompetitionLeagueTableRequest) Do() (s LeagueTable, err error)

Do executes the request.

func (CompetitionLeagueTableRequest) Matchday Uses

func (r CompetitionLeagueTableRequest) Matchday(matchday uint16) CompetitionLeagueTableRequest

Matchday modifies the request to specify a match day.

type CompetitionList Uses

type CompetitionList []Competition

Contains the list of competitions returned by the API.

type CompetitionRequest Uses

type CompetitionRequest struct {
    // contains filtered or unexported fields
}

func (CompetitionRequest) Do Uses

func (r CompetitionRequest) Do() (s Competition, err error)

Do executes the request.

type CompetitionTeamsRequest Uses

type CompetitionTeamsRequest struct {
    // contains filtered or unexported fields
}

func (CompetitionTeamsRequest) Do Uses

func (r CompetitionTeamsRequest) Do() (s TeamList, err error)

Do executes the request.

type CompetitionsRequest Uses

type CompetitionsRequest struct {
    // contains filtered or unexported fields
}

func (CompetitionsRequest) Do Uses

func (r CompetitionsRequest) Do() (s CompetitionList, err error)

Do executes the request.

func (CompetitionsRequest) Season Uses

func (r CompetitionsRequest) Season(num uint32) CompetitionsRequest

Season modifies the request to specify a season.

type Fixture Uses

type Fixture struct {
    Date         time.Time
    Status       FixtureStatus
    Matchday     uint16
    HomeTeamName string
    AwayTeamName string
    Result       FixtureResult
}

Contains information about a fixture.

type FixtureList Uses

type FixtureList struct {
    Count    uint64
    Fixtures []Fixture
}

Contains a list of fixtures.

type FixtureRequest Uses

type FixtureRequest struct {
    // contains filtered or unexported fields
}

func (FixtureRequest) Do Uses

func (r FixtureRequest) Do() (s Fixture, err error)

Do executes the request.

func (FixtureRequest) Head2Head Uses

func (r FixtureRequest) Head2Head(num uint16) FixtureRequest

Head2Head modifies the request to specify the number of former games to be analyzed (normally 10).

type FixtureResponse Uses

type FixtureResponse struct {
    Fixture   Fixture
    Head2Head Head2Head
}

Contains the fixture and the head to head information delivered by the API for a wanted fixture.

type FixtureResult Uses

type FixtureResult struct {
    FixtureScore

    HalfTime        *FixtureScore
    ExtraTime       *FixtureScore
    PenaltyShootout *FixtureScore
}

Contains information about a fixture's results.

type FixtureScore Uses

type FixtureScore struct {
    GoalsHomeTeam uint16
    GoalsAwayTeam uint16
}

type FixtureStatus Uses

type FixtureStatus string
const (
    FixtureStatus_Scheduled FixtureStatus = "SCHEDULED"
    FixtureStatus_Timed     FixtureStatus = "TIMED"
    FixtureStatus_Postponed FixtureStatus = "POSTPONED"
    FixtureStatus_InPlay    FixtureStatus = "IN_PLAY"
    FixtureStatus_Canceled  FixtureStatus = "CANCELED"
    FixtureStatus_Finished  FixtureStatus = "FINISHED"
)

type FixturesRequest Uses

type FixturesRequest struct {
    // contains filtered or unexported fields
}

func (FixturesRequest) Do Uses

func (r FixturesRequest) Do() (s FixturesResponse, err error)

Do executes the request.

func (FixturesRequest) League Uses

func (r FixturesRequest) League(leagueCodes ...string) FixturesRequest

League modifies the request to specify a list of leagues by their code.

func (FixturesRequest) TimeFrame Uses

func (r FixturesRequest) TimeFrame(timeframe time.Duration) FixturesRequest

TimeFrame modifies the request to specify a specific relative time frame.

func (FixturesRequest) TimeFrameEnd Uses

func (r FixturesRequest) TimeFrameEnd(date time.Time) FixturesRequest

TimeFrameEnd modifies the request to specify the end of the time frame filter for the returned results.

Only the year, month and day of the Time value will be used for the request.

func (FixturesRequest) TimeFrameStart Uses

func (r FixturesRequest) TimeFrameStart(date time.Time) FixturesRequest

TimeFrameStart modifies the request to specify the beginning of the time frame filter for the returned results.

Only the year, month and day of the Time value will be used for the request.

type FixturesResponse Uses

type FixturesResponse struct {
    FixtureList

    TimeFrameStart time.Time
    TimeFrameEnd   time.Time
}

Contains information about a list of fixtures as returned by the API.

type Head2Head Uses

type Head2Head struct {
    Count               uint64
    TimeFrameStart      time.Time
    TimeFrameEnd        time.Time
    HomeTeamWins        uint64
    AwayTeamWins        uint64
    Draws               uint64
    LastHomeWinHomeTeam *Fixture
    LastWinHomeTeam     *Fixture
    LastAwayWinAwayTeam *Fixture
    Fixtures            []Fixture
}

Contains head to head information.

type LeagueTable Uses

type LeagueTable struct {
    LeagueCaption string
    Matchday      uint16
    Standing      []TeamLeagueStatistics
}

Contains the league table for a season.

type Player Uses

type Player struct {
    Id            uint64
    Name          string
    Position      string
    JerseyNumber  uint8
    DateOfBirth   time.Time
    Nationality   string
    ContractUntil time.Time
    MarketValue   string
}

Contains information about a player.

type PlayerList Uses

type PlayerList struct {
    Count   uint64
    Players []Player
}

Contains a list of players.

type ResponseMeta Uses

type ResponseMeta struct {
    // Indicates the recognized user or returns "anonymous" if not authenticated.
    AuthenticatedClient string

    // Defines the seconds left to reset your request counter.
    RequestCounterReset uint64

    // Indicates the requests left.
    RequestsAvailable uint64
}

Contains additional information returned by the Football-Data API in the HTTP headers. This includes the currently authenticated user and information about the rate limitation.

type ShortTeamLeagueStatistics Uses

type ShortTeamLeagueStatistics struct {
    Draws        uint16
    Goals        uint16
    GoalsAgainst uint16
    Losses       uint16
    Wins         uint16
}

type SoccerSeason Uses

type SoccerSeason struct {
    Id                uint64
    Caption           string
    League            string
    Year              string
    CurrentMatchday   uint16
    NumberOfMatchdays uint16
    NumberOfTeams     uint16
    NumberOfGames     uint16
    LastUpdated       time.Time
}

DEPRECATED.

Contains information about a soccer season.

type SoccerSeasonFixturesRequest Uses

type SoccerSeasonFixturesRequest struct {
    // contains filtered or unexported fields
}

DEPRECATED.

func (SoccerSeasonFixturesRequest) Do Uses

func (r SoccerSeasonFixturesRequest) Do() (s FixtureList, err error)

DEPRECATED.

Do executes the request.

func (SoccerSeasonFixturesRequest) Matchday Uses

func (r SoccerSeasonFixturesRequest) Matchday(matchday uint16) SoccerSeasonFixturesRequest

DEPRECATED.

Matchday modifies the request to specify a match day.

func (SoccerSeasonFixturesRequest) TimeFrame Uses

func (r SoccerSeasonFixturesRequest) TimeFrame(timeframe time.Duration) SoccerSeasonFixturesRequest

DEPRECATED.

TimeFrame modifies the request to specify a specific time frame.

type SoccerSeasonLeagueTableRequest Uses

type SoccerSeasonLeagueTableRequest struct {
    // contains filtered or unexported fields
}

func (SoccerSeasonLeagueTableRequest) Do Uses

func (r SoccerSeasonLeagueTableRequest) Do() (s LeagueTable, err error)

DEPRECATED.

Do executes the request.

func (SoccerSeasonLeagueTableRequest) Matchday Uses

func (r SoccerSeasonLeagueTableRequest) Matchday(matchday uint16) SoccerSeasonLeagueTableRequest

DEPRECATED.

Matchday modifies the request to specify a match day.

type SoccerSeasonList Uses

type SoccerSeasonList []SoccerSeason

DEPRECATED.

Contains the list of soccer seasons returned by the API.

type SoccerSeasonRequest Uses

type SoccerSeasonRequest struct {
    // contains filtered or unexported fields
}

DEPRECATED.

func (SoccerSeasonRequest) Do Uses

func (r SoccerSeasonRequest) Do() (s SoccerSeason, err error)

DEPRECATED.

Do executes the request.

type SoccerSeasonTeamsRequest Uses

type SoccerSeasonTeamsRequest struct {
    // contains filtered or unexported fields
}

DEPRECATED.

func (SoccerSeasonTeamsRequest) Do Uses

func (r SoccerSeasonTeamsRequest) Do() (s TeamList, err error)

DEPRECATED.

Do executes the request.

type SoccerSeasonsRequest Uses

type SoccerSeasonsRequest struct {
    // contains filtered or unexported fields
}

DEPRECATED.

func (SoccerSeasonsRequest) Do Uses

func (r SoccerSeasonsRequest) Do() (s SoccerSeasonList, err error)

DEPRECATED.

Do executes the request.

func (SoccerSeasonsRequest) Season Uses

func (r SoccerSeasonsRequest) Season(num uint32) SoccerSeasonsRequest

DEPRECATED.

Season modifies the request to specify a season.

type Team Uses

type Team struct {
    Id               uint64
    Name             string
    ShortName        string
    SquadMarketValue string
    CrestUrl         string
}

Contains information about a team.

type TeamFixturesRequest Uses

type TeamFixturesRequest struct {
    // contains filtered or unexported fields
}

func (TeamFixturesRequest) Do Uses

func (r TeamFixturesRequest) Do() (s FixturesResponse, err error)

Do executes the request.

func (TeamFixturesRequest) Season Uses

func (r TeamFixturesRequest) Season(season uint64) TeamFixturesRequest

Season modifies the request to specify a list of leagues by their code.

func (TeamFixturesRequest) TimeFrame Uses

func (r TeamFixturesRequest) TimeFrame(timeframe time.Duration) TeamFixturesRequest

TimeFrame modifies the request to specify a specific time frame.

func (TeamFixturesRequest) Venue Uses

func (r TeamFixturesRequest) Venue(venue Venue) TeamFixturesRequest

Venue modifies the request to specify a venue.

type TeamLeagueStatistics Uses

type TeamLeagueStatistics struct {
    TeamName       string
    CrestURI       string
    Draws          uint16
    GoalDifference int16
    Goals          uint16
    GoalsAgainst   uint16
    Losses         uint16
    PlayedGames    uint8
    Points         uint16
    Position       uint8
    Wins           uint16
    Home           ShortTeamLeagueStatistics
    Away           ShortTeamLeagueStatistics
}

Contains statistical information about a team's performance in a league. TODO - Introduce minified variant of this struct.

type TeamList Uses

type TeamList struct {
    Count uint64
    Teams []Team
}

Contains a list of teams.

type TeamPlayersRequest Uses

type TeamPlayersRequest struct {
    // contains filtered or unexported fields
}

func (TeamPlayersRequest) Do Uses

func (r TeamPlayersRequest) Do() (s PlayerList, err error)

Do executes the request.

type TeamRequest Uses

type TeamRequest struct {
    // contains filtered or unexported fields
}

func (TeamRequest) Do Uses

func (r TeamRequest) Do() (s Team, err error)

Do executes the request.

type Venue Uses

type Venue string

Describes the venue.

const (
    // The home venue.
    Venue_Home Venue = "home"
    // The away venue.
    Venue_Away Venue = "away"
)

Package footballdata imports 10 packages (graph). Updated 2017-08-10. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).