Documentation ¶
Overview ¶
Package f1fantasy provides APIs to access data from the f1 fantasy website.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct { }
Api is used to access the public API for the f1 fantasy website.
func NewApi ¶
func NewApi() *Api
NewApi creates an Api instance that can be used to access the public f1 fantasy Apis.
func (*Api) GetCircuits ¶
GetCircuits is a public API that retrieves the season's circuit information.
func (*Api) GetPlayers ¶
GetPlayers is a public API that retrieves player list and statistics.
type AuthenticatedApi ¶
type AuthenticatedApi struct { Api // contains filtered or unexported fields }
AuthenticatedApi is used to access both public and authenticated endpoints from the f1 fantasy website.
func NewAuthenticatedApi ¶
func NewAuthenticatedApi(user string, password string) (*AuthenticatedApi, error)
NewAuthenticatedApi creates an authenticated API instance that allows access to APIs requiring user login. This API also can be used with public APIs.
func (*AuthenticatedApi) CurrentCircuit ¶ added in v0.2.0
func (api *AuthenticatedApi) CurrentCircuit() (*CircuitInfo, error)
CurrentCircuit is an authenticated API that retrieves the upcoming/current race information.
func (*AuthenticatedApi) Expired ¶ added in v0.2.0
func (api *AuthenticatedApi) Expired() bool
Expired checks whether or not the session is still valid. If it isn't the client must create a new authenticated API instance.
func (*AuthenticatedApi) GetLeagueLeaderboard ¶
func (api *AuthenticatedApi) GetLeagueLeaderboard(leagueId int) (*LeagueLeaderboard, error)
GetLeagueLeaderboard is an Authenticated API that retrieves a particular leagues leaderboard.
type Circuit ¶
type Circuit struct { PeriodId int `json:"game_period_id"` Name string `json:"game_period_name"` Info CircuitInfo `json:"circuit"` }
Circuit encodes information for an F1 Circuit.
type CircuitInfo ¶
type CircuitInfo struct { StartDay time.Time Id int `json:"id"` FirstGrandPrix string `json:"first_grand_prix"` TotalLaps string `json:"laps_total"` Length string `json:"length"` Distance string `json:"distance"` LapRecord string `json:"lap_record"` Practice1 string `json:"pratice_one"` Practice2 string `json:"pratice_two"` Practice3 string `json:"pratice_three"` Qualifying string `json:"qualifying"` Race string `json:"race"` Created time.Time `json:"created_at"` Updated time.Time `json:"updated_at"` Name string `json:"name"` ShortName string `json:"short_name"` CountryIso string `json:"country_iso"` CircuitImage Image `json:"circuit_image"` GmtOffset string `json:"gmt_offset"` }
CircuitInfo encodes detailed information for an F1 Circuit. todo change practice and qualifying to time.time!
type ConstructorData ¶
type ConstructorData struct { BestFinish int `json:"best_finish"` BestFinishCount int `json:"best_finish_count"` BestGrid int `json:"best_grid"` BestGridCount int `json:"best_grid_count"` Titles int `json:"titles"` ChampionshipPoints float64 `json:"championship_points"` FirstSeason string `json:"first_season"` Poles int `json:"poles"` FastestLaps int `json:"fastest_laps"` Country string `json:"country"` HighestRaceFinished string `json:"highest_race_finished"` }
ConstructorData encodes detailed information for a Constructor.
type DriverData ¶
type DriverData struct { Wins int `json:"wins"` Podiums int `json:"podiums"` Poles int `json:"poles"` FastestLaps int `json:"fastest_laps"` TotalGrandPrix int `json:"grands_prix_entered"` Titles int `json:"titles"` ChampionshipPoints int `json:"championship_points"` BestFinish int `json:"best_finish"` BestFinishCount int `json:"best_finish_count"` BestGrid int `json:"best_grid"` BestGridCount int `json:"best_grid_count"` HighestRaceFinished string `json:"highest_race_finished"` PlaceOfBirth string `json:"place_of_birth"` }
DriverData encodes detailed information for a Driver.
type Headshot ¶
type Headshot struct { Profile string `json:"profile"` PitchView string `json:"pitch_view"` PlayerList string `json:"player_list"` }
Headshot contains urls for player headshot photos.
type Image ¶
type Image struct {
Url *string `json:"url,omitempty"`
}
Image contains information for a picture.
type Leaderboard ¶
type Leaderboard struct { NumEntrants int `json:"entrants_count"` LeagueName string `json:"league_name"` MaxPoints float64 `json:"max_points"` MinPoints float64 `json:"min_points"` LeagueMappingType *string `json:"league_mapping_type,omitempty"` // todo: figure out format LeagueMappingTypeParam *string `json:"league_mapping_type_param,omitempty"` // todo: figure out format Entries []LeaderboardEntry `json:"leaderboard_entrants"` }
Leaderboard contains information for the leaderboard for a particular league.
type LeaderboardEntry ¶
type LeaderboardEntry struct { UserId int `json:"user_id"` UserGlobalId string `json:"user_global_id"` UserExternalId int `json:"user_external_id"` IsVerifiedEntrant bool `json:"is_verified_entrant"` Country string `json:"user_country"` Score float64 `json:"score"` TeamName string `json:"team_name"` Rank int `json:"rank"` UserName string `json:"username"` Slot int `json:"slot"` UsedBoosterIds []int `json:"overall_used_booster_ids"` // todo: Figure out format! }
LeaderboardEntry is a particular entry in the league leaderboard.
type LeagueLeaderboard ¶
type LeagueLeaderboard struct {
Leaderboard Leaderboard `json:"leaderboard"`
}
LeagueLeaderboard is the parent container for all of the league leaderboard information.
type Meta ¶
type Meta struct {
Total int `json:"total"`
}
Meta encodes metadata for the F1 Players response.
type Player ¶
type Player struct { Id int `json:"id"` FirstName string `json:"first_name"` LastName string `json:"last_name"` TeamName string `json:"team_name"` Position string `json:"position"` PositionId int `json:"position_id"` PositionAbbreviation string `json:"position_abbreviation"` Price float64 `json:"price"` PriceChangeInfo *PriceChangeData `json:"current_price_change_info,omitempty"` //todo: Figure out format. Status *string `json:"status,omitempty"` //todo: Figure out format. Injured bool `json:"injured"` InjuryType *string `json:"injury_type,omitempty"` //todo: Figure out format. Banned bool `json:"banned"` BanType *string `json:"ban_type,omitempty"` //todo: Figure out format. ChanceOfPlaying float64 `json:"chance_of_playing"` TeamAbbreviation string `json:"team_abbreviation"` WeeklyPriceChange float64 `json:"weekly_price_change"` WeeklyPriceChangePercentage int64 `json:"weekly_price_change_percentage"` TeamId int `json:"team_id"` KnownName *string `json:"known_name,omitempty"` //todo: Figure out format. HeadshotImages Headshot `json:"headshot"` JerseyImage Image `json:"jersey_image"` ProfileImage Image `json:"profile_image"` MiscImage Image `json:"misc_image"` Score int64 `json:"score"` HumanizeStatus *string `json:"humanize_status,omitempty"` //todo: Figure out format. ShirtNumber *int64 `json:"shirt_number,omitempty"` Country *string `json:"country,omitempty"` CountryIso *string `json:"country_iso,omitempty"` IsConstructor bool `json:"is_constructor"` SeasonScore float64 `json:"season_score"` DriverStats *DriverData `json:"driver_data,omitempty"` ConstructorStats *ConstructorData `json:"constructor_data,omitempty"` Born *string `json:"born_at,omitempty"` SeasonPrices []PriceHistory `json:"season_prices,omitempty"` NumFixturesInGameweek int `json:"num_fixtures_in_gameweek"` DeletedInFeed bool `json:"deleted_in_feed"` HasFixture bool `json:"has_fixture"` DisplayName string `json:"display_name"` ExternalId string `json:"external_id"` }
Player contains all of the information for a particular F1 Driver or Constructor.
type PriceChangeData ¶ added in v0.1.1
type PriceChangeData struct { SelectionPercentage float64 `json:"current_selection_percentage"` ProbabilityPriceUpPercent int `json:"probability_price_up_percentage"` ProbabilityPriceDownPercent int `json:"probability_price_down_percentage"` }
Information about change in price.