Documentation
¶
Overview ¶
Consume the PandaScore API in Go.
TODO look at errors and how they're returned; we should probably be using Wrap() and stuff but I don't fully understand how that works
Index ¶
Constants ¶
const ( // PandaScore API base URL BaseURL string = "api.pandascore.co" // Name of the environment variable that contains the PandaScore access token AccessTokenEnvironmentVariable string = "PANDASCORE_ACCESS_TOKEN" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
PandaScore client which is the primary entity.
func New ¶
func New() *Client
Construct a new PandaScore client with the default URL.
By default, the PandaScore access token will be read from the environment variable defined in the AccessTokenEnvironmentVariable constant. You can set it afterwards, for example if there is not environment variable.
func (*Client) AccessToken ¶
Sets this client's PandaScore access token to the given value.
func (*Client) GetLeagues ¶
Returns all known leagues for the given game.
func (*Client) GetRunningSeries ¶
Returns the currently ongoing series for the given game.
type Game ¶
type Game string
Game represents a single game in the PandaScore API (eg. csgo, dota2, ...)
type League ¶
type League struct {
ID int `json:"id"`
Name string `json:"name"`
Modified time.Time `json:"modified_at"`
URL string `json:"url"`
}
League represents a logical group of series, which are events that belong to a league.
More information: https://developers.pandascore.co/doc/#section/Introduction/Events-hierarchy
type PandaScoreError ¶
type PandaScoreError struct {
Message string `json:"error"`
}
Represents an error coming directly from the PandaScore API (eg. no or invalid access token).
func (*PandaScoreError) Error ¶
func (pse *PandaScoreError) Error() string
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
PandaScore API request with it's attributes
TODO add support for range
func (*Request) Execute ¶
Execute the request against the PandaScore API and marshal the response body in the value pointed to by value.
func (*Request) Filter ¶
Adds a filter parameter to the request, where the given field must match the given value.
More information: https://developers.pandascore.co/doc/index.htm#section/Introduction/Filtering
func (*Request) Search ¶
Adds a search parameter to the request, where the given field must contain the given value.
More information: https://developers.pandascore.co/doc/index.htm#section/Introduction/Search