models

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package models defines the data structures used throughout the FPL SDK. These models map directly to the JSON responses from the official FPL API.

Index

Constants

View Source
const (
	StatGoalsScored     = "goals_scored"
	StatAssists         = "assists"
	StatOwnGoals        = "own_goals"
	StatYellowCards     = "yellow_cards"
	StatRedCards        = "red_cards"
	StatPenaltiesSaved  = "penalties_saved"
	StatPenaltiesMissed = "penalties_missed"
	StatSaves           = "saves"
	StatBonus           = "bonus"
)

Standard identifiers for match statistics.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutomaticSub

type AutomaticSub struct {
	Entry      int `json:"entry"`       // Entry ID of the player
	ElementIn  int `json:"element_in"`  // Player ID coming in
	ElementOut int `json:"element_out"` // Player ID going out
	Event      int `json:"event"`       // Gameweek ID
}

type Chip

type Chip struct {
	Name  string    `json:"name"`  // Name of the chip (e.g., "wildcard")
	Time  time.Time `json:"time"`  // Time when the chip was used
	Event int       `json:"event"` // Gameweek ID when the chip was used
}

Chip represents the details of a chip used by the manager.

type ChipPlay

type ChipPlay struct {
	ChipName  string `json:"chip_name"`
	NumPlayed int    `json:"num_played"`
}

ChipPlay represents statistics for a specific chip (e.g., "wildcard", "triple_captain") played during a gameweek.

type ClassicLeague

type ClassicLeague struct {
	NewEntries      NewEntries `json:"new_entries"`
	LastUpdatedData time.Time  `json:"last_updated_data"`
	League          League     `json:"league"`
	Standings       Standings  `json:"standings"`
}

func (*ClassicLeague) GetLeagueInfo

func (cl *ClassicLeague) GetLeagueInfo() string

func (*ClassicLeague) GetTopManagers

func (cl *ClassicLeague) GetTopManagers(n int) []LeagueManager

func (*ClassicLeague) GetUpdateTime

func (cl *ClassicLeague) GetUpdateTime() string

type CurrentEvents

type CurrentEvents struct {
	Event              int `json:"event"`                // Gameweek ID
	Points             int `json:"points"`               // Points scored in the gameweek
	TotalPoints        int `json:"total_points"`         // Total points accumulated
	Rank               int `json:"rank"`                 // Current rank
	RankSort           int `json:"rank_sort"`            // Rank sort
	OverallRank        int `json:"overall_rank"`         // Overall rank
	PercentileRank     int `json:"percentile_rank"`      // Percentile rank
	Bank               int `json:"bank"`                 // Money in bank
	Value              int `json:"value"`                // Team value
	EventTransfers     int `json:"event_transfers"`      // Transfers made in the gameweek
	EventTransfersCost int `json:"event_transfers_cost"` // Cost of transfers
	PointsOnBench      int `json:"points_on_bench"`      // Points scored by bench players
}

CurrentEvent represents the details of this year's gameweek events.

type EntryHistory

type EntryHistory struct {
	Event              int `json:"event"`                // Gameweek ID
	Points             int `json:"points"`               // Points scored
	TotalPoints        int `json:"total_points"`         // Total points
	Rank               int `json:"rank"`                 // Current rank
	RankSort           int `json:"rank_sort"`            // Rank sort
	OverallRank        int `json:"overall_rank"`         // Overall rank
	PercentileRank     int `json:"percentile_rank"`      // Percentile rank
	Bank               int `json:"bank"`                 // Money in bank
	Value              int `json:"value"`                // Team value
	EventTransfers     int `json:"event_transfers"`      // Transfers made this week
	EventTransfersCost int `json:"event_transfers_cost"` // Cost of transfers
	PointsOnBench      int `json:"points_on_bench"`      // Points scored by bench players
}

type Fixture

type Fixture struct {
	Code                 int        `json:"code"`
	Event                *int       `json:"event"`
	Finished             bool       `json:"finished"`
	FinishedProvisional  bool       `json:"finished_provisional"`
	ID                   int        `json:"id"`
	KickoffTime          *time.Time `json:"kickoff_time"`
	Minutes              int        `json:"minutes"`
	ProvisionalStartTime bool       `json:"provisional_start_time"`
	Started              bool       `json:"started"`
	TeamA                int        `json:"team_a"`
	TeamAScore           *int       `json:"team_a_score"`
	TeamH                int        `json:"team_h"`
	TeamHScore           *int       `json:"team_h_score"`
	Stats                []Stat     `json:"stats"`
	TeamHDifficulty      int        `json:"team_h_difficulty"`
	TeamADifficulty      int        `json:"team_a_difficulty"`
	PulseID              int        `json:"pulse_id"`
}

Fixture represents a scheduled match between two Premier League teams. It includes kickoff times, scores, and detailed match statistics.

func (*Fixture) GetAssisters

func (f *Fixture) GetAssisters() (map[string][]StatDetail, error)

GetAssisters returns players who provided assists in the fixture.

func (*Fixture) GetBonus

func (f *Fixture) GetBonus() (map[string][]StatDetail, error)

GetBonus returns players who received bonus points.

func (*Fixture) GetGoalscorers

func (f *Fixture) GetGoalscorers() (map[string][]StatDetail, error)

GetGoalscorers returns players who scored goals in the fixture.

func (*Fixture) GetOwnGoalscorers

func (f *Fixture) GetOwnGoalscorers() (map[string][]StatDetail, error)

GetOwnGoalscorers returns players who scored own goals in the fixture.

func (*Fixture) GetPenaltyMisses

func (f *Fixture) GetPenaltyMisses() (map[string][]StatDetail, error)

GetPenaltyMisses returns players who missed penalties.

func (*Fixture) GetPenaltySaves

func (f *Fixture) GetPenaltySaves() (map[string][]StatDetail, error)

GetPenaltySaves returns goalkeepers who saved penalties.

func (*Fixture) GetRedCards

func (f *Fixture) GetRedCards() (map[string][]StatDetail, error)

GetRedCards returns players who received red cards.

func (*Fixture) GetSaves

func (f *Fixture) GetSaves() (map[string][]StatDetail, error)

GetSaves returns goalkeepers and their save counts.

func (*Fixture) GetTeamAScore

func (f *Fixture) GetTeamAScore() int

GetTeamAScore returns the away team's score, or 0 if the match hasn't started or score is unavailable.

func (*Fixture) GetTeamHScore

func (f *Fixture) GetTeamHScore() int

GetTeamHScore returns the home team's score, or 0 if the match hasn't started or score is unavailable.

func (*Fixture) GetYellowCards

func (f *Fixture) GetYellowCards() (map[string][]StatDetail, error)

GetYellowCards returns players who received yellow cards.

type FixtureStats

type FixtureStats struct {
	ID                   int    `json:"id"`
	Code                 int    `json:"code"`
	TeamH                int    `json:"team_h"`
	TeamHScore           *int   `json:"team_h_score"` // Use pointer to handle null
	TeamA                int    `json:"team_a"`
	TeamAScore           *int   `json:"team_a_score"` // Use pointer to handle null
	Event                int    `json:"event"`
	Finished             bool   `json:"finished"`
	Minutes              int    `json:"minutes"`
	ProvisionalStartTime bool   `json:"provisional_start_time"`
	KickoffTime          string `json:"kickoff_time"`
	EventName            string `json:"event_name"`
	IsHome               bool   `json:"is_home"`
	Difficulty           int    `json:"difficulty"`
}

type GameSettings

type GameSettings struct {
	LeagueJoinPrivateMax         int      `json:"league_join_private_max"`
	LeagueJoinPublicMax          int      `json:"league_join_public_max"`
	LeagueMaxSizePublicClassic   int      `json:"league_max_size_public_classic"`
	LeagueMaxSizePublicH2H       int      `json:"league_max_size_public_h2h"`
	LeagueMaxSizePrivateH2H      int      `json:"league_max_size_private_h2h"`
	LeagueMaxKoRoundsPrivateH2H  int      `json:"league_max_ko_rounds_private_h2h"`
	LeaguePrefixPublic           string   `json:"league_prefix_public"`
	LeaguePointsH2HWin           int      `json:"league_points_h2h_win"`
	LeaguePointsH2HLose          int      `json:"league_points_h2h_lose"`
	LeaguePointsH2HDraw          int      `json:"league_points_h2h_draw"`
	LeagueKoFirstInsteadOfRandom bool     `json:"league_ko_first_instead_of_random"`
	CupStartEventID              *int     `json:"cup_start_event_id"`    // Pointer to handle null
	CupStopEventID               *int     `json:"cup_stop_event_id"`     // Pointer to handle null
	CupQualifyingMethod          *string  `json:"cup_qualifying_method"` // Pointer to handle null
	CupType                      *string  `json:"cup_type"`              // Pointer to handle null
	FeaturedEntries              []string `json:"featured_entries"`
	PercentileRanks              []int    `json:"percentile_ranks"`
	SquadSquadplay               int      `json:"squad_squadplay"`
	SquadSquadsize               int      `json:"squad_squadsize"`
	SquadTeamLimit               int      `json:"squad_team_limit"`
	SquadTotalSpend              int      `json:"squad_total_spend"`
	UICurrencyMultiplier         int      `json:"ui_currency_multiplier"`
	UIUseSpecialShirts           bool     `json:"ui_use_special_shirts"`
	UISpecialShirtExclusions     []string `json:"ui_special_shirt_exclusions"`
	StatsFormDays                int      `json:"stats_form_days"`
	SysViceCaptainEnabled        bool     `json:"sys_vice_captain_enabled"`
	TransfersCap                 int      `json:"transfers_cap"`
	TransfersSellOnFee           float64  `json:"transfers_sell_on_fee"`
	MaxExtraFreeTransfers        int      `json:"max_extra_free_transfers"`
	LeagueH2HTiebreakStats       []string `json:"league_h2h_tiebreak_stats"`
	Timezone                     string   `json:"timezone"`
}

type GameWeek

type GameWeek struct {
	ID                     int            `json:"id"`
	Name                   string         `json:"name"`
	DeadlineTime           time.Time      `json:"deadline_time"`
	ReleaseTime            *time.Time     `json:"release_time"` // Pointer to handle null
	AverageEntryScore      int            `json:"average_entry_score"`
	Finished               bool           `json:"finished"`
	DataChecked            bool           `json:"data_checked"`
	HighestScoringEntry    int            `json:"highest_scoring_entry"`
	DeadlineTimeEpoch      int64          `json:"deadline_time_epoch"`
	DeadlineTimeGameOffset int            `json:"deadline_time_game_offset"`
	HighestScore           int            `json:"highest_score"`
	IsPrevious             bool           `json:"is_previous"`
	IsCurrent              bool           `json:"is_current"`
	IsNext                 bool           `json:"is_next"`
	CupLeaguesCreated      bool           `json:"cup_leagues_created"`
	H2hKoMatchesCreated    bool           `json:"h2h_ko_matches_created"`
	RankedCount            int            `json:"ranked_count"`
	ChipPlays              []ChipPlay     `json:"chip_plays"`
	MostSelected           int            `json:"most_selected"`
	MostTransferredIn      int            `json:"most_transferred_in"`
	TopElement             int            `json:"top_element"`
	TopElementInfo         TopElementInfo `json:"top_element_info"`
	TransfersMade          int            `json:"transfers_made"`
	MostCaptained          int            `json:"most_captained"`
	MostViceCaptained      int            `json:"most_vice_captained"`
}

GameWeek represents an FPL gameweek (referred to as an "event" in the API). It includes deadlines, scoring averages, and status flags.

func (*GameWeek) GetChipPlayCount

func (gw *GameWeek) GetChipPlayCount(chipName string) int

GetChipPlayCount returns the number of times a specific chip was played during the gameweek.

func (*GameWeek) GetTopElementInfo

func (gw *GameWeek) GetTopElementInfo() TopElementInfo

GetTopElementInfo returns details about the top-scoring player of the gameweek.

func (*GameWeek) IsFinished

func (gw *GameWeek) IsFinished() bool

IsFinished returns true if the gameweek's matches have all concluded and data is finalized.

type GameWeekStats

type GameWeekStats struct {
	Element                  int    `json:"element"`
	Fixture                  int    `json:"fixture"`
	OpponentTeam             int    `json:"opponent_team"` // Add opponent_team field
	TotalPoints              int    `json:"total_points"`
	WasHome                  bool   `json:"was_home"`     // Add was_home field
	KickoffTime              string `json:"kickoff_time"` // Add kickoff_time field
	TeamHScore               *int   `json:"team_h_score"` // Use pointer to handle null
	TeamAScore               *int   `json:"team_a_score"` // Use pointer to handle null
	Round                    int    `json:"round"`
	Minutes                  int    `json:"minutes"`
	GoalsScored              int    `json:"goals_scored"`
	Assists                  int    `json:"assists"`
	CleanSheets              int    `json:"clean_sheets"`
	GoalsConceded            int    `json:"goals_conceded"`             // Add goals_conceded field
	OwnGoals                 int    `json:"own_goals"`                  // Add own_goals field
	PenaltiesSaved           int    `json:"penalties_saved"`            // Add penalties_saved field
	PenaltiesMissed          int    `json:"penalties_missed"`           // Add penalties_missed field
	YellowCards              int    `json:"yellow_cards"`               // Add yellow_cards field
	RedCards                 int    `json:"red_cards"`                  // Add red_cards field
	Saves                    int    `json:"saves"`                      // Add saves field
	Bonus                    int    `json:"bonus"`                      // Add bonus field
	Bps                      int    `json:"bps"`                        // Add bps field
	Influence                string `json:"influence"`                  // Add influence field
	Creativity               string `json:"creativity"`                 // Add creativity field
	Threat                   string `json:"threat"`                     // Add threat field
	IctIndex                 string `json:"ict_index"`                  // Add ict_index field
	Starts                   int    `json:"starts"`                     // Add starts field
	ExpectedGoals            string `json:"expected_goals"`             // Add expected_goals field
	ExpectedAssists          string `json:"expected_assists"`           // Add expected_assists field
	ExpectedGoalInvolvements string `json:"expected_goal_involvements"` // Add expected_goal_involvements field
	ExpectedGoalsConceded    string `json:"expected_goals_conceded"`    // Add expected_goals_conceded field
}

type League

type League struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Created     time.Time `json:"created"`
	Closed      bool      `json:"closed"`
	MaxEntries  *int      `json:"max_entries"` // Pointer to allow null
	LeagueType  string    `json:"league_type"`
	Scoring     string    `json:"scoring"`
	AdminEntry  *int      `json:"admin_entry"` // Pointer to allow null
	StartEvent  int       `json:"start_event"`
	CodePrivacy string    `json:"code_privacy"`
	HasCup      bool      `json:"has_cup"`
	CupLeague   int       `json:"cup_league"`
	Rank        *int      `json:"rank"` // Pointer to allow null
}

League represents the league details.

func (*League) GetAdminEntry

func (l *League) GetAdminEntry() int

func (*League) GetCreationDate

func (l *League) GetCreationDate() string

func (*League) GetMaxEntries

func (l *League) GetMaxEntries() int

League methods

func (*League) GetRank

func (l *League) GetRank() int

type LeagueManager

type LeagueManager struct {
	ID         int    `json:"id"`
	EventTotal int    `json:"event_total"`
	PlayerName string `json:"player_name"`
	Rank       int    `json:"rank"`
	LastRank   int    `json:"last_rank"`
	RankSort   int    `json:"rank_sort"`
	Total      int    `json:"total"`
	Entry      int    `json:"entry"`
	EntryName  string `json:"entry_name"`
	HasPlayed  bool   `json:"has_played"`
}

Player represents an individual player's standings information.

func (*LeagueManager) GetManagerInfo

func (lm *LeagueManager) GetManagerInfo() string

LeagueManager methods

func (*LeagueManager) GetRankChange

func (lm *LeagueManager) GetRankChange() int

func (*LeagueManager) GetRankChangeString

func (lm *LeagueManager) GetRankChangeString() string

type Manager

type Manager struct {
	ID                         *int      `json:"id"`
	JoinedTime                 time.Time `json:"joined_time"`
	StartedEvent               int       `json:"started_event"`
	FavouriteTeam              int       `json:"favourite_team"`
	PlayerFirstName            string    `json:"player_first_name"`
	PlayerLastName             string    `json:"player_last_name"`
	PlayerRegionID             int       `json:"player_region_id"`
	PlayerRegionName           string    `json:"player_region_name"`
	PlayerRegionISOCodesShort  string    `json:"player_region_iso_code_short"`
	PlayerRegionISOCodesLong   string    `json:"player_region_iso_code_long"`
	YearsActive                int       `json:"years_active"`
	SummaryOverallPoints       int       `json:"summary_overall_points"`
	SummaryOverallRank         int       `json:"summary_overall_rank"`
	SummaryEventPoints         int       `json:"summary_event_points"`
	SummaryEventRank           int       `json:"summary_event_rank"`
	CurrentEvent               *int      `json:"current_event"`
	Name                       string    `json:"name"`
	NameChangeBlocked          bool      `json:"name_change_blocked"`
	EnteredEvents              []int     `json:"entered_events"`
	Kit                        *string   `json:"kit"`
	LastDeadlineBank           int       `json:"last_deadline_bank"`
	LastDeadlineValue          int       `json:"last_deadline_value"`
	LastDeadlineTotalTransfers int       `json:"last_deadline_total_transfers"`
}

Manager represents an FPL entry (manager). It contains profile data, overall and event-specific scoring summary, and basic biographical information.

func (*Manager) GetFullName

func (m *Manager) GetFullName() string

GetFullName returns the real-world name of the FPL manager.

type ManagerHistory

type ManagerHistory struct {
	Current []CurrentEvents `json:"current"` // Current gameweek events
	Past    []PastSeason    `json:"past"`    // Past seasons
	Chips   []Chip          `json:"chips"`   // Chips used
}

ManagerHistory represents the history of a manager's performance.

type ManagerTeam

type ManagerTeam struct {
	ActiveChip    *string        `json:"active_chip"`    // Active chip (e.g., "wildcard", "benchboost")
	AutomaticSubs []AutomaticSub `json:"automatic_subs"` // List of automatic substitutions
	EntryHistory  EntryHistory   `json:"entry_history"`  // Entry history details
	Picks         []Pick         `json:"picks"`          // Picks in the team
}

func (*ManagerTeam) GetBankValueInMillions

func (mt *ManagerTeam) GetBankValueInMillions() float64

func (*ManagerTeam) GetBench

func (mt *ManagerTeam) GetBench() []Pick

func (*ManagerTeam) GetStartingXI

func (mt *ManagerTeam) GetStartingXI() []Pick

func (*ManagerTeam) GetTeamValueInMillions

func (mt *ManagerTeam) GetTeamValueInMillions() float64

type NewEntries

type NewEntries struct {
	HasNext bool          `json:"has_next"`
	Page    int           `json:"page"`
	Results []interface{} `json:"results"` // Assuming results can be of various types
}

type PastHistoryStats

type PastHistoryStats struct {
	SeasonName               string `json:"season_name"`
	ElementCode              int    `json:"element_code"`
	StartCost                int    `json:"start_cost"`
	EndCost                  int    `json:"end_cost"`
	TotalPoints              int    `json:"total_points"`
	Minutes                  int    `json:"minutes"`
	GoalsScored              int    `json:"goals_scored"`
	Assists                  int    `json:"assists"`
	CleanSheets              int    `json:"clean_sheets"`
	GoalsConceded            int    `json:"goals_conceded"`             // Add goals_conceded field
	OwnGoals                 int    `json:"own_goals"`                  // Add own_goals field
	PenaltiesSaved           int    `json:"penalties_saved"`            // Add penalties_saved field
	PenaltiesMissed          int    `json:"penalties_missed"`           // Add penalties_missed field
	YellowCards              int    `json:"yellow_cards"`               // Add yellow_cards field
	RedCards                 int    `json:"red_cards"`                  // Add red_cards field
	Saves                    int    `json:"saves"`                      // Add saves field
	Bonus                    int    `json:"bonus"`                      // Add bonus field
	Bps                      int    `json:"bps"`                        // Add bps field
	Influence                string `json:"influence"`                  // Add influence field
	Creativity               string `json:"creativity"`                 // Add creativity field
	Threat                   string `json:"threat"`                     // Add threat field
	IctIndex                 string `json:"ict_index"`                  // Add ict_index field
	Starts                   int    `json:"starts"`                     // Add starts field
	ExpectedGoals            string `json:"expected_goals"`             // Add expected_goals field
	ExpectedAssists          string `json:"expected_assists"`           // Add expected_assists field
	ExpectedGoalInvolvements string `json:"expected_goal_involvements"` // Add expected_goal_involvements field
	ExpectedGoalsConceded    string `json:"expected_goals_conceded"`    // Add expected_goals_conceded field
}

type PastSeason

type PastSeason struct {
	SeasonName  string `json:"season_name"`  // Name of the season (e.g., "2020/21")
	TotalPoints int    `json:"total_points"` // Total points scored in the season
	Rank        int    `json:"rank"`         // Rank achieved in the season
}

PastSeason represents the details of a past season.

type Pick

type Pick struct {
	Element       int  `json:"element"`         // Player ID
	Position      int  `json:"position"`        // Position in team (1-15)
	Multiplier    int  `json:"multiplier"`      // 2 for captain, 3 for triple captain, 0 for benched
	IsCaptain     bool `json:"is_captain"`      // Is this player captain?
	IsViceCaptain bool `json:"is_vice_captain"` // Is this player vice-captain?
	ElementType   int  `json:"element_type"`    // Type of the player (e.g., defender, midfielder)
}

type Player

type Player struct {
	ID                       int     `json:"id"`
	FirstName                string  `json:"first_name"`
	SecondName               string  `json:"second_name"`
	WebName                  string  `json:"web_name"`
	Team                     int     `json:"team"`
	TeamCode                 int     `json:"team_code"`
	TotalPoints              int     `json:"total_points"`
	NowCost                  float64 `json:"now_cost"`
	SelectedByPercent        string  `json:"selected_by_percent"`
	Form                     string  `json:"form"`
	InDreamteam              bool    `json:"in_dreamteam"`
	Minutes                  int     `json:"minutes"`
	GoalsScored              int     `json:"goals_scored"`
	Assists                  int     `json:"assists"`
	CleanSheets              int     `json:"clean_sheets"`
	YellowCards              int     `json:"yellow_cards"`
	RedCards                 int     `json:"red_cards"`
	Status                   string  `json:"status"`
	ChanceOfPlaying          float64 `json:"chance_of_playing_next_round"`
	Code                     int     `json:"code"`
	CostChangeEvent          int     `json:"cost_change_event"`
	CostChangeEventFall      int     `json:"cost_change_event_fall"`
	CostChangeStart          int     `json:"cost_change_start"`
	CostChangeStartFall      int     `json:"cost_change_start_fall"`
	DreamteamCount           int     `json:"dreamteam_count"`
	ElementType              int     `json:"element_type"`
	EpNext                   string  `json:"ep_next"`
	EpThis                   string  `json:"ep_this"`
	EventPoints              int     `json:"event_points"`
	News                     string  `json:"news"`
	NewsAdded                string  `json:"news_added"`
	PointsPerGame            string  `json:"points_per_game"`
	Special                  bool    `json:"special"`
	SquadNumber              *int    `json:"squad_number"`
	TransfersIn              int     `json:"transfers_in"`
	TransfersInEvent         int     `json:"transfers_in_event"`
	TransfersOut             int     `json:"transfers_out"`
	TransfersOutEvent        int     `json:"transfers_out_event"`
	ValueForm                string  `json:"value_form"`
	ValueSeason              string  `json:"value_season"`
	Influence                string  `json:"influence"`
	Creativity               string  `json:"creativity"`
	Threat                   string  `json:"threat"`
	IctIndex                 string  `json:"ict_index"`
	Starts                   int     `json:"starts"`
	ExpectedGoals            string  `json:"expected_goals"`
	ExpectedAssists          string  `json:"expected_assists"`
	ExpectedGoalInvolvements string  `json:"expected_goal_involvements"`
	ExpectedGoalsConceded    string  `json:"expected_goals_conceded"`
	NowCostRank              int     `json:"now_cost_rank"`
	NowCostRankType          int     `json:"now_cost_rank_type"`
	FormRank                 int     `json:"form_rank"`
	FormRankType             int     `json:"form_rank_type"`
	PointsPerGameRank        int     `json:"points_per_game_rank"`
	PointsPerGameRankType    int     `json:"points_per_game_rank_type"`
	SelectedRank             int     `json:"selected_rank"`
	SelectedRankType         int     `json:"selected_rank_type"`
}

Player represents an FPL player (referred to as an "element" in the API). It contains summary data, current season performance, and ownership statistics.

func (*Player) GetDisplayName

func (p *Player) GetDisplayName() string

GetDisplayName returns the full name of the player.

func (*Player) GetPriceInPounds

func (p *Player) GetPriceInPounds() float64

GetPriceInPounds returns the current cost of the player in millions of pounds (e.g., 8.5).

type PlayerHistory

type PlayerHistory struct {
	Fixtures    []FixtureStats     `json:"fixtures"`     // Add fixtures field
	History     []GameWeekStats    `json:"history"`      // Keep history field
	HistoryPast []PastHistoryStats `json:"history_past"` // Add history_past field
}

type Standings

type Standings struct {
	HasNext bool            `json:"has_next"`
	Page    int             `json:"page"`
	Results []LeagueManager `json:"results"`
}

Standings represents the standings section of the Classic League.

func (*Standings) GetPageInfo

func (s *Standings) GetPageInfo() string

Standings methods

func (*Standings) HasPreviousPage

func (s *Standings) HasPreviousPage() bool

type Stat

type Stat struct {
	Identifier string       `json:"identifier"`
	A          []StatDetail `json:"a"` // Away team contributors
	H          []StatDetail `json:"h"` // Home team contributors
}

Stat represents a specific type of match statistic (e.g., goals) and the players from each team who contributed to it.

type StatDetail

type StatDetail struct {
	Value   int `json:"value"`
	Element int `json:"element"`
}

StatDetail contains the specific value and player ID for a match statistic.

type Team

type Team struct {
	Code                int     `json:"code"`
	Draw                int     `json:"draw"`
	Form                *string `json:"form"` // Using pointer to handle null values
	ID                  int     `json:"id"`
	Loss                int     `json:"loss"`
	Name                string  `json:"name"`
	Played              int     `json:"played"`
	Points              int     `json:"points"`
	Position            int     `json:"position"`
	ShortName           string  `json:"short_name"`
	Strength            int     `json:"strength"`
	TeamDivision        *string `json:"team_division"` // Using pointer to handle null values
	Unavailable         bool    `json:"unavailable"`
	Win                 int     `json:"win"`
	StrengthOverallHome int     `json:"strength_overall_home"`
	StrengthOverallAway int     `json:"strength_overall_away"`
	StrengthAttackHome  int     `json:"strength_attack_home"`
	StrengthAttackAway  int     `json:"strength_attack_away"`
	StrengthDefenceHome int     `json:"strength_defence_home"`
	StrengthDefenceAway int     `json:"strength_defence_away"`
	PulseID             int     `json:"pulse_id"`
}

Team represents a Premier League team in the FPL system. It includes metadata, performance statistics, and strength ratings.

func (*Team) GetDrawRate

func (t *Team) GetDrawRate() float64

GetDrawRate calculates the percentage of games drawn by the team.

func (*Team) GetFullName

func (t *Team) GetFullName() string

GetFullName returns the full name of the team (e.g., "Arsenal").

func (*Team) GetLossRate

func (t *Team) GetLossRate() float64

GetLossRate calculates the percentage of games lost by the team.

func (*Team) GetShortName

func (t *Team) GetShortName() string

GetShortName returns the 3-letter abbreviation of the team (e.g., "ARS").

func (*Team) GetWinRate

func (t *Team) GetWinRate() float64

GetWinRate calculates the percentage of games won by the team.

func (*Team) IsTopTeam

func (t *Team) IsTopTeam(topN int) bool

IsTopTeam checks if the team is currently ranked within the top N positions.

type TopElementInfo

type TopElementInfo struct {
	ID     int `json:"id"`
	Points int `json:"points"`
}

TopElementInfo identifies the highest-scoring player for a specific gameweek.

Jump to

Keyboard shortcuts

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