Documentation
¶
Overview ¶
Package espn is a Go SDK for ESPN's undocumented public APIs.
It wraps the six ESPN domains catalogued in the Public-ESPN-API project:
- site.api.espn.com — site v2/v3 (scoreboard, teams, news, summary)
- sports.core.api.espn.com — core v2/v3 (athletes, events, plays, odds)
- site.web.api.espn.com — common/v3 (athlete overview/stats/gamelog/splits)
- cdn.espn.com — CDN game packages (drives, plays, win prob)
- now.core.api.espn.com — real-time news feed
- fantasy.espn.com — fantasy leagues (public + private)
Quick start ¶
c := espn.New()
sb, err := c.Scoreboard(ctx, espn.SportFootball, espn.LeagueNFL, nil)
for _, ev := range sb.Events {
fmt.Println(ev.Name, ev.Status.Type.ShortDetail)
}
File layout ¶
Source files are prefix-grouped by ESPN domain so each file maps to one concern:
- client.go / options.go / errors.go — transport
- constants.go / types.go / ref.go — shared data
- site_*.go — site.api.espn.com endpoints
- core_*.go — sports.core.api.espn.com endpoints
- web_athlete.go — site.web.api.espn.com athlete data
- cdn.go / now.go / fantasy.go — single-purpose domains
- search.go / specialized.go — search, QBR, PowerIndex, recruiting
Each endpoint method has both a typed form (e.g. Client.Scoreboard) and, for shape-volatile responses, a raw form (e.g. Client.ScoreboardRaw) returning encoding/json.RawMessage. When no typed form exists (long tail of core-API endpoints), only the raw form is provided.
Errors ¶
404 and 429 are exposed as sentinel errors ErrNotFound and ErrRateLimited; everything else is wrapped in *APIError. 5xx and transport failures are retried automatically with exponential backoff; 4xx are terminal.
Concurrency ¶
Client is safe for concurrent use.
Disclaimer ¶
ESPN's APIs are undocumented and may change without notice. This SDK is not affiliated with ESPN. Use responsibly.
Index ¶
- Constants
- Variables
- func Paginate(ctx context.Context, fetch func(page int) (*PagedRefs, error)) iter.Seq2[Ref, error]
- type APIError
- type Address
- type Article
- type ArticleLinks
- type Athlete
- type AthleteOptions
- type AthleteOverview
- type AthleteStatsOptions
- type AthleteStatus
- type Broadcast
- type CDNView
- type Category
- type Client
- func (c *Client) AthleteBio(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) AthleteGamelog(ctx context.Context, sport, league, athleteID string, season int) (json.RawMessage, error)
- func (c *Client) AthleteGamelogSite(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) AthleteNewsSite(ctx context.Context, sport, league, athleteID string, limit int) (*NewsFeed, error)
- func (c *Client) AthleteOverview(ctx context.Context, sport, league, athleteID string) (*AthleteOverview, error)
- func (c *Client) AthleteOverviewRaw(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) AthletePlaysV3(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) AthleteSite(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) AthleteSplits(ctx context.Context, sport, league, athleteID string, ...) (json.RawMessage, error)
- func (c *Client) AthleteSplitsSite(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) AthleteStatisticsLogV3(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) AthleteStats(ctx context.Context, sport, league, athleteID string, ...) (json.RawMessage, error)
- func (c *Client) AthleteV3(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) AthletesV3(ctx context.Context, sport, league string, opts *AthleteOptions) (json.RawMessage, error)
- func (c *Client) Bracketology(ctx context.Context, tournamentID string, season int, iteration int) (json.RawMessage, error)
- func (c *Client) CDNGame(ctx context.Context, sport, gameID string, view CDNView) (json.RawMessage, error)
- func (c *Client) CDNScoreboard(ctx context.Context, sport, soccerLeague string) (json.RawMessage, error)
- func (c *Client) Calendar(ctx context.Context, sport, league, variant string) (json.RawMessage, error)
- func (c *Client) Circuits(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) Coach(ctx context.Context, sport, league, coachID string) (json.RawMessage, error)
- func (c *Client) CoachRecord(ctx context.Context, sport, league, coachID, recordType string) (json.RawMessage, error)
- func (c *Client) Coaches(ctx context.Context, sport, league string, season int, limit int) (*PagedRefs, error)
- func (c *Client) Competition(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
- func (c *Client) CompetitorLinescores(ctx context.Context, ...) (json.RawMessage, error)
- func (c *Client) CompetitorRoster(ctx context.Context, ...) (json.RawMessage, error)
- func (c *Client) CompetitorStatistics(ctx context.Context, ...) (json.RawMessage, error)
- func (c *Client) CoreAthlete(ctx context.Context, sport, league, athleteID string) (*Athlete, error)
- func (c *Client) CoreAthleteAwards(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) CoreAthleteContracts(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) CoreAthleteEventLog(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) CoreAthleteHotZones(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) CoreAthleteInjuries(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) CoreAthleteRaw(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) CoreAthleteRecords(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) CoreAthleteSeasons(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) CoreAthleteStatistics(ctx context.Context, sport, league, athleteID string, seasonType SeasonType) (json.RawMessage, error)
- func (c *Client) CoreAthleteStatisticsLog(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
- func (c *Client) CoreAthleteVsAthlete(ctx context.Context, sport, league, athleteID, opponentID string) (json.RawMessage, error)
- func (c *Client) CoreAthletes(ctx context.Context, sport, league string, opts *AthleteOptions) (*PagedRefs, error)
- func (c *Client) CoreBroadcasts(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
- func (c *Client) CoreCalendar(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) CoreEvent(ctx context.Context, sport, league, eventID string) (json.RawMessage, error)
- func (c *Client) CoreEvents(ctx context.Context, sport, league string, opts *EventsOptions) (*PagedRefs, error)
- func (c *Client) CoreLeaders(ctx context.Context, sport, league string, season int, seasonType SeasonType) (json.RawMessage, error)
- func (c *Client) CoreMedia(ctx context.Context, sport, league string, limit int) (json.RawMessage, error)
- func (c *Client) CoreRankings(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) CoreStandings(ctx context.Context, sport, league string, season int, seasonType SeasonType) (json.RawMessage, error)
- func (c *Client) CoreTeams(ctx context.Context, sport, league string, page, limit int) (*PagedRefs, error)
- func (c *Client) Countries(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) CurrentSeason(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) Draft(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) FantasyLeague(ctx context.Context, game FantasyGame, season int, leagueID string, ...) (json.RawMessage, error)
- func (c *Client) FantasyPlayerInfo(ctx context.Context, game FantasyGame, season int, leagueID string) (json.RawMessage, error)
- func (c *Client) Franchises(ctx context.Context, sport, league string, limit int) (*PagedRefs, error)
- func (c *Client) FreeAgents(ctx context.Context, sport, league string, season int, limit int) (json.RawMessage, error)
- func (c *Client) Futures(ctx context.Context, sport, league string, season int) (json.RawMessage, error)
- func (c *Client) Get(ctx context.Context, d Domain, path string, params Params, out any) error
- func (c *Client) GetRaw(ctx context.Context, d Domain, path string, params Params) ([]byte, error)
- func (c *Client) Groups(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) IterAthletes(ctx context.Context, sport, league string, opts *AthleteOptions) iter.Seq2[Ref, error]
- func (c *Client) IterCoaches(ctx context.Context, sport, league string, season, limit int) iter.Seq2[Ref, error]
- func (c *Client) IterCoreTeams(ctx context.Context, sport, league string, limit int) iter.Seq2[Ref, error]
- func (c *Client) IterEvents(ctx context.Context, sport, league string, opts *EventsOptions) iter.Seq2[Ref, error]
- func (c *Client) IterFranchises(ctx context.Context, sport, league string, limit int) iter.Seq2[Ref, error]
- func (c *Client) IterSeasonTeams(ctx context.Context, sport, league string, season, limit int) iter.Seq2[Ref, error]
- func (c *Client) IterSeasons(ctx context.Context, sport, league string, limit int) iter.Seq2[Ref, error]
- func (c *Client) IterVenues(ctx context.Context, sport, league string, limit int) iter.Seq2[Ref, error]
- func (c *Client) LeadersV3(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) LeagueInfo(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) LeagueInjuries(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) LeagueStatistics(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) LeagueTransactions(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) Manufacturers(ctx context.Context, sport, league string, season int) (json.RawMessage, error)
- func (c *Client) News(ctx context.Context, sport, league string, limit int) (*NewsFeed, error)
- func (c *Client) NowNews(ctx context.Context, opts *NowOptions) (*NowFeed, error)
- func (c *Client) Odds(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
- func (c *Client) Officials(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
- func (c *Client) Plays(ctx context.Context, sport, league, eventID, competitionID string, limit int) (json.RawMessage, error)
- func (c *Client) Positions(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) PowerIndex(ctx context.Context, sport, league string, season int, teamID string) (json.RawMessage, error)
- func (c *Client) PowerIndexGame(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
- func (c *Client) PowerIndexLeaders(ctx context.Context, sport, league string, season int) (json.RawMessage, error)
- func (c *Client) Predictor(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
- func (c *Client) Probabilities(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
- func (c *Client) Providers(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) QBR(ctx context.Context, league string, season int, opts *QBROptions) (json.RawMessage, error)
- func (c *Client) Rankings(ctx context.Context, sport, league string) (json.RawMessage, error)
- func (c *Client) RecruitingClass(ctx context.Context, league string, season int, teamID string) (json.RawMessage, error)
- func (c *Client) Recruits(ctx context.Context, league string, season int, limit int) (json.RawMessage, error)
- func (c *Client) Resolve(ctx context.Context, refURL string, out any) error
- func (c *Client) ResolveRaw(ctx context.Context, refURL string) ([]byte, error)
- func (c *Client) Scoreboard(ctx context.Context, sport, league string, opts *ScoreboardOptions) (*Scoreboard, error)
- func (c *Client) ScoreboardHeader(ctx context.Context) (json.RawMessage, error)
- func (c *Client) ScoreboardRaw(ctx context.Context, sport, league string, opts *ScoreboardOptions) (json.RawMessage, error)
- func (c *Client) ScoreboardV3(ctx context.Context, sport, league string, opts *ScoreboardOptions) (json.RawMessage, error)
- func (c *Client) Search(ctx context.Context, query string, opts *SearchOptions) (json.RawMessage, error)
- func (c *Client) SeasonATSRecord(ctx context.Context, sport, league string, season int, seasonType SeasonType, ...) (json.RawMessage, error)
- func (c *Client) SeasonDraft(ctx context.Context, sport, league string, season int) (json.RawMessage, error)
- func (c *Client) SeasonOddsRecord(ctx context.Context, sport, league string, season int, seasonType SeasonType, ...) (json.RawMessage, error)
- func (c *Client) SeasonTeams(ctx context.Context, sport, league string, season int, limit int) (*PagedRefs, error)
- func (c *Client) Seasons(ctx context.Context, sport, league string, limit int) (*PagedRefs, error)
- func (c *Client) Situation(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
- func (c *Client) Standings(ctx context.Context, sport, league string, season int) (*Standings, error)
- func (c *Client) StatisticsByAthlete(ctx context.Context, sport, league string, opts *StatisticsByAthleteOptions) (json.RawMessage, error)
- func (c *Client) Summary(ctx context.Context, sport, league, eventID string) (*Summary, error)
- func (c *Client) SummaryRaw(ctx context.Context, sport, league, eventID string) (json.RawMessage, error)
- func (c *Client) SummaryV3Raw(ctx context.Context, sport, league, eventID string) (json.RawMessage, error)
- func (c *Client) Team(ctx context.Context, sport, league, teamID string) (*Team, error)
- func (c *Client) TeamDepthChart(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
- func (c *Client) TeamHistory(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
- func (c *Client) TeamInjuries(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
- func (c *Client) TeamLeaders(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
- func (c *Client) TeamNews(ctx context.Context, sport, league, teamID string, limit int) (*NewsFeed, error)
- func (c *Client) TeamRecord(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
- func (c *Client) TeamRoster(ctx context.Context, sport, league, teamID string) (*TeamRoster, error)
- func (c *Client) TeamSchedule(ctx context.Context, sport, league, teamID string, season int, ...) (json.RawMessage, error)
- func (c *Client) TeamTransactions(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
- func (c *Client) Teams(ctx context.Context, sport, league string, limit int) (*TeamsResponse, error)
- func (c *Client) Tournaments(ctx context.Context, sport, league string, majorsOnly bool) (json.RawMessage, error)
- func (c *Client) Venues(ctx context.Context, sport, league string, limit int) (*PagedRefs, error)
- type College
- type Competition
- type Competitor
- type Domain
- type Draft
- type Event
- type EventsOptions
- type Experience
- type FantasyGame
- type FantasyLeagueOptions
- type FantasySegment
- type FantasyView
- type GeoBroadcast
- type Image
- type Leader
- type LeaderEntry
- type Linescore
- type Link
- type Logo
- type NewsFeed
- type Note
- type NowFeed
- type NowItem
- type NowOptions
- type OddsSummary
- type Option
- func WithBackoff(d time.Duration) Option
- func WithCDNURL(u string) Option
- func WithCoreURL(u string) Option
- func WithFantasyAuth(espnS2, swid string) Option
- func WithFantasyURL(u string) Option
- func WithHTTPClient(h *http.Client) Option
- func WithMaxRetries(n int) Option
- func WithNowURL(u string) Option
- func WithSiteURL(u string) Option
- func WithTimeout(d time.Duration) Option
- func WithUserAgent(ua string) Option
- func WithWebURL(u string) Option
- type PagedRefs
- type Params
- type Position
- type QBROptions
- type QBRSplit
- type Record
- type Ref
- type Scoreboard
- type ScoreboardLeague
- type ScoreboardOptions
- type SearchOptions
- type Season
- type SeasonType
- type SeasonTypeRef
- type Standings
- type StandingsEntry
- type StandingsGroup
- type StandingsGroupEntries
- type Statistic
- type StatisticsByAthleteOptions
- type Status
- type StatusType
- type Summary
- type Team
- type TeamDetail
- type TeamOdds
- type TeamRoster
- type TeamsResponse
- type Venue
- type Week
Constants ¶
const ( DefaultSiteURL = "https://site.api.espn.com" DefaultCoreURL = "https://sports.core.api.espn.com" DefaultWebURL = "https://site.web.api.espn.com" DefaultCDNURL = "https://cdn.espn.com" DefaultNowURL = "https://now.core.api.espn.com" DefaultFantasyURL = "https://fantasy.espn.com" )
Default base URLs.
const ( SportAustralianFootball = "australian-football" SportBaseball = "baseball" SportBasketball = "basketball" SportCricket = "cricket" SportFieldHockey = "field-hockey" SportFootball = "football" SportGolf = "golf" SportHockey = "hockey" SportLacrosse = "lacrosse" SportMMA = "mma" SportRacing = "racing" SportRugby = "rugby" SportRugbyLeague = "rugby-league" SportSoccer = "soccer" SportTennis = "tennis" SportVolleyball = "volleyball" SportWaterPolo = "water-polo" )
Sport slugs used throughout the ESPN API.
const ( // Football LeagueNFL = "nfl" LeagueCollegeFootball = "college-football" LeagueCFL = "cfl" LeagueUFL = "ufl" LeagueXFL = "xfl" // Basketball LeagueNBA = "nba" LeagueWNBA = "wnba" LeagueGLeague = "nba-development" LeagueMensCollegeBball = "mens-college-basketball" LeagueWomensCollegeBall = "womens-college-basketball" LeagueNBL = "nbl" LeagueFIBA = "fiba" // Baseball LeagueMLB = "mlb" LeagueCollegeBaseball = "college-baseball" LeagueWorldBaseballClass = "world-baseball-classic" // Hockey LeagueNHL = "nhl" LeagueMensCollegeHockey = "mens-college-hockey" // Soccer LeagueEPL = "eng.1" LeagueLaLiga = "esp.1" LeagueBundesliga = "ger.1" LeagueSerieA = "ita.1" LeagueLigue1 = "fra.1" LeagueMLS = "usa.1" LeagueLigaMX = "mex.1" LeagueChampionsLg = "uefa.champions" LeagueEuropaLg = "uefa.europa" LeagueWorldCup = "fifa.world" LeagueWomensWorldC = "fifa.wwc" LeagueNWSL = "usa.nwsl" // Golf LeaguePGA = "pga" LeagueLPGA = "lpga" LeagueDPWorld = "eur" LeagueLIV = "liv" LeagueChampGlf = "champions-tour" // Racing LeagueF1 = "f1" LeagueIndyCar = "irl" LeagueNASCARCup = "nascar-premier" LeagueNASCARXfinity = "nascar-secondary" LeagueNASCARTruck = "nascar-truck" // Tennis LeagueATP = "atp" LeagueWTA = "wta" )
Common league slugs. Many more exist — see docs/sports/*.md in the Public-ESPN-API project for the full list.
const ( ProviderCaesars = 38 ProviderFanDuel = 37 ProviderDraftKings = 41 ProviderBetMGM = 58 ProviderESPNBet = 68 ProviderBet365 = 2000 )
Common odds provider IDs (use the int form in the priority param).
const ( GroupSEC = 8 GroupBigTen = 5 GroupACC = 1 GroupBig12 = 4 GroupMountainWest = 17 GroupTop25 = 80 GroupFBS = 80 )
CFB conference IDs for the groups param.
Variables ¶
var ( // ErrNotFound is returned for HTTP 404 responses. ErrNotFound = errors.New("espn: resource not found") // ErrRateLimited is returned for HTTP 429 responses. ErrRateLimited = errors.New("espn: rate limited") )
Sentinel errors returned by the client. Use errors.Is to test for them.
Functions ¶
func Paginate ¶ added in v0.1.1
Paginate walks every page produced by fetch (1-indexed) and yields each Ref with any error encountered. It stops when the page reports no more data, when ctx is cancelled, when fetch returns an error, or when the caller breaks out of the range loop.
On error it yields one final (zero Ref, err) pair and returns. The fetch closure is invoked synchronously, so use the iterator from a single goroutine.
Typical use:
for ref, err := range espn.Paginate(ctx, func(page int) (*espn.PagedRefs, error) {
return c.CoreEvents(ctx, sport, league, &espn.EventsOptions{Page: page, Limit: 100})
}) {
if err != nil { return err }
// ... use ref ...
}
Most callers should reach for the IterXxx helpers below instead.
Types ¶
type APIError ¶
type APIError struct {
URL string
Status int // 0 for transport errors
Body string // truncated response body when available
Err error // underlying error for transport failures
}
APIError is returned for non-404/429 HTTP errors and transport failures. Use errors.As to inspect.
type Address ¶
type Address struct {
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
ZipCode string `json:"zipCode,omitempty"`
Country string `json:"country,omitempty"`
}
Address used inside Venue.
type Article ¶
type Article struct {
DataSourceID string `json:"dataSourceIdentifier,omitempty"`
Description string `json:"description,omitempty"`
Type string `json:"type,omitempty"`
Premium bool `json:"premium,omitempty"`
Links ArticleLinks `json:"links,omitempty"`
Categories []Category `json:"categories,omitempty"`
Headline string `json:"headline,omitempty"`
Byline string `json:"byline,omitempty"`
Images []Image `json:"images,omitempty"`
Published string `json:"published,omitempty"`
LastModified string `json:"lastModified,omitempty"`
Story string `json:"story,omitempty"`
}
Article is a single news entry.
type ArticleLinks ¶
type ArticleLinks struct {
API *Link `json:"api,omitempty"`
Web *Link `json:"web,omitempty"`
Mobile *Link `json:"mobile,omitempty"`
App *Link `json:"app,omitempty"`
}
ArticleLinks captures the web/api links on an article.
type Athlete ¶
type Athlete struct {
ID string `json:"id,omitempty"`
UID string `json:"uid,omitempty"`
GUID string `json:"guid,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
FullName string `json:"fullName,omitempty"`
DisplayName string `json:"displayName,omitempty"`
ShortName string `json:"shortName,omitempty"`
Slug string `json:"slug,omitempty"`
Jersey string `json:"jersey,omitempty"`
Weight float64 `json:"weight,omitempty"`
DisplayWeight string `json:"displayWeight,omitempty"`
Height float64 `json:"height,omitempty"`
DisplayHeight string `json:"displayHeight,omitempty"`
Age int `json:"age,omitempty"`
DateOfBirth string `json:"dateOfBirth,omitempty"`
BirthPlace *Address `json:"birthPlace,omitempty"`
Citizenship string `json:"citizenship,omitempty"`
Active bool `json:"active,omitempty"`
Position *Position `json:"position,omitempty"`
Headshot *Logo `json:"headshot,omitempty"`
Experience *Experience `json:"experience,omitempty"`
Status *AthleteStatus `json:"status,omitempty"`
Team json.RawMessage `json:"team,omitempty"`
College *College `json:"college,omitempty"`
Draft *Draft `json:"draft,omitempty"`
Links []Link `json:"links,omitempty"`
}
Athlete is a player summary. Different endpoints flesh out different fields.
type AthleteOptions ¶
type AthleteOptions struct {
Limit int
Page int
TeamID string
Active *bool
Position string
Group string
Status string
Sort string
}
AthleteOptions filters the core API athletes list.
type AthleteOverview ¶
type AthleteOverview struct {
Athlete *json.RawMessage `json:"athlete,omitempty"`
Statistics *json.RawMessage `json:"statistics,omitempty"`
NextGame *json.RawMessage `json:"nextGame,omitempty"`
News *json.RawMessage `json:"news,omitempty"`
Notes *json.RawMessage `json:"notes,omitempty"`
Fantasy *json.RawMessage `json:"fantasy,omitempty"`
Gamelog *json.RawMessage `json:"gameLog,omitempty"`
League *json.RawMessage `json:"league,omitempty"`
Standing *json.RawMessage `json:"standing,omitempty"`
Rotowire *json.RawMessage `json:"rotowire,omitempty"`
}
AthleteOverview is the response from common/v3 .../overview.
Confirmed for NFL/NBA/NHL/MLB. Soccer returns minimal data.
type AthleteStatsOptions ¶
type AthleteStatsOptions struct {
Season int
SeasonType SeasonType
}
AthleteStatsOptions filters /athletes/{id}/stats and friends.
type AthleteStatus ¶
type AthleteStatus struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Abbreviation string `json:"abbreviation,omitempty"`
}
AthleteStatus is the lifecycle marker on an athlete (Active, Injured, etc.). This differs from Status which is used for live game state.
type Broadcast ¶
type Broadcast struct {
Market json.RawMessage `json:"market,omitempty"`
Media json.RawMessage `json:"media,omitempty"`
Type json.RawMessage `json:"type,omitempty"`
Lang string `json:"lang,omitempty"`
Region string `json:"region,omitempty"`
Names []string `json:"names,omitempty"`
}
Broadcast describes a broadcast network entry. Some endpoints return `market` as a string ("national"), others as a {id,type} object.
type Category ¶
type Category struct {
ID json.Number `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
SportID json.Number `json:"sportId,omitempty"`
LeagueID json.Number `json:"leagueId,omitempty"`
TeamID json.Number `json:"teamId,omitempty"`
AthleteID json.Number `json:"athleteId,omitempty"`
League *struct {
ID json.Number `json:"id,omitempty"`
Description string `json:"description,omitempty"`
Abbreviation string `json:"abbreviation,omitempty"`
} `json:"league,omitempty"`
Team *struct {
ID json.Number `json:"id,omitempty"`
Description string `json:"description,omitempty"`
} `json:"team,omitempty"`
Athlete *struct {
ID json.Number `json:"id,omitempty"`
Description string `json:"description,omitempty"`
} `json:"athlete,omitempty"`
UID string `json:"uid,omitempty"`
}
Category tags an article (league/team/athlete/topic).
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the ESPN API client. Create one with New. Safe for concurrent use.
func (*Client) AthleteBio ¶
func (c *Client) AthleteBio(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
AthleteBio returns site-API athlete bio.
func (*Client) AthleteGamelog ¶
func (c *Client) AthleteGamelog(ctx context.Context, sport, league, athleteID string, season int) (json.RawMessage, error)
AthleteGamelog fetches the per-game log. Confirmed for NFL/NBA/MLB. 404 for NHL, 400 for Soccer.
func (*Client) AthleteGamelogSite ¶
func (c *Client) AthleteGamelogSite(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
AthleteGamelogSite returns the site-API per-game log for an athlete.
func (*Client) AthleteNewsSite ¶
func (c *Client) AthleteNewsSite(ctx context.Context, sport, league, athleteID string, limit int) (*NewsFeed, error)
AthleteNewsSite returns athlete-specific news from the site API.
func (*Client) AthleteOverview ¶
func (c *Client) AthleteOverview(ctx context.Context, sport, league, athleteID string) (*AthleteOverview, error)
AthleteOverview fetches the athlete overview snapshot.
func (*Client) AthleteOverviewRaw ¶
func (c *Client) AthleteOverviewRaw(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
AthleteOverviewRaw fetches the athlete overview as raw JSON.
func (*Client) AthletePlaysV3 ¶
func (c *Client) AthletePlaysV3(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
AthletePlaysV3 fetches a v3 athlete play history.
func (*Client) AthleteSite ¶
func (c *Client) AthleteSite(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
AthleteSite returns the site-API athlete profile.
func (*Client) AthleteSplits ¶
func (c *Client) AthleteSplits(ctx context.Context, sport, league, athleteID string, opts *AthleteStatsOptions) (json.RawMessage, error)
AthleteSplits fetches home/away/opponent splits.
func (*Client) AthleteSplitsSite ¶
func (c *Client) AthleteSplitsSite(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
AthleteSplitsSite returns site-API splits for an athlete.
func (*Client) AthleteStatisticsLogV3 ¶
func (c *Client) AthleteStatisticsLogV3(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
AthleteStatisticsLogV3 fetches a v3 enriched gamelog.
func (*Client) AthleteStats ¶
func (c *Client) AthleteStats(ctx context.Context, sport, league, athleteID string, opts *AthleteStatsOptions) (json.RawMessage, error)
AthleteStats fetches season stats. Confirmed for NFL/NBA/NHL/MLB. 404 for Soccer.
func (*Client) AthleteV3 ¶
func (c *Client) AthleteV3(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
AthleteV3 fetches a single athlete from the v3 schema.
func (*Client) AthletesV3 ¶
func (c *Client) AthletesV3(ctx context.Context, sport, league string, opts *AthleteOptions) (json.RawMessage, error)
AthletesV3 fetches athletes from the v3 schema.
func (*Client) Bracketology ¶
func (c *Client) Bracketology(ctx context.Context, tournamentID string, season int, iteration int) (json.RawMessage, error)
Bracketology returns NCAA tournament bracket projections.
tournamentID is e.g. "22" for Men's NCAAM. iteration > 0 returns a specific snapshot.
func (*Client) CDNGame ¶
func (c *Client) CDNGame(ctx context.Context, sport, gameID string, view CDNView) (json.RawMessage, error)
CDNGame fetches a CDN game package. The "game" view returns drives, plays, scoring, win probability, boxscore, and odds inside `gamepackageJSON`.
`sport` here is the CDN sport slug (e.g. "nfl", "nba", "mlb", "college-football"), not the generic sport slug used elsewhere.
func (*Client) CDNScoreboard ¶
func (c *Client) CDNScoreboard(ctx context.Context, sport, soccerLeague string) (json.RawMessage, error)
CDNScoreboard fetches the CDN-optimised scoreboard. For soccer the league slug is required (e.g. "eng.1").
func (*Client) Calendar ¶
func (c *Client) Calendar(ctx context.Context, sport, league, variant string) (json.RawMessage, error)
Calendar returns the season calendar (weeks/dates).
Variant is one of "" (default), "ondays", "offdays", "blacklist", "regular-season", "postseason", "offseason". Empty string returns the full calendar.
func (*Client) CoachRecord ¶
func (c *Client) CoachRecord(ctx context.Context, sport, league, coachID, recordType string) (json.RawMessage, error)
CoachRecord returns a coach's career record by type.
func (*Client) Coaches ¶
func (c *Client) Coaches(ctx context.Context, sport, league string, season int, limit int) (*PagedRefs, error)
Coaches returns the league coaching staff. Pass season=0 for current.
func (*Client) Competition ¶
func (c *Client) Competition(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
Competition fetches a single competition under an event.
func (*Client) CompetitorLinescores ¶
func (c *Client) CompetitorLinescores(ctx context.Context, sport, league, eventID, competitionID, competitorID string) (json.RawMessage, error)
CompetitorLinescores returns period-by-period scores.
func (*Client) CompetitorRoster ¶
func (c *Client) CompetitorRoster(ctx context.Context, sport, league, eventID, competitionID, competitorID string) (json.RawMessage, error)
CompetitorRoster returns the competitor's roster snapshot for the event.
func (*Client) CompetitorStatistics ¶
func (c *Client) CompetitorStatistics(ctx context.Context, sport, league, eventID, competitionID, competitorID string) (json.RawMessage, error)
CompetitorStatistics returns competitor team-level stats.
func (*Client) CoreAthlete ¶
func (c *Client) CoreAthlete(ctx context.Context, sport, league, athleteID string) (*Athlete, error)
CoreAthlete fetches a single athlete from the core API.
func (*Client) CoreAthleteAwards ¶
func (c *Client) CoreAthleteAwards(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
CoreAthleteAwards returns the athlete's awards.
func (*Client) CoreAthleteContracts ¶
func (c *Client) CoreAthleteContracts(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
CoreAthleteContracts returns the athlete's contracts.
func (*Client) CoreAthleteEventLog ¶
func (c *Client) CoreAthleteEventLog(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
CoreAthleteEventLog returns the athlete's event history.
func (*Client) CoreAthleteHotZones ¶
func (c *Client) CoreAthleteHotZones(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
CoreAthleteHotZones returns hot zones (baseball).
func (*Client) CoreAthleteInjuries ¶
func (c *Client) CoreAthleteInjuries(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
CoreAthleteInjuries returns the athlete's injury history.
func (*Client) CoreAthleteRaw ¶
func (c *Client) CoreAthleteRaw(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
CoreAthleteRaw fetches a single athlete as raw JSON.
func (*Client) CoreAthleteRecords ¶
func (c *Client) CoreAthleteRecords(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
CoreAthleteRecords returns the athlete's career records.
func (*Client) CoreAthleteSeasons ¶
func (c *Client) CoreAthleteSeasons(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
CoreAthleteSeasons returns the seasons the athlete played in.
func (*Client) CoreAthleteStatistics ¶
func (c *Client) CoreAthleteStatistics(ctx context.Context, sport, league, athleteID string, seasonType SeasonType) (json.RawMessage, error)
CoreAthleteStatistics returns a single athlete's career statistics.
func (*Client) CoreAthleteStatisticsLog ¶
func (c *Client) CoreAthleteStatisticsLog(ctx context.Context, sport, league, athleteID string) (json.RawMessage, error)
CoreAthleteStatisticsLog returns a per-game log.
func (*Client) CoreAthleteVsAthlete ¶
func (c *Client) CoreAthleteVsAthlete(ctx context.Context, sport, league, athleteID, opponentID string) (json.RawMessage, error)
CoreAthleteVsAthlete returns head-to-head stats.
func (*Client) CoreAthletes ¶
func (c *Client) CoreAthletes(ctx context.Context, sport, league string, opts *AthleteOptions) (*PagedRefs, error)
CoreAthletes lists athletes from the core API. Returns a PagedRefs — each entry's Ref points to the full athlete document. Use Client.CoreAthlete to fetch a single athlete directly.
func (*Client) CoreBroadcasts ¶
func (c *Client) CoreBroadcasts(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
CoreBroadcasts returns broadcast networks for a competition.
func (*Client) CoreCalendar ¶
CoreCalendar returns the season calendar via the core API.
func (*Client) CoreEvent ¶
func (c *Client) CoreEvent(ctx context.Context, sport, league, eventID string) (json.RawMessage, error)
CoreEvent fetches a single core-API event document.
func (*Client) CoreEvents ¶
func (c *Client) CoreEvents(ctx context.Context, sport, league string, opts *EventsOptions) (*PagedRefs, error)
CoreEvents lists events via the core API. Returns a PagedRefs.
func (*Client) CoreLeaders ¶
func (c *Client) CoreLeaders(ctx context.Context, sport, league string, season int, seasonType SeasonType) (json.RawMessage, error)
CoreLeaders returns the v2 statistical leaders.
func (*Client) CoreMedia ¶
func (c *Client) CoreMedia(ctx context.Context, sport, league string, limit int) (json.RawMessage, error)
CoreMedia returns league media (videos, photos).
func (*Client) CoreRankings ¶
CoreRankings returns rankings via the core API.
func (*Client) CoreStandings ¶
func (c *Client) CoreStandings(ctx context.Context, sport, league string, season int, seasonType SeasonType) (json.RawMessage, error)
CoreStandings fetches standings via the core API. Useful for sports where the site v2 standings stub is unavailable.
func (*Client) CoreTeams ¶
func (c *Client) CoreTeams(ctx context.Context, sport, league string, page, limit int) (*PagedRefs, error)
CoreTeams lists teams via the core API (PagedRefs).
func (*Client) CurrentSeason ¶
CurrentSeason returns the current season summary.
func (*Client) FantasyLeague ¶
func (c *Client) FantasyLeague(ctx context.Context, game FantasyGame, season int, leagueID string, opts *FantasyLeagueOptions) (json.RawMessage, error)
FantasyLeague fetches a public/private fantasy league.
Set WithFantasyAuth for private leagues. Pass multiple views via opts.Views to expand the response.
func (*Client) FantasyPlayerInfo ¶
func (c *Client) FantasyPlayerInfo(ctx context.Context, game FantasyGame, season int, leagueID string) (json.RawMessage, error)
FantasyPlayerInfo fetches kona_player_info for a league. This is the canonical "all rostered+free-agent players with projections" view.
func (*Client) Franchises ¶
func (c *Client) Franchises(ctx context.Context, sport, league string, limit int) (*PagedRefs, error)
Franchises returns league franchises.
func (*Client) FreeAgents ¶
func (c *Client) FreeAgents(ctx context.Context, sport, league string, season int, limit int) (json.RawMessage, error)
FreeAgents returns free agents for a season.
func (*Client) Futures ¶
func (c *Client) Futures(ctx context.Context, sport, league string, season int) (json.RawMessage, error)
Futures returns futures odds for a season.
func (*Client) Get ¶
Get performs a GET against the given domain/path and decodes the JSON body into out. Use Client.GetRaw when you want the unmarshalled bytes instead.
path is appended verbatim to the domain base URL. Leading slash is optional.
func (*Client) IterAthletes ¶ added in v0.1.1
func (c *Client) IterAthletes(ctx context.Context, sport, league string, opts *AthleteOptions) iter.Seq2[Ref, error]
IterAthletes iterates every athlete ref across all pages of Client.CoreAthletes. opts is copied; Page is overwritten and Limit defaults to 100.
func (*Client) IterCoaches ¶ added in v0.1.1
func (c *Client) IterCoaches(ctx context.Context, sport, league string, season, limit int) iter.Seq2[Ref, error]
IterCoaches iterates every coach ref. Pass season=0 for the league-wide list, or a specific year for that season's coaches. limit defaults to 100.
func (*Client) IterCoreTeams ¶ added in v0.1.1
func (c *Client) IterCoreTeams(ctx context.Context, sport, league string, limit int) iter.Seq2[Ref, error]
IterCoreTeams iterates every team ref across all pages of Client.CoreTeams. limit defaults to 100 when zero.
func (*Client) IterEvents ¶ added in v0.1.1
func (c *Client) IterEvents(ctx context.Context, sport, league string, opts *EventsOptions) iter.Seq2[Ref, error]
IterEvents iterates every event ref across all pages of Client.CoreEvents. If opts is non-nil it is copied; the Page field is overwritten each iteration and Limit defaults to 100 when zero.
func (*Client) IterFranchises ¶ added in v0.1.1
func (c *Client) IterFranchises(ctx context.Context, sport, league string, limit int) iter.Seq2[Ref, error]
IterFranchises iterates every franchise ref. limit defaults to 100.
func (*Client) IterSeasonTeams ¶ added in v0.1.1
func (c *Client) IterSeasonTeams(ctx context.Context, sport, league string, season, limit int) iter.Seq2[Ref, error]
IterSeasonTeams iterates the team refs for a single season across all pages. limit defaults to 100.
func (*Client) IterSeasons ¶ added in v0.1.1
func (c *Client) IterSeasons(ctx context.Context, sport, league string, limit int) iter.Seq2[Ref, error]
IterSeasons iterates every historical season ref. limit defaults to 20.
func (*Client) IterVenues ¶ added in v0.1.1
func (c *Client) IterVenues(ctx context.Context, sport, league string, limit int) iter.Seq2[Ref, error]
IterVenues iterates every venue ref. limit defaults to 500.
func (*Client) LeagueInfo ¶
LeagueInfo returns the core API league document.
func (*Client) LeagueInjuries ¶
LeagueInjuries returns the league-wide injury report. Not supported for MMA, Tennis, or Golf (server returns 500).
func (*Client) LeagueStatistics ¶
func (c *Client) LeagueStatistics(ctx context.Context, sport, league string) (json.RawMessage, error)
LeagueStatistics returns league statistical leaders (site API variant).
func (*Client) LeagueTransactions ¶
func (c *Client) LeagueTransactions(ctx context.Context, sport, league string) (json.RawMessage, error)
LeagueTransactions returns recent league-wide transactions.
func (*Client) Manufacturers ¶
func (c *Client) Manufacturers(ctx context.Context, sport, league string, season int) (json.RawMessage, error)
Manufacturers returns racing manufacturers.
func (*Client) Odds ¶
func (c *Client) Odds(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
Odds fetches the betting odds for a competition.
func (*Client) Officials ¶
func (c *Client) Officials(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
Officials returns the assigned officials.
func (*Client) Plays ¶
func (c *Client) Plays(ctx context.Context, sport, league, eventID, competitionID string, limit int) (json.RawMessage, error)
Plays fetches play-by-play data.
func (*Client) PowerIndex ¶
func (c *Client) PowerIndex(ctx context.Context, sport, league string, season int, teamID string) (json.RawMessage, error)
PowerIndex fetches the season-level Power Index. teamID="" returns the league-wide payload; pass a teamID for that team's BPI/SP+/FPI.
func (*Client) PowerIndexGame ¶
func (c *Client) PowerIndexGame(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
PowerIndexGame returns the ESPN Power Index for a single game.
func (*Client) PowerIndexLeaders ¶
func (c *Client) PowerIndexLeaders(ctx context.Context, sport, league string, season int) (json.RawMessage, error)
PowerIndexLeaders returns the season Power Index leaderboard.
func (*Client) Predictor ¶
func (c *Client) Predictor(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
Predictor returns the ESPN game predictor.
func (*Client) Probabilities ¶
func (c *Client) Probabilities(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
Probabilities fetches per-play win probabilities.
func (*Client) QBR ¶
func (c *Client) QBR(ctx context.Context, league string, season int, opts *QBROptions) (json.RawMessage, error)
QBR fetches ESPN Total Quarterback Rating. League must be "nfl" or "college-football".
func (*Client) RecruitingClass ¶
func (c *Client) RecruitingClass(ctx context.Context, league string, season int, teamID string) (json.RawMessage, error)
RecruitingClass returns a team's recruiting class for a given season.
func (*Client) Recruits ¶
func (c *Client) Recruits(ctx context.Context, league string, season int, limit int) (json.RawMessage, error)
Recruits returns the recruit rankings for a season (CFB).
func (*Client) Resolve ¶
Resolve fetches the document at the given $ref URL. Useful for following links inside core API responses (e.g. paged event refs, athlete -> team).
Resolve only accepts URLs whose host matches one of the configured ESPN domains; other URLs return an error to avoid SSRF surprises.
func (*Client) ResolveRaw ¶
ResolveRaw is like Client.Resolve but returns the raw body.
func (*Client) Scoreboard ¶
func (c *Client) Scoreboard(ctx context.Context, sport, league string, opts *ScoreboardOptions) (*Scoreboard, error)
Scoreboard fetches the scoreboard for a sport/league. Pass nil opts to get the current week/day.
func (*Client) ScoreboardHeader ¶
ScoreboardHeader returns the cross-sport scoreboard header / nav state.
func (*Client) ScoreboardRaw ¶
func (c *Client) ScoreboardRaw(ctx context.Context, sport, league string, opts *ScoreboardOptions) (json.RawMessage, error)
ScoreboardRaw returns the raw scoreboard JSON.
func (*Client) ScoreboardV3 ¶
func (c *Client) ScoreboardV3(ctx context.Context, sport, league string, opts *ScoreboardOptions) (json.RawMessage, error)
ScoreboardV3 fetches the v3 (richer) scoreboard variant.
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, query string, opts *SearchOptions) (json.RawMessage, error)
Search runs a global ESPN search.
func (*Client) SeasonATSRecord ¶
func (c *Client) SeasonATSRecord(ctx context.Context, sport, league string, season int, seasonType SeasonType, teamID string) (json.RawMessage, error)
SeasonATSRecord returns a team's ATS record for a season/season-type.
func (*Client) SeasonDraft ¶
func (c *Client) SeasonDraft(ctx context.Context, sport, league string, season int) (json.RawMessage, error)
SeasonDraft returns the draft for a season.
func (*Client) SeasonOddsRecord ¶
func (c *Client) SeasonOddsRecord(ctx context.Context, sport, league string, season int, seasonType SeasonType, teamID string) (json.RawMessage, error)
SeasonOddsRecord returns a team's odds-records for a season/season-type.
func (*Client) SeasonTeams ¶
func (c *Client) SeasonTeams(ctx context.Context, sport, league string, season int, limit int) (*PagedRefs, error)
SeasonTeams returns the teams for a particular season.
func (*Client) Situation ¶
func (c *Client) Situation(ctx context.Context, sport, league, eventID, competitionID string) (json.RawMessage, error)
Situation returns the live game situation (down/distance/possession).
func (*Client) Standings ¶
func (c *Client) Standings(ctx context.Context, sport, league string, season int) (*Standings, error)
Standings fetches standings via /apis/v2/. The /apis/site/v2/ path returns only a stub link, so this method uses the v2 path even on the site domain.
func (*Client) StatisticsByAthlete ¶
func (c *Client) StatisticsByAthlete(ctx context.Context, sport, league string, opts *StatisticsByAthleteOptions) (json.RawMessage, error)
StatisticsByAthlete returns a ranked athlete statistics leaderboard. Confirmed for NBA/NFL/NHL/MLB.
func (*Client) SummaryRaw ¶
func (c *Client) SummaryRaw(ctx context.Context, sport, league, eventID string) (json.RawMessage, error)
SummaryRaw returns the full game summary as raw JSON.
func (*Client) SummaryV3Raw ¶
func (c *Client) SummaryV3Raw(ctx context.Context, sport, league, eventID string) (json.RawMessage, error)
SummaryV3Raw returns the v3 enriched summary.
func (*Client) TeamDepthChart ¶
func (c *Client) TeamDepthChart(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
TeamDepthChart fetches the depth chart grouped by position.
func (*Client) TeamHistory ¶
func (c *Client) TeamHistory(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
TeamHistory fetches a team's franchise history.
func (*Client) TeamInjuries ¶
func (c *Client) TeamInjuries(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
TeamInjuries fetches a team's injury report.
func (*Client) TeamLeaders ¶
func (c *Client) TeamLeaders(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
TeamLeaders fetches the team-scoped statistical leaders.
func (*Client) TeamNews ¶
func (c *Client) TeamNews(ctx context.Context, sport, league, teamID string, limit int) (*NewsFeed, error)
TeamNews fetches news articles for a team.
func (*Client) TeamRecord ¶
func (c *Client) TeamRecord(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
TeamRecord fetches a team's record.
func (*Client) TeamRoster ¶
TeamRoster fetches a team's roster.
func (*Client) TeamSchedule ¶
func (c *Client) TeamSchedule(ctx context.Context, sport, league, teamID string, season int, seasonType SeasonType) (json.RawMessage, error)
TeamSchedule fetches a team's full season schedule.
func (*Client) TeamTransactions ¶
func (c *Client) TeamTransactions(ctx context.Context, sport, league, teamID string) (json.RawMessage, error)
TeamTransactions fetches recent transactions for a team.
func (*Client) Teams ¶
func (c *Client) Teams(ctx context.Context, sport, league string, limit int) (*TeamsResponse, error)
Teams fetches every team in a league.
func (*Client) Tournaments ¶
func (c *Client) Tournaments(ctx context.Context, sport, league string, majorsOnly bool) (json.RawMessage, error)
Tournaments returns league tournaments (mainly for golf/tennis).
type College ¶
type College struct {
ID string `json:"id,omitempty"`
GUID string `json:"guid,omitempty"`
Name string `json:"name,omitempty"`
Mascot string `json:"mascot,omitempty"`
Slug string `json:"slug,omitempty"`
Abbrev string `json:"abbrev,omitempty"`
}
College is an athlete's college affiliation.
type Competition ¶
type Competition struct {
ID string `json:"id"`
UID string `json:"uid,omitempty"`
Date string `json:"date"`
Attendance int `json:"attendance,omitempty"`
Type json.RawMessage `json:"type,omitempty"`
TimeValid bool `json:"timeValid,omitempty"`
NeutralSite bool `json:"neutralSite,omitempty"`
ConferenceCompetition bool `json:"conferenceCompetition,omitempty"`
PlayByPlayAvailable bool `json:"playByPlayAvailable,omitempty"`
Recent bool `json:"recent,omitempty"`
Venue *Venue `json:"venue,omitempty"`
Competitors []Competitor `json:"competitors"`
Notes []Note `json:"notes,omitempty"`
Status Status `json:"status"`
Broadcasts []Broadcast `json:"broadcasts,omitempty"`
Leaders []Leader `json:"leaders,omitempty"`
Format json.RawMessage `json:"format,omitempty"`
StartDate string `json:"startDate,omitempty"`
GeoBroadcasts []GeoBroadcast `json:"geoBroadcasts,omitempty"`
Headlines []json.RawMessage `json:"headlines,omitempty"`
Odds []OddsSummary `json:"odds,omitempty"`
Tickets []json.RawMessage `json:"tickets,omitempty"`
Situation *json.RawMessage `json:"situation,omitempty"`
}
Competition is one competition inside an Event.
type Competitor ¶
type Competitor struct {
ID string `json:"id"`
UID string `json:"uid,omitempty"`
Type string `json:"type,omitempty"`
Order int `json:"order,omitempty"`
HomeAway string `json:"homeAway,omitempty"`
Winner bool `json:"winner,omitempty"`
Team Team `json:"team"`
Score string `json:"score,omitempty"`
Linescores []Linescore `json:"linescores,omitempty"`
Statistics []Statistic `json:"statistics,omitempty"`
Records []Record `json:"records,omitempty"`
Leaders []Leader `json:"leaders,omitempty"`
CuratedRank *struct {
Current int `json:"current,omitempty"`
} `json:"curatedRank,omitempty"`
}
Competitor is one of the two teams (or sides) in a Competition.
type Domain ¶
type Domain int
Domain identifies which ESPN host a request targets.
const ( // DomainSite is site.api.espn.com — scoreboard, teams, news, summaries. DomainSite Domain = iota // DomainCore is sports.core.api.espn.com — core v2/v3 (athletes, events, odds). DomainCore // DomainWeb is site.web.api.espn.com — common/v3 athlete data, search. DomainWeb // DomainCDN is cdn.espn.com — full game packages (xhr=1 is added automatically). DomainCDN // DomainNow is now.core.api.espn.com — real-time news feed. DomainNow // DomainFantasy is fantasy.espn.com — fantasy leagues. DomainFantasy )
type Draft ¶
type Draft struct {
Year int `json:"year,omitempty"`
Round int `json:"round,omitempty"`
Selection int `json:"selection,omitempty"`
DisplayText string `json:"displayText,omitempty"`
}
Draft holds an athlete's draft info.
type Event ¶
type Event struct {
ID string `json:"id"`
UID string `json:"uid,omitempty"`
Date string `json:"date"`
Name string `json:"name"`
ShortName string `json:"shortName,omitempty"`
Season Season `json:"season"`
Week Week `json:"week"`
Status Status `json:"status"`
Competitions []Competition `json:"competitions"`
Links []Link `json:"links,omitempty"`
}
Event is a single game/match on a scoreboard.
type EventsOptions ¶
type EventsOptions struct {
Dates string // YYYY, YYYYMMDD, or YYYYMMDD-YYYYMMDD
Limit int
Page int
}
EventsOptions filters the core /events list.
type Experience ¶
type Experience struct {
Years int `json:"years,omitempty"`
}
Experience contains years played. ESPN sometimes returns a bare integer (e.g. for coach experience) and sometimes an object with a "years" key.
func (*Experience) UnmarshalJSON ¶
func (e *Experience) UnmarshalJSON(b []byte) error
UnmarshalJSON accepts either `5` or `{"years":5}`.
type FantasyGame ¶
type FantasyGame string
FantasyGame is the URL fragment for fantasy.espn.com.
const ( FantasyFootball FantasyGame = "ffl" FantasyBasketball FantasyGame = "fba" FantasyBaseball FantasyGame = "flb" FantasyHockey FantasyGame = "fhl" )
type FantasyLeagueOptions ¶
type FantasyLeagueOptions struct {
Segment FantasySegment
Views []FantasyView
// ScoringPeriodID limits to a specific weekly period (mostly used with mMatchupScore).
ScoringPeriodID int
}
FantasyLeagueOptions filters a fantasy league lookup.
type FantasySegment ¶
type FantasySegment int
FantasySegment selects season vs playoff round.
const ( FantasySegmentSeason FantasySegment = 0 FantasySegmentPlayoffR1 FantasySegment = 1 FantasySegmentPlayoffR2 FantasySegment = 2 FantasySegmentChampionship FantasySegment = 3 )
type FantasyView ¶
type FantasyView string
FantasyView is one of the documented mView=... values.
const ( FantasyViewTeam FantasyView = "mTeam" FantasyViewRoster FantasyView = "mRoster" FantasyViewMatchup FantasyView = "mMatchup" FantasyViewMatchupScore FantasyView = "mMatchupScore" FantasyViewSettings FantasyView = "mSettings" FantasyViewDraftDetail FantasyView = "mDraftDetail" FantasyViewScoreboard FantasyView = "mScoreboard" FantasyViewStandings FantasyView = "mStandings" FantasyViewStatus FantasyView = "mStatus" FantasyViewPlayerInfo FantasyView = "kona_player_info" )
type GeoBroadcast ¶
type GeoBroadcast struct {
Type struct {
ID string `json:"id,omitempty"`
ShortName string `json:"shortName,omitempty"`
} `json:"type"`
Market struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
} `json:"market"`
Media struct {
ShortName string `json:"shortName,omitempty"`
} `json:"media"`
Lang string `json:"lang,omitempty"`
Region string `json:"region,omitempty"`
}
GeoBroadcast is the geo-aware broadcast variant from scoreboards.
type Image ¶
type Image struct {
ID json.Number `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Caption string `json:"caption,omitempty"`
URL string `json:"url,omitempty"`
Height int `json:"height,omitempty"`
Width int `json:"width,omitempty"`
Alt string `json:"alt,omitempty"`
Credit string `json:"credit,omitempty"`
Type string `json:"type,omitempty"`
Source string `json:"source,omitempty"`
DataSource string `json:"dataSourceIdentifier,omitempty"`
}
Image is similar to Logo but used in news/articles.
type Leader ¶
type Leader struct {
Name string `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
ShortName string `json:"shortDisplayName,omitempty"`
Abbrev string `json:"abbreviation,omitempty"`
Leaders []LeaderEntry `json:"leaders,omitempty"`
}
Leader describes a category leader (e.g. points leader).
type LeaderEntry ¶
type LeaderEntry struct {
DisplayValue string `json:"displayValue,omitempty"`
Value float64 `json:"value,omitempty"`
Rel []string `json:"rel,omitempty"`
Athlete json.RawMessage `json:"athlete,omitempty"`
Team json.RawMessage `json:"team,omitempty"`
Statistics json.RawMessage `json:"statistics,omitempty"`
}
LeaderEntry is a single ranked athlete inside a Leader category.
type Linescore ¶
type Linescore struct {
Value float64 `json:"value,omitempty"`
DisplayValue string `json:"displayValue,omitempty"`
Period int `json:"period,omitempty"`
}
Linescore is a single period score.
type Link ¶
type Link struct {
Language string `json:"language,omitempty"`
Rel []string `json:"rel,omitempty"`
Href string `json:"href,omitempty"`
Text string `json:"text,omitempty"`
ShortText string `json:"shortText,omitempty"`
IsExternal bool `json:"isExternal,omitempty"`
IsPremium bool `json:"isPremium,omitempty"`
}
Link is an external URL with relationship hints.
type Logo ¶
type Logo struct {
Href string `json:"href"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Alt string `json:"alt,omitempty"`
Rel []string `json:"rel,omitempty"`
LastUpdated string `json:"lastUpdated,omitempty"`
}
Logo describes a team or league logo asset.
type NewsFeed ¶
type NewsFeed struct {
Header string `json:"header,omitempty"`
Link *Link `json:"link,omitempty"`
Articles []Article `json:"articles"`
}
NewsFeed is the standard /news response across the site API.
type Note ¶
type Note struct {
Color string `json:"color,omitempty"`
Description string `json:"description,omitempty"`
Rank int `json:"rank,omitempty"`
}
Note is an annotation on a standings row (e.g. "Clinched Playoffs").
type NowFeed ¶
type NowFeed struct {
ResultsCount int `json:"resultsCount"`
ResultsLimit int `json:"resultsLimit"`
ResultsOffset int `json:"resultsOffset"`
Feed []NowItem `json:"feed"`
}
NowFeed is the response from now.core.api.espn.com.
type NowItem ¶
type NowItem struct {
DataSourceID string `json:"dataSourceIdentifier"`
Description string `json:"description"`
NowID string `json:"nowId"`
Premium bool `json:"premium,omitempty"`
Published string `json:"published"`
LastModified string `json:"lastModified"`
Type string `json:"type"`
Headline string `json:"headline"`
Links ArticleLinks `json:"links,omitempty"`
Images []Image `json:"images,omitempty"`
Categories []Category `json:"categories,omitempty"`
}
NowItem is one entry in the NowFeed feed.
type NowOptions ¶
type NowOptions struct {
Sport string
League string
Team string // team abbreviation (e.g. "dal")
Limit int
Offset int
}
NowOptions filters real-time news.
type OddsSummary ¶
type OddsSummary struct {
Provider struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Priority int `json:"priority,omitempty"`
} `json:"provider"`
Details string `json:"details,omitempty"`
OverUnder float64 `json:"overUnder,omitempty"`
Spread float64 `json:"spread,omitempty"`
OverOdds float64 `json:"overOdds,omitempty"`
UnderOdds float64 `json:"underOdds,omitempty"`
HomeTeamOdds *TeamOdds `json:"homeTeamOdds,omitempty"`
AwayTeamOdds *TeamOdds `json:"awayTeamOdds,omitempty"`
}
OddsSummary is the embedded odds object on a scoreboard competition.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithBackoff ¶
WithBackoff sets the base backoff duration. Wait grows as base * 2^(attempt-1).
func WithCoreURL ¶
WithCoreURL overrides the sports.core.api.espn.com base URL.
func WithFantasyAuth ¶
WithFantasyAuth supplies espn_s2 / SWID cookies for private fantasy leagues.
func WithFantasyURL ¶
WithFantasyURL overrides the fantasy.espn.com base URL.
func WithHTTPClient ¶
WithHTTPClient sets a custom *http.Client. If you supply one, set its Timeout yourself; WithTimeout only affects the default client.
func WithMaxRetries ¶
WithMaxRetries sets the number of retries for 5xx and transport errors (default 3). Set to 0 to disable retries.
func WithNowURL ¶
WithNowURL overrides the now.core.api.espn.com base URL.
func WithSiteURL ¶
WithSiteURL overrides the site.api.espn.com base URL (testing/mocks).
func WithTimeout ¶
WithTimeout sets the HTTP client timeout (default 30s). Ignored when WithHTTPClient is also used.
func WithUserAgent ¶
WithUserAgent sets the User-Agent header (default "espn-go-sdk/0.1").
func WithWebURL ¶
WithWebURL overrides the site.web.api.espn.com base URL.
type PagedRefs ¶
type PagedRefs struct {
Count int `json:"count,omitempty"`
PageIndex int `json:"pageIndex,omitempty"`
PageSize int `json:"pageSize,omitempty"`
PageCount int `json:"pageCount,omitempty"`
Items []Ref `json:"items"`
}
PagedRefs is a generic core-API paginated list of $ref entries.
type Position ¶
type Position struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Abbreviation string `json:"abbreviation,omitempty"`
Leaf bool `json:"leaf,omitempty"`
Parent json.RawMessage `json:"parent,omitempty"`
}
Position represents a player position. The `parent` field can be either an inline object or a $ref — both are exposed via [Position.Parent].
type QBROptions ¶
type QBROptions struct {
SeasonType SeasonType // default SeasonRegular
Group int // 1 = NFL, 80 = FBS for college
Split QBRSplit // 0 totals, 1 home, 2 away
Week int // optional — produces weekly QBR if set
}
QBROptions filters the QBR endpoint.
type Record ¶
type Record struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Summary string `json:"summary,omitempty"`
DisplayValue string `json:"displayValue,omitempty"`
Stats []Statistic `json:"stats,omitempty"`
}
Record summarises a team or athlete record entry.
type Ref ¶
type Ref struct {
Ref string `json:"$ref"`
}
Ref is the {"$ref": "..."} hyperlink ESPN sprinkles through the core API.
type Scoreboard ¶
type Scoreboard struct {
Leagues []ScoreboardLeague `json:"leagues"`
Season Season `json:"season"`
Week Week `json:"week"`
Day struct {
Date string `json:"date"`
} `json:"day"`
Events []Event `json:"events"`
}
Scoreboard is the response shape of /apis/site/v2/sports/{sport}/{league}/scoreboard.
type ScoreboardLeague ¶
type ScoreboardLeague struct {
ID string `json:"id"`
UID string `json:"uid"`
Name string `json:"name"`
Abbreviation string `json:"abbreviation"`
Slug string `json:"slug"`
Season Season `json:"season"`
Logos []Logo `json:"logos,omitempty"`
CalendarType string `json:"calendarType,omitempty"`
CalendarIsWhitelist bool `json:"calendarIsWhitelist,omitempty"`
CalendarStartDate string `json:"calendarStartDate,omitempty"`
CalendarEndDate string `json:"calendarEndDate,omitempty"`
Calendar []any `json:"calendar,omitempty"`
MidseasonTransfer bool `json:"midsesasonTransferAllowed,omitempty"`
Year int `json:"year,omitempty"`
}
ScoreboardLeague is the league summary embedded in scoreboard responses.
type ScoreboardOptions ¶
type ScoreboardOptions struct {
// Date format YYYYMMDD or a range YYYYMMDD-YYYYMMDD. Use [ScoreboardOptions.SetDate] for [time.Time].
Dates string
Week int
SeasonType SeasonType
Year int
Limit int
Groups int // CFB conference id
}
ScoreboardOptions narrows a scoreboard query.
func (*ScoreboardOptions) SetDate ¶
func (o *ScoreboardOptions) SetDate(t time.Time)
SetDate fills Dates with t formatted as YYYYMMDD.
type SearchOptions ¶
type SearchOptions struct {
Sport string // e.g. "nba"
Limit int
Mode string // e.g. "open" (default omitted)
Type string // e.g. "athlete", "team", "article"
}
SearchOptions narrows a global search.
type Season ¶
type Season struct {
Year int `json:"year,omitempty"`
Type SeasonTypeRef `json:"type,omitempty"`
Slug string `json:"slug,omitempty"`
Name string `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
StartDate string `json:"startDate,omitempty"`
EndDate string `json:"endDate,omitempty"`
}
Season identifies a season window. ESPN returns Type as either a bare int (event/competition level) or a nested object (league/scoreboard level). The SeasonTypeRef wrapper accepts both.
type SeasonType ¶
type SeasonType int
Season types used by the seasontype/seasonType query parameter.
const ( SeasonPreseason SeasonType = 1 SeasonRegular SeasonType = 2 SeasonPostseason SeasonType = 3 SeasonOffseason SeasonType = 4 )
type SeasonTypeRef ¶
type SeasonTypeRef struct {
ID int `json:"-"`
Name string `json:"name,omitempty"`
Abbreviation string `json:"abbreviation,omitempty"`
HasGroups bool `json:"hasGroups,omitempty"`
}
SeasonTypeRef accepts either `2` or `{"id":"2","type":2,"name":"Regular Season"}`. Read [SeasonTypeRef.ID] for the integer code (1=pre, 2=regular, 3=post, 4=offseason).
func (SeasonTypeRef) MarshalJSON ¶
func (s SeasonTypeRef) MarshalJSON() ([]byte, error)
MarshalJSON emits the int form. Round-tripping the original object form is not supported.
func (*SeasonTypeRef) UnmarshalJSON ¶
func (s *SeasonTypeRef) UnmarshalJSON(b []byte) error
UnmarshalJSON parses both integer and object forms of season.type.
type Standings ¶
type Standings struct {
UID string `json:"uid,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Abbreviation string `json:"abbreviation,omitempty"`
Season *Season `json:"season,omitempty"`
FullViewLink *Link `json:"fullViewLink,omitempty"`
Children []StandingsGroup `json:"children,omitempty"`
Standings *StandingsGroupEntries `json:"standings,omitempty"`
Links []Link `json:"links,omitempty"`
}
Standings is the response from /apis/v2/.../standings.
type StandingsEntry ¶
type StandingsEntry struct {
Team Team `json:"team"`
Note *Note `json:"note,omitempty"`
Stats []Statistic `json:"stats,omitempty"`
}
StandingsEntry is a single team's row.
func (*StandingsEntry) FindStat ¶
func (e *StandingsEntry) FindStat(name string) *Statistic
FindStat returns the stat with the given name (case-insensitive) or nil.
type StandingsGroup ¶
type StandingsGroup struct {
UID string `json:"uid,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Abbreviation string `json:"abbreviation,omitempty"`
Standings *StandingsGroupEntries `json:"standings,omitempty"`
Children []StandingsGroup `json:"children,omitempty"`
}
StandingsGroup is a conference/division group inside Standings.
type StandingsGroupEntries ¶
type StandingsGroupEntries struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Entries []StandingsEntry `json:"entries"`
}
StandingsGroupEntries holds the entries (one per team) for a StandingsGroup.
type Statistic ¶
type Statistic struct {
Name string `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
ShortDisplayName string `json:"shortDisplayName,omitempty"`
Description string `json:"description,omitempty"`
Abbreviation string `json:"abbreviation,omitempty"`
Type string `json:"type,omitempty"`
Value float64 `json:"value,omitempty"`
DisplayValue string `json:"displayValue,omitempty"`
}
Statistic is a generic name/displayValue stat used across many endpoints.
type StatisticsByAthleteOptions ¶
type StatisticsByAthleteOptions struct {
Season int
SeasonType SeasonType
Category string // e.g. "passing" (NFL), "batting" (MLB)
Sort string // e.g. "passing.passingYards:desc"
Limit int
Page int
}
StatisticsByAthleteOptions filters the leaderboard endpoint.
type Status ¶
type Status struct {
Clock float64 `json:"clock,omitempty"`
DisplayClock string `json:"displayClock,omitempty"`
Period int `json:"period,omitempty"`
Type StatusType `json:"type"`
}
Status combines clock + period info with a StatusType.
type StatusType ¶
type StatusType struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"` // e.g. "STATUS_FINAL", "STATUS_IN_PROGRESS"
State string `json:"state,omitempty"` // "pre", "in", "post"
Completed bool `json:"completed,omitempty"`
Description string `json:"description,omitempty"`
Detail string `json:"detail,omitempty"`
ShortDetail string `json:"shortDetail,omitempty"`
}
StatusType describes the lifecycle state of a competition.
type Summary ¶
type Summary struct {
Header *json.RawMessage `json:"header,omitempty"`
Boxscore *json.RawMessage `json:"boxscore,omitempty"`
Plays []json.RawMessage `json:"plays,omitempty"`
Drives *json.RawMessage `json:"drives,omitempty"`
Leaders json.RawMessage `json:"leaders,omitempty"`
Broadcasts json.RawMessage `json:"broadcasts,omitempty"`
Predictor *json.RawMessage `json:"predictor,omitempty"`
News *json.RawMessage `json:"news,omitempty"`
Standings *json.RawMessage `json:"standings,omitempty"`
GameInfo *json.RawMessage `json:"gameInfo,omitempty"`
Article *json.RawMessage `json:"article,omitempty"`
Pickcenter json.RawMessage `json:"pickcenter,omitempty"`
Odds json.RawMessage `json:"odds,omitempty"`
Format *json.RawMessage `json:"format,omitempty"`
Season *Season `json:"season,omitempty"`
Week *Week `json:"week,omitempty"`
}
Summary is the response from /apis/site/v2/.../summary?event={id}.
The summary payload is heavily sport-dependent. Common fields are typed; the rest are exposed as json.RawMessage for callers who need them.
type Team ¶
type Team struct {
ID string `json:"id,omitempty"`
UID string `json:"uid,omitempty"`
GUID string `json:"guid,omitempty"`
Slug string `json:"slug,omitempty"`
Location string `json:"location,omitempty"`
Name string `json:"name,omitempty"`
Nickname string `json:"nickname,omitempty"`
Abbreviation string `json:"abbreviation,omitempty"`
DisplayName string `json:"displayName,omitempty"`
ShortDisplayName string `json:"shortDisplayName,omitempty"`
Color string `json:"color,omitempty"`
AlternateColor string `json:"alternateColor,omitempty"`
IsActive bool `json:"isActive,omitempty"`
IsAllStar bool `json:"isAllStar,omitempty"`
Logo string `json:"logo,omitempty"`
Logos []Logo `json:"logos,omitempty"`
Links []Link `json:"links,omitempty"`
Venue *Venue `json:"venue,omitempty"`
// Conference / division references (often as $ref).
Groups json.RawMessage `json:"groups,omitempty"`
// Record summaries — present on team detail / roster payloads.
Record json.RawMessage `json:"record,omitempty"`
}
Team is the canonical team summary used across the site API.
type TeamDetail ¶
type TeamDetail struct {
Team Team `json:"team"`
}
TeamDetail is the wrapper for a single-team response.
type TeamOdds ¶
type TeamOdds struct {
Favorite bool `json:"favorite,omitempty"`
Underdog bool `json:"underdog,omitempty"`
MoneyLine float64 `json:"moneyLine,omitempty"`
SpreadOdds float64 `json:"spreadOdds,omitempty"`
}
TeamOdds describes a single team's odds line.
type TeamRoster ¶
type TeamRoster struct {
Team Team `json:"team"`
Athletes json.RawMessage `json:"athletes"` // shape varies per sport (grouped vs flat)
Coach []Athlete `json:"coach,omitempty"`
Status string `json:"status,omitempty"`
Season *Season `json:"season,omitempty"`
}
TeamRoster is the response for a team's roster endpoint.
func (*TeamRoster) RosterAthletes ¶
func (r *TeamRoster) RosterAthletes() []Athlete
RosterAthletes attempts to flatten common roster shapes:
- flat: [{...athlete...}]
- grouped (NBA/NFL): [{position: "G", items: [{...}]}]
type TeamsResponse ¶
type TeamsResponse struct {
Sports []struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Leagues []struct {
ID string `json:"id"`
Name string `json:"name"`
Abbreviation string `json:"abbreviation"`
Slug string `json:"slug"`
Teams []struct {
Team Team `json:"team"`
} `json:"teams"`
} `json:"leagues"`
} `json:"sports"`
Count int `json:"count,omitempty"`
PageIndex int `json:"pageIndex,omitempty"`
PageSize int `json:"pageSize,omitempty"`
}
TeamsResponse wraps the /teams endpoint, which buries the team list deep.
func (*TeamsResponse) Flatten ¶
func (r *TeamsResponse) Flatten() []Team
Flatten extracts the Team slice from the nested response.
type Venue ¶
type Venue struct {
ID string `json:"id,omitempty"`
FullName string `json:"fullName,omitempty"`
Address Address `json:"address,omitempty"`
Capacity int `json:"capacity,omitempty"`
Indoor bool `json:"indoor,omitempty"`
Grass bool `json:"grass,omitempty"`
Images []Logo `json:"images,omitempty"`
}
Venue describes a stadium/arena.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
basic
command
Command basic exercises the espn SDK against the live ESPN API.
|
Command basic exercises the espn SDK against the live ESPN API. |
|
paginate
command
Command paginate demonstrates the SDK's pagination helpers.
|
Command paginate demonstrates the SDK's pagination helpers. |