gonhl

package module
Version: v0.0.0-...-a4bc09b Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 7 Imported by: 0

README

gonhl

GoDoc

API wrapper for the official public NHL API.

API Documentation | API Examples

Good NHL API documentation: https://gitlab.com/dword4/nhlapi/tree/master

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertTimeToSeconds

func ConvertTimeToSeconds(timeString string) int

ConvertTimeToSeconds takes a time string with format mm:ss and returns an int representing the total seconds. These time strings can be found from responses for player stats and various boxscore information

func CreateDateFromString

func CreateDateFromString(dateString string) (time.Time, error)

CreateDateFromString converts a string representing a date with format `yyyy-mm-dd` to a time.Time object.

func CreateStringFromDate

func CreateStringFromDate(date time.Time) string

CreateStringFromDate converts a time.Time object to a string representing a date with format `yyyy-mm-dd`.

Types

type About

type About struct {
	EventIdx            int       `json:"eventIdx"`
	EventID             int       `json:"eventId"`
	Period              int       `json:"period"`
	PeriodType          string    `json:"periodType"`
	OrdinalNum          string    `json:"ordinalNum"`
	PeriodTime          string    `json:"periodTime"`
	PeriodTimeRemaining string    `json:"periodTimeRemaining"`
	DateTime            time.Time `json:"dateTime"`
	Goals               struct {
		Away int `json:"away"`
		Home int `json:"home"`
	} `json:"goals"`
}

type BasicLiveFeed

type BasicLiveFeed struct {
	LiveData LiveData `json:"liveData"`
}

type BasicPerson

type BasicPerson struct {
	ID       int    `json:"id"`
	FullName string `json:"fullName"`
	Link     string `json:"link"`
}

type Boxscore

type Boxscore struct {
	Teams struct {
		Away BoxscoreTeam `json:"away"`
		Home BoxscoreTeam `json:"home"`
	} `json:"teams"`
	Officials []Official `json:"officials"`
}

API endpoint

type BoxscoreTeam

type BoxscoreTeam struct {
	Team      Team `json:"team"`
	TeamStats struct {
		TeamSkaterStats TeamSkaterStats `json:"teamSkaterStats"`
	} `json:"teamStats"`
	Players    map[string]Skater `json:"players"`
	Goalies    []int             `json:"goalies"`
	Skaters    []int             `json:"skaters"`
	OnIce      []int             `json:"onIce"`
	OnIcePlus  []OnIcePlus       `json:"onIcePlus"`
	Scratches  []int             `json:"scratches"`
	PenaltyBox []PenaltyBox      `json:"penaltyBox"`
	Coaches    []Coach           `json:"coaches"`
}

type Broadcast

type Broadcast struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	Site     string `json:"site"`
	Language string `json:"language"`
}

type Client

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

A Client is required for api calls

func NewClient

func NewClient() *Client
Example
package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	fmt.Println(client)
}
Output:

func (*Client) GetConference

func (c *Client) GetConference(id int) (Conference, int)

GetConference retrieves information about a specific NHL conference using a conference ID.

Example
package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	conference, _ := client.GetConference(6)
	fmt.Println(conference.Name)
}
Output:

Eastern

func (*Client) GetConferences

func (c *Client) GetConferences() ([]Conference, int)

GetConferences retrieves information about the NHL conferences.

func (*Client) GetCurrentDraft

func (c *Client) GetCurrentDraft() ([]Draft, int)

GetCurrentDraft retrieves information about the current NHL draft.

func (*Client) GetDivision

func (c *Client) GetDivision(id int) (Division, int)

GetDivision retreives information about a specific NHL division using a division ID.

Example
package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	division, _ := client.GetDivision(18)
	fmt.Println(division.Name)
}
Output:

Metropolitan

func (*Client) GetDivisions

func (c *Client) GetDivisions() ([]Division, int)

GetDivisions retrieves information about the NHL divisions.

func (*Client) GetDraft

func (c *Client) GetDraft(year int) ([]Draft, int)

GetDraft retrieves information about a NHL draft from a specific year.

Example
package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	draft, _ := client.GetDraft(2018)
	fmt.Println(draft[0].DraftYear)
}
Output:

2018

func (*Client) GetGameBoxscore

func (c *Client) GetGameBoxscore(id int) (Boxscore, int)

GetGameBoxscore retrieves the boxscore from a specific NHL game. Boxscore contains less information than GetGameLiveFeed.

func (*Client) GetGameContent

func (c *Client) GetGameContent(id int) (GameContent, int)

GetGameContent retrieves all media related content pertaining to a specific NHL game. Can contain various articles, videos, and images related to the game.

func (*Client) GetGameLinescore

func (c *Client) GetGameLinescore(id int) (Linescore, int)

GetGameLinescore retrieves the linescore from a specific NHL game. Linescore contains less information than GetGameBoxscore.

func (*Client) GetGameLiveData

func (c *Client) GetGameLiveData(id int) (LiveData, int)

GetGameLiveData retrieves only the live data portion from a specific NHL game. This should be a faster call than GetGameLiveFeed due to the smaller unmarshalling. The endpoint call is still the exact same as GetGameLiveFeed due to the limitations of the API

Example

Example of retrieving only the live data of a game.

package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	feed, _ := client.GetGameLiveData(2018020514)
	fmt.Println(feed.Boxscore.Teams.Home.Team.Name)
	fmt.Println(feed.Boxscore.Teams.Home.OnIcePlus[0].PlayerID)
	fmt.Println(feed.Plays.CurrentPlay.About.DateTime.String())
}
Output:

Montréal Canadiens
8470642
2018-12-18 03:00:57 +0000 UTC

func (*Client) GetGameLiveDataDiff

func (c *Client) GetGameLiveDataDiff(id int, time time.Time) (LiveData, int)

GetGamePlays retrieves only the newest plays from a specific NHL game. All plays after a certain time (not relative to game) are retrieved. This endpoint call is still the exact same as GetGameLiveData due to the limitations of the API

func (*Client) GetGameLiveFeed

func (c *Client) GetGameLiveFeed(id int) (LiveFeed, int)

GetGameLiveFeed retrieves the live feed from a specific NHL game. LiveFeed contains all information from Boxscore and Linescore. LiveFeed also contains play by play information

Example
package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	feed, _ := client.GetGameLiveFeed(2018020514)
	fmt.Println(feed.LiveData.Boxscore.Teams.Home.Team.Name)
	fmt.Println(feed.LiveData.Boxscore.Teams.Home.OnIcePlus[0].PlayerID)
}
Output:

Montréal Canadiens
8470642

func (*Client) GetGamePlays

func (c *Client) GetGamePlays(id int, time time.Time) (Plays, int)

GetGamePlays retrieves only the newest plays from a specific NHL game. All plays after a certain time (not relative to game) are retrieved. This endpoint call is still the exact same as GetGameLiveData due to the limitations of the API

func (*Client) GetPlayer

func (c *Client) GetPlayer(id int) (Player, int)

GetPlayer retrieves information about a single NHL player using a player ID.

Example

Example of retrieving Player information. Information about Connor McDavid.

package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	player, _ := client.GetPlayer(8478402)
	fmt.Println(player.FullName)
	fmt.Println(player.Height.Format())
	fmt.Println(player.Weight)
	fmt.Println(player.BirthDate.Format("2006-01-02"))
}
Output:

Connor McDavid
6' 1"
193
1997-01-13

func (*Client) GetPlayerStats

func (c *Client) GetPlayerStats(params *PlayerParams) ([]PlayerStatsForType, int)

Internally this method takes the retrieved player stats json from the api, unmarshals them, then reinserts into the parent struct. The parent struct holds an interface{} type and requires reflection to access the proper values of the stat. The proper types can be converted to using ConvertPlayerStatsToSkaterStats and ConvertStatsToGoalieStats.

Example (Goalie)

Example of retrieving Goalie Stats. Stats for Henrik Lundqvist save percentage and wins in the in progress 2018 season.

package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	playerParams := gonhl.NewPlayerParams().
		SetId(8468685).
		SetStat("vsConference", "vsDivision").
		SetSeason(2018)
	player, _ := client.GetPlayerStats(playerParams)
	fmt.Println(player[0].Type.DisplayName)
	playerStat, _ := gonhl.ConvertPlayerStatsToGoalieStats(player[0].Splits[0].Stat)
	fmt.Println(playerStat.SavePercentage > 0)
	fmt.Println(playerStat.Saves > 0)
}
Output:

vsConference
true
true
Example (Skater)

Example of retrieving Skater Stats. Stats for Connor McDavid point total in the 2017 season.

package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	playerParams := gonhl.NewPlayerParams().
		SetId(8478402).
		SetStat("statsSingleSeason").
		SetSeason(2017)
	player, _ := client.GetPlayerStats(playerParams)
	fmt.Println(player[0].Type.DisplayName)
	playerStat, _ := gonhl.ConvertPlayerStatsToSkaterStats(player[0].Splits[0].Stat)
	fmt.Println(player[0].Splits[0].Season)
	fmt.Println(playerStat.Points)
}
Output:

statsSingleSeason
20172018
108

func (*Client) GetPlayerStatsTypes

func (c *Client) GetPlayerStatsTypes() ([]string, int)

GetPlayerStatsTypes retrieves information about the various enums that can be used when retrieving player stats. Pass values retrieved from here to SetStat for PlayerParams.

func (*Client) GetProspect

func (c *Client) GetProspect(id int) (Prospect, int)

GetProspect retrieves information about a single NHL prospect using a prospect id.

Example

Example of retrieving a prospect. Prospect information for Connor McDavid.

package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	prospect, _ := client.GetProspect(54223)
	fmt.Println(prospect.FullName)
}
Output:

Connor Mcdavid

func (*Client) GetProspects

func (c *Client) GetProspects() ([]Prospect, int)

GetProspects retrieves information about all NHL prospects (beware large response).

func (*Client) GetRoster

func (c *Client) GetRoster(teamId int) (Roster, int)

GetRoster retrieves the current roster of an NHL team using a team ID. The same roster can be retrieved with the GetTeam(s) endpoints by using ShowTeamRoster() when building teamParams.

func (*Client) GetSchedule

func (c *Client) GetSchedule(params *ScheduleParams) (Schedule, int)

GetSchedule retrieves the NHL schedule based on ScheduleParams. If no parameters are passed, the NHL schedule for the current^ day is retrieved. ^ This may not be true, seems like sometimes the previous day schedule is returned, safest option is to pass a time.

Example

Example of retrieving a schedule. Be careful of dates as they may not be the same timezone.

package main

import (
	"fmt"
	"time"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	date, _ := time.Parse("2006-01-02", "2018-12-04")
	scheduleParams := gonhl.NewScheduleParams().
		SetDate(date).ShowTicketRetailers()
	schedule, _ := client.GetSchedule(scheduleParams)
	fmt.Println(schedule.Dates[0].Games[0].GameDate.Format("2006-01-02"))
	fmt.Println(schedule.Dates[0].Date.Format("2006-01-02"))
	fmt.Println(schedule.Dates[0].Games[0].Venue.Name)
	fmt.Println(schedule.Dates[0].Games[0].Teams.Home.Score)
	fmt.Println(schedule.Dates[0].Games[0].Teams.Away.Score)
	fmt.Println(len(schedule.Dates[0].Games[0].Tickets))
	fmt.Println(len(schedule.Dates[0].Games[0].Broadcasts))
}
Output:

2018-12-05
2018-12-04
BB&T Center
5
Boston Bruins
23
0

func (*Client) GetStandings

func (c *Client) GetStandings(params *StandingsParams) ([]Standings, int)

GetStandings retrieves the NHL schedule based on StandingsParams. If no parameters are passed, the current NHL standings are retrieved.

func (*Client) GetStandingsTypes

func (c *Client) GetStandingsTypes() ([]StandingsType, int)

GetStandingsTypes retrieves information about the various enums that can be used when retrieving NHL standings. Pass values retrieved from here to SetStandingsType for StandingsParams.

func (*Client) GetTeam

func (c *Client) GetTeam(params *TeamsParams) (Team, int)

GetTeam retrieves information about a single NHL team based on TeamsParams. A team Id must be set. If multiple Ids are set, only the first value is used. Stats must be casted to appropriate type. Types can be determined using the DisplayName.

Example

Example of retrieving a single team. Gets detailed roster, scheduling, and stats (values and rank) for the New York Islanders.

package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	//TODO want to validate schedule params
	client := gonhl.NewClient()
	teamsParams := gonhl.NewTeamsParams().
		ShowDetailedRoster().
		ShowScheduleNext().
		ShowSchedulePrev().
		ShowTeamStats().
		SetTeamIds(2)
	team, _ := client.GetTeam(teamsParams)
	fmt.Println(team.Name)
}
Output:

New York Islanders

func (*Client) GetTeamStats

func (c *Client) GetTeamStats(teamId int) ([]TeamStatsForType, int)

TODO Fix this, missing ranking stats GetTeamStats retrieves the current stats of an NHL team using a team ID. The same stats can be retrieved with the GetTeam(s) endpoints by using ShowTeamStats() when building teamParams. Stats must be casted to appropriate type. Types can be determined using the DisplayName.

Example
package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	teamStats, _ := client.GetTeamStats(1)
	fmt.Println(teamStats[0].Splits[0].Team.ID)
	fmt.Println(teamStats[0].Type.DisplayName)
	stats, _ := teamStats[0].Splits[0].Stat.(gonhl.TeamStats)
	fmt.Println(stats.Wins > 0)
	fmt.Println(teamStats[1].Type.DisplayName)
	ranks, _ := teamStats[1].Splits[0].Stat.(gonhl.TeamStatRanks)
	fmt.Println(ranks.Wins != "")
}
Output:

1
statsSingleSeason
true
regularSeasonStatRankings
true

func (*Client) GetTeams

func (c *Client) GetTeams(params *TeamsParams) ([]Team, int)

GetTeams retrieves information about NHL teams based on TeamsParams. If no parameters are passed, the current NHL teams with minimal information are retrieved. Stats must be casted to appropriate type. Types can be determined using the DisplayName.

Example

Example of retrieving multiple teams. Gets detailed roster, and stats (values and rank) for 3 NHL teams.

package main

import (
	"fmt"

	"github.com/henrymxu/gonhl"
)

func main() {
	client := gonhl.NewClient()
	teamsParams := gonhl.NewTeamsParams().
		ShowDetailedRoster().
		ShowTeamStats().
		SetTeamIds(1, 2, 3)
	teams, _ := client.GetTeams(teamsParams)
	fmt.Println(teams[0].Name)
	fmt.Println(teams[0].TeamStats[0].Type.DisplayName)
	fmt.Println(teams[0].Roster.Link)
	teamStat, _ := gonhl.ConvertTeamStatsToTeamStats(teams[0].TeamStats[0].Splits[0].Stat)
	fmt.Println(teamStat.GamesPlayed > 0)
	rankedStat, _ := gonhl.ConvertTeamStatsToTeamRanks(teams[0].TeamStats[0].Splits[1].Stat)
	fmt.Println(rankedStat.Wins != "")
}
Output:

New Jersey Devils
statsSingleSeason
/api/v1/teams/1/roster
true
true

type Coach

type Coach struct {
	Person   BasicPerson `json:"person"`
	Position Position    `json:"position"`
}

type Conference

type Conference struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	Link         string `json:"link"`
	Abbreviation string `json:"abbreviation"`
	ShortName    string `json:"shortName"`
	Active       bool   `json:"active"`
}

type Content

type Content struct {
	Link string `json:"link"`
}

type Contributor

type Contributor struct {
	Contributors []struct {
		Name    string `json:"name"`
		Twitter string `json:"twitter"`
	} `json:"contributors"`
	Source string `json:"source"`
}

type Decisions

type Decisions struct {
	Winner     BasicPerson `json:"winner"`
	Loser      BasicPerson `json:"loser"`
	FirstStar  BasicPerson `json:"firstStar"`
	SecondStar BasicPerson `json:"secondStar"`
	ThirdStar  BasicPerson `json:"thirdStar"`
}

type Diff

type Diff struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value string `json:"value,omitempty"`
}

type Division

type Division struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	NameShort    string `json:"nameShort"`
	Link         string `json:"link"`
	Abbreviation string `json:"abbreviation"`
	Conference   Conference
	Active       bool `json:"active"`
}

type Draft

type Draft struct {
	DraftYear int          `json:"draftYear"`
	Rounds    []DraftRound `json:"rounds"`
}

type DraftPick

type DraftPick struct {
	Year        int    `json:"year"`
	Round       string `json:"round"`
	PickOverall int    `json:"pickOverall"`
	PickInRound int    `json:"pickInRound"`
	Team        Team   `json:"team"`
	Prospect    Player `json:"prospect"`
}

type DraftRound

type DraftRound struct {
	RoundNumber int         `json:"roundNumber"`
	Round       string      `json:"round"`
	Picks       []DraftPick `json:"picks"`
}

type Epg

type Epg struct {
	Title     string    `json:"title"`
	Platform  string    `json:"platform"`
	Items     []EpgItem `json:"items"`
	TopicList string    `json:"topicList"`
}

type EpgItem

type EpgItem struct {
	GUID            string `json:"guid"`
	MediaState      string `json:"mediaState"`
	MediaPlaybackID string `json:"mediaPlaybackId"`
	MediaFeedType   string `json:"mediaFeedType"`
	CallLetters     string `json:"callLetters"`
	EventID         string `json:"eventId"`
	Language        string `json:"language"`
	FreeGame        bool   `json:"freeGame"`
	FeedName        string `json:"feedName"`
	GamePlus        bool   `json:"gamePlus"`
}

type Franchise

type Franchise struct {
	FranchiseID int    `json:"franchiseId"`
	TeamName    string `json:"teamName"`
	Link        string `json:"link"`
}

type Game

type Game struct {
	GamePk   int        `json:"gamePk"`
	Link     string     `json:"link"`
	GameType string     `json:"gameType"`
	Season   string     `json:"season"`
	GameDate time.Time  `json:"gameDate"`
	Status   GameStatus `json:"status"`
	Teams    struct {
		Away GameTeam `json:"away"`
		Home GameTeam `json:"home"`
	} `json:"teams"`
	Linescore       Linescore      `json:"linescore"`
	Venue           Venue          `json:"venue"`
	Tickets         []Ticket       `json:"tickets"`
	Broadcasts      []Broadcast    `json:"broadcasts"`
	RadioBroadcasts RadioBroadcast `json:"radioBroadcasts"`
	Content         Content        `json:"content"`
	Metadata        MetaData       `json:"metadata"`
}

func (Game) String

func (g Game) String() string

Create a neatly formatted string for a game. Not all information is included, key information included are: status, start time, teams, and id.

type GameContent

type GameContent struct {
	Link      string `json:"link"`
	Editorial struct {
		Preview struct {
			Title     string        `json:"title"`
			TopicList string        `json:"topicList"`
			Items     []PreviewItem `json:"items"`
		} `json:"preview"`
		Articles struct {
			Title     string        `json:"title"`
			TopicList string        `json:"topicList"`
			Items     []interface{} `json:"items"`
		} `json:"articles"`
		Recap struct {
			Title     string      `json:"title"`
			TopicList string      `json:"topicList"`
			Items     []RecapItem `json:"items"`
		} `json:"recap"`
	} `json:"editorial"`
	Media struct {
		Epg        []Epg `json:"epg"`
		Milestones struct {
			Title       string          `json:"title"`
			StreamStart string          `json:"streamStart"`
			Items       []MilestoneItem `json:"items"`
		} `json:"milestones"`
	} `json:"media"`
	Highlights struct {
		Scoreboard Highlight `json:"scoreboard"`
		GameCenter Highlight `json:"gameCenter"`
	} `json:"highlights"`
}

type GameData

type GameData struct {
	Game     GameHeader `json:"game"`
	Datetime struct {
		DateTime    time.Time `json:"dateTime"`
		EndDateTime time.Time `json:"endDateTime"`
	} `json:"datetime"`
	Status GameStatus `json:"status"`
	Teams  struct {
		Away Team `json:"away"`
		Home Team `json:"home"`
	} `json:"teams"`
	Players map[string]Skater `json:"players"`
	Venue   Venue             `json:"venue"`
}

type GameDay

type GameDay struct {
	Date         JsonDate      `json:"date"`
	TotalItems   int           `json:"totalItems"`
	TotalEvents  int           `json:"totalEvents"`
	TotalGames   int           `json:"totalGames"`
	TotalMatches int           `json:"totalMatches"`
	Games        []Game        `json:"games"`
	Events       []interface{} `json:"events"`
	Matches      []interface{} `json:"matches"`
}

type GameHeader

type GameHeader struct {
	Pk     int    `json:"pk"`
	Season string `json:"season"`
	Type   string `json:"type"`
}

type GameStatus

type GameStatus struct {
	AbstractGameState string `json:"abstractGameState"`
	CodedGameState    int    `json:"codedGameState,string"`
	DetailedState     string `json:"detailedState"`
	StatusCode        int    `json:"statusCode,string"`
	StartTimeTBD      bool   `json:"startTimeTBD"`
}

type GameTeam

type GameTeam struct {
	LeagueRecord LeagueRecord `json:"leagueRecord"`
	Score        int          `json:"score"`
	Team         Team         `json:"team"`
}

type GoalieGameStats

type GoalieGameStats struct {
	TimeOnIce                  string  `json:"timeOnIce"`
	Assists                    int     `json:"assists"`
	Goals                      int     `json:"goals"`
	Pim                        int     `json:"pim"`
	Shots                      int     `json:"shots"`
	Saves                      int     `json:"saves"`
	PowerPlaySaves             int     `json:"powerPlaySaves"`
	ShortHandedSaves           int     `json:"shortHandedSaves"`
	EvenSaves                  int     `json:"evenSaves"`
	ShortHandedShotsAgainst    int     `json:"shortHandedShotsAgainst"`
	EvenShotsAgainst           int     `json:"evenShotsAgainst"`
	PowerPlayShotsAgainst      int     `json:"powerPlayShotsAgainst"`
	SavePercentage             float64 `json:"savePercentage"`
	ShortHandedSavePercentage  float64 `json:"shortHandedSavePercentage"`
	EvenStrengthSavePercentage float64 `json:"evenStrengthSavePercentage"`
}

type GoalieStats

type GoalieStats struct {
	PlayerStats
	Ot                         int     `json:"ot"`
	Shutouts                   int     `json:"shutouts"`
	Ties                       int     `json:"ties"`
	Wins                       int     `json:"wins"`
	Losses                     int     `json:"losses"`
	Saves                      int     `json:"saves"`
	PowerPlaySaves             int     `json:"powerPlaySaves"`
	ShortHandedSaves           int     `json:"shortHandedSaves"`
	EvenSaves                  int     `json:"evenSaves"`
	ShortHandedShots           int     `json:"shortHandedShots"`
	EvenShots                  int     `json:"evenShots"`
	PowerPlayShots             int     `json:"powerPlayShots"`
	SavePercentage             float64 `json:"savePercentage"`
	GoalAgainstAverage         float64 `json:"goalAgainstAverage"`
	GamesStarted               int     `json:"gamesStarted"`
	ShotsAgainst               int     `json:"shotsAgainst"`
	GoalsAgainst               int     `json:"goalsAgainst"`
	PowerPlaySavePercentage    float64 `json:"powerPlaySavePercentage"`
	ShortHandedSavePercentage  float64 `json:"shortHandedSavePercentage"`
	EvenStrengthSavePercentage float64 `json:"evenStrengthSavePercentage"`
}

func ConvertPlayerStatsToGoalieStats

func ConvertPlayerStatsToGoalieStats(stats interface{}) (GoalieStats, bool)

ConvertPlayerStatsToGoalieStats attempts to cast an interface to the GoalieStats type. This is used to access the stats nested in the StatsSplit type for players.

type GoalieStatsByRank

type GoalieStatsByRank struct {
	ShotsAgainst        string `json:"shotsAgainst"`
	Ot                  string `json:"ot"`
	PenaltyMinutes      string `json:"penaltyMinutes"`
	TimeOnIce           string `json:"timeOnIce"`
	ShutOuts            string `json:"shutOuts"`
	Saves               string `json:"saves"`
	Losses              string `json:"losses"`
	GoalsAgainst        string `json:"goalsAgainst"`
	SavePercentage      string `json:"savePercentage"`
	Games               string `json:"games"`
	GoalsAgainstAverage string `json:"goalsAgainstAverage"`
	Wins                string `json:"wins"`
}

type GoalsBySituation

type GoalsBySituation struct {
	GoalsInFirstPeriod       int `json:"goalsInFirstPeriod"`
	GoalsInSecondPeriod      int `json:"goalsInSecondPeriod"`
	GoalsInThirdPeriod       int `json:"goalsInThirdPeriod"`
	GoalsInOvertime          int `json:"goalsInOvertime"`
	ShootOutGoals            int `json:"shootOutGoals"`
	ShootOutShots            int `json:"shootOutShots"`
	GoalsTrailingByOne       int `json:"goalsTrailingByOne"`
	GoalsTrailingByTwo       int `json:"goalsTrailingByTwo"`
	GoalsTrailingByThreePlus int `json:"goalsTrailingByThreePlus"`
	GoalsWhenTied            int `json:"goalsWhenTied"`
	GoalsLeadingByOne        int `json:"goalsLeadingByOne"`
	GoalsLeadingByTwo        int `json:"goalsLeadingByTwo"`
	GoalsLeadingByThreePlus  int `json:"goalsLeadingByThreePlus"`
	PenaltyGoals             int `json:"penaltyGoals"`
	PenaltyShots             int `json:"penaltyShots"`
}

GoalsBySituation holds all the relevant information for goalies and most information for skaters.

type Height

type Height struct {
	Feet   int
	Inches int
}

func (*Height) Format

func (h *Height) Format() string

func (*Height) MarshalJSON

func (h *Height) MarshalJSON() ([]byte, error)

func (*Height) UnmarshalJSON

func (h *Height) UnmarshalJSON(b []byte) error

type Highlight

type Highlight struct {
	Title     string      `json:"title"`
	TopicList string      `json:"topicList"`
	Items     []MediaItem `json:"items"`
}

type Image

type Image struct {
	Title   string                   `json:"title"`
	AltText string                   `json:"altText"`
	Cuts    map[string]ImageMetaData `json:"cuts"`
}

type ImageMetaData

type ImageMetaData struct {
	AspectRatio string `json:"aspectRatio"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	Src         string `json:"src"`
	At2X        string `json:"at2x"`
	At3X        string `json:"at3x"`
}

type IntermissionInfo

type IntermissionInfo struct {
	IntermissionTimeRemaining int  `json:"intermissionTimeRemaining"`
	IntermissionTimeElapsed   int  `json:"intermissionTimeElapsed"`
	InIntermission            bool `json:"inIntermission"`
}

type JsonDate

type JsonDate time.Time

Type alias for yyyy-mm-dd formatting

func (*JsonDate) Format

func (j *JsonDate) Format(s string) string

Format function for printing.

func (*JsonDate) MarshalJSON

func (j *JsonDate) MarshalJSON() ([]byte, error)

func (JsonDate) String

func (j JsonDate) String() string

Default string function (yyyy-mm-dd)

func (*JsonDate) UnmarshalJSON

func (j *JsonDate) UnmarshalJSON(b []byte) error

type Keyword

type Keyword struct {
	Type        string `json:"type"`
	Value       string `json:"value"`
	DisplayName string `json:"displayName"`
}

type League

type League struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Link string `json:"link"`
}

type LeagueRecord

type LeagueRecord struct {
	Wins   int    `json:"wins"`
	Losses int    `json:"losses"`
	Ot     int    `json:"ot"`
	Type   string `json:"type"`
}

type Linescore

type Linescore struct {
	CurrentPeriod              int      `json:"currentPeriod"`
	CurrentPeriodOrdinal       string   `json:"currentPeriodOrdinal"`
	CurrentPeriodTimeRemaining string   `json:"currentPeriodTimeRemaining"`
	Periods                    []Period `json:"periods"`
	ShootoutInfo               struct {
		Away TeamShootoutInfo `json:"away"`
		Home TeamShootoutInfo `json:"home"`
	} `json:"shootoutInfo"`
	Teams struct {
		Home LinescoreTeam `json:"home"`
		Away LinescoreTeam `json:"away"`
	} `json:"teams"`
	PowerPlayStrength string           `json:"powerPlayStrength"`
	HasShootout       bool             `json:"hasShootout"`
	IntermissionInfo  IntermissionInfo `json:"intermissionInfo"`
	PowerPlayInfo     PowerPlayInfo    `json:"powerPlayInfo"`
}

type LinescoreTeam

type LinescoreTeam struct {
	Team         Team `json:"team"`
	Goals        int  `json:"goals"`
	ShotsOnGoal  int  `json:"shotsOnGoal"`
	GoaliePulled bool `json:"goaliePulled"`
	NumSkaters   int  `json:"numSkaters"`
	PowerPlay    bool `json:"powerPlay"`
}

type LiveData

type LiveData struct {
	Plays     Plays     `json:"plays"`
	Linescore Linescore `json:"linescore"`
	Boxscore  Boxscore  `json:"boxscore"`
	Decisions Decisions `json:"decisions"`
}

type LiveFeed

type LiveFeed struct {
	GamePk   int    `json:"gamePk"`
	Link     string `json:"link"`
	MetaData struct {
		Wait      int    `json:"wait"`
		TimeStamp string `json:"timeStamp"`
	} `json:"metaData"`
	GameData GameData `json:"gameData"`
	LiveData LiveData `json:"liveData"`
}

type MediaItem

type MediaItem struct {
	Type            string     `json:"type"`
	ID              string     `json:"id"`
	Date            string     `json:"date"`
	Title           string     `json:"title"`
	Blurb           string     `json:"blurb"`
	Description     string     `json:"description"`
	Duration        string     `json:"duration"`
	AuthFlow        bool       `json:"authFlow"`
	MediaPlaybackID string     `json:"mediaPlaybackId"`
	MediaState      string     `json:"mediaState"`
	Keywords        []Keyword  `json:"keywords"`
	Image           Image      `json:"image"`
	Playbacks       []PlayBack `json:"playbacks"`
}

type MediaURLS

type MediaURLS struct {
	HTTPCLOUDMOBILE   string `json:"HTTP_CLOUD_MOBILE"`
	HTTPCLOUDTABLET   string `json:"HTTP_CLOUD_TABLET"`
	HTTPCLOUDTABLET60 string `json:"HTTP_CLOUD_TABLET_60"`
	HTTPCLOUDWIRED    string `json:"HTTP_CLOUD_WIRED"`
	HTTPCLOUDWIRED60  string `json:"HTTP_CLOUD_WIRED_60"`
	HTTPCLOUDWIREDWEB string `json:"HTTP_CLOUD_WIRED_WEB"`
	FLASH192K320X180  string `json:"FLASH_192K_320X180"`
	FLASH450K400X224  string `json:"FLASH_450K_400X224"`
	FLASH1200K640X360 string `json:"FLASH_1200K_640X360"`
	FLASH1800K960X540 string `json:"FLASH_1800K_960X540"`
}

type MetaData

type MetaData struct {
	IsManuallyScored bool `json:"isManuallyScored"`
	IsSplitSquad     bool `json:"isSplitSquad"`
}

type MilestoneItem

type MilestoneItem struct {
	Title        string    `json:"title"`
	Description  string    `json:"description"`
	Type         string    `json:"type"`
	TimeAbsolute string    `json:"timeAbsolute"`
	TimeOffset   string    `json:"timeOffset"`
	Period       string    `json:"period"`
	StatsEventID string    `json:"statsEventId"`
	TeamID       string    `json:"teamId"`
	PlayerID     string    `json:"playerId"`
	PeriodTime   string    `json:"periodTime"`
	OrdinalNum   string    `json:"ordinalNum"`
	Highlight    Highlight `json:"highlight"`
}

type Official

type Official struct {
	Official     BasicPerson `json:"official"`
	OfficialType string      `json:"officialType"`
}

type OnIcePlus

type OnIcePlus struct {
	PlayerID      int `json:"playerId"`
	ShiftDuration int `json:"shiftDuration"`
	Stamina       int `json:"stamina"`
}

type PenaltyBox

type PenaltyBox struct {
	ID            int    `json:"id"`
	TimeRemaining string `json:"timeRemaining"`
	Active        bool   `json:"active"`
}

type Period

type Period struct {
	PeriodType string         `json:"periodType"`
	StartTime  time.Time      `json:"startTime"`
	EndTime    time.Time      `json:"endTime"`
	Num        int            `json:"num"`
	OrdinalNum string         `json:"ordinalNum"`
	Home       PeriodTeamData `json:"home"`
	Away       PeriodTeamData `json:"away"`
}

type PeriodTeamData

type PeriodTeamData struct {
	Goals       int    `json:"goals"`
	ShotsOnGoal int    `json:"shotsOnGoal"`
	RinkSide    string `json:"rinkSide"`
}

type Play

type Play struct {
	Players []struct {
		Player     Player `json:"player"`
		PlayerType string `json:"playerType"`
	} `json:"players"`
	Result      Result `json:"result"`
	About       About  `json:"about"`
	Coordinates struct {
		X float64 `json:"x"`
		Y float64 `json:"y"`
	} `json:"coordinates"`
	Team Team `json:"team"`
}

type PlayBack

type PlayBack struct {
	Name   string `json:"name"`
	Width  string `json:"width"`
	Height string `json:"height"`
	URL    string `json:"url"`
}

type Player

type Player struct {
	ID                 int      `json:"id"`
	FullName           string   `json:"fullName"`
	Link               string   `json:"link"`
	FirstName          string   `json:"firstName"`
	LastName           string   `json:"lastName"`
	PrimaryNumber      int      `json:"primaryNumber,string"`
	BirthDate          JsonDate `json:"birthDate"`
	CurrentAge         int      `json:"currentAge"`
	BirthCity          string   `json:"birthCity"`
	BirthStateProvince string   `json:"birthStateProvince"`
	BirthCountry       string   `json:"birthCountry"`
	Nationality        string   `json:"nationality"`
	Height             Height   `json:"height,string"`
	Weight             int      `json:"weight"`
	Active             bool     `json:"active"`
	AlternateCaptain   bool     `json:"alternateCaptain"`
	Captain            bool     `json:"captain"`
	Rookie             bool     `json:"rookie"`
	ShootsCatches      string   `json:"shootsCatches"`
	RosterStatus       string   `json:"rosterStatus"`
	CurrentTeam        Team     `json:"currentTeam"`
	PrimaryPosition    Position `json:"primaryPosition"`
}

type PlayerParams

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

func NewPlayerParams

func NewPlayerParams() *PlayerParams

func (*PlayerParams) SetId

func (pParams *PlayerParams) SetId(id int) *PlayerParams

SetId specifies which player to include in response.

func (*PlayerParams) SetSeason

func (pParams *PlayerParams) SetSeason(season int) *PlayerParams

SetSeason specifies which season to use in response (use the year season started). The response will represent the player stats for that season.

func (*PlayerParams) SetStat

func (pParams *PlayerParams) SetStat(stat ...string) *PlayerParams

SetStat specifies which single season player stats to get.

type PlayerStats

type PlayerStats struct {
	TimeOnIce        string `json:"timeOnIce"`
	Games            int    `json:"games"`
	TimeOnIcePerGame string `json:"timeOnIcePerGame"`
}

PlayerStats holds values that are used in both SkaterStats and GoalieStats. Only used as an anonymous struct.

type PlayerStatsForType

type PlayerStatsForType struct {
	ID     int
	Type   StatType     `json:"type"`
	Splits []StatsSplit `json:"splits"`
}

type Plays

type Plays struct {
	AllPlays      []Play `json:"allPlays"`
	ScoringPlays  []int  `json:"scoringPlays"`
	PenaltyPlays  []int  `json:"penaltyPlays"`
	PlaysByPeriod []struct {
		StartIndex int   `json:"startIndex"`
		Plays      []int `json:"plays"`
		EndIndex   int   `json:"endIndex"`
	} `json:"playsByPeriod"`
	CurrentPlay Play `json:"currentPlay"`
}

type Position

type Position struct {
	Code         string `json:"code"`
	Name         string `json:"name"`
	Type         string `json:"type"`
	Abbreviation string `json:"abbreviation"`
}

type PowerPlayInfo

type PowerPlayInfo struct {
	SituationTimeRemaining int  `json:"situationTimeRemaining"`
	SituationTimeElapsed   int  `json:"situationTimeElapsed"`
	InSituation            bool `json:"inSituation"`
}

type PreviewItem

type PreviewItem struct {
	Type            string           `json:"type"`
	State           string           `json:"state"`
	Date            string           `json:"date"`
	ID              string           `json:"id"`
	Headline        string           `json:"headline"`
	Subhead         string           `json:"subhead"`
	SeoTitle        string           `json:"seoTitle"`
	SeoDescription  string           `json:"seoDescription"`
	SeoKeywords     string           `json:"seoKeywords"`
	Slug            string           `json:"slug"`
	Commenting      bool             `json:"commenting"`
	Tagline         string           `json:"tagline"`
	TokenData       map[string]Token `json:"tokenData"`
	Contributor     Contributor      `json:"contributor"`
	KeywordsDisplay []Keyword        `json:"keywordsDisplay"`
	KeywordsAll     []Keyword        `json:"keywordsAll"`
	Approval        string           `json:"approval"`
	URL             string           `json:"url"`
	DataURI         string           `json:"dataURI"`
	PrimaryKeyword  Keyword          `json:"primaryKeyword"`
	Media           struct {
		Type  string `json:"type"`
		Image Image  `json:"image"`
	} `json:"media"`
	Preview string `json:"preview"`
}

type Prospect

type Prospect struct {
	ID                 int              `json:"id"`
	FullName           string           `json:"fullName"`
	Link               string           `json:"link"`
	FirstName          string           `json:"firstName"`
	LastName           string           `json:"lastName"`
	BirthDate          string           `json:"birthDate"`
	BirthCity          string           `json:"birthCity"`
	BirthStateProvince string           `json:"birthStateProvince"`
	BirthCountry       string           `json:"birthCountry"`
	Height             string           `json:"height"`
	Weight             int              `json:"weight"`
	ShootsCatches      string           `json:"shootsCatches"`
	PrimaryPosition    Position         `json:"primaryPosition"`
	DraftStatus        string           `json:"draftStatus"`
	ProspectCategory   ProspectCategory `json:"prospectCategory"`
	AmateurTeam        Team             `json:"amateurTeam"`
	AmateurLeague      League           `json:"amateurLeague"`
	Ranks              ProspectRank     `json:"ranks"`
}

type ProspectCategory

type ProspectCategory struct {
	ID        int    `json:"id"`
	ShortName string `json:"shortName"`
	Name      string `json:"name"`
}

type ProspectRank

type ProspectRank struct {
	Midterm   int `json:"midterm"`
	FinalRank int `json:"finalRank"`
	DraftYear int `json:"draftYear"`
}

type RadioBroadcast

type RadioBroadcast struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type RecapItem

type RecapItem struct {
	Type            string           `json:"type"`
	State           string           `json:"state"`
	Date            string           `json:"date"`
	ID              string           `json:"id"`
	Headline        string           `json:"headline"`
	Subhead         string           `json:"subhead"`
	SeoTitle        string           `json:"seoTitle"`
	SeoDescription  string           `json:"seoDescription"`
	SeoKeywords     string           `json:"seoKeywords"`
	Slug            string           `json:"slug"`
	Commenting      bool             `json:"commenting"`
	Tagline         string           `json:"tagline"`
	TokenData       map[string]Token `json:"tokenData"`
	Contributor     Contributor      `json:"contributor"`
	KeywordsDisplay []Keyword        `json:"keywordsDisplay"`
	KeywordsAll     []Keyword        `json:"keywordsAll"`
	Approval        string           `json:"approval"`
	URL             string           `json:"url"`
	DataURI         string           `json:"dataURI"`
	PrimaryKeyword  Keyword          `json:"primaryKeyword"`
	Media           struct {
		Type  string `json:"type"`
		Image Image  `json:"image"`
	} `json:"media"`
	Preview string `json:"preview"`
}

type Result

type Result struct {
	Event       string `json:"event"`
	EventCode   string `json:"eventCode"`
	EventTypeID string `json:"eventTypeId"`
	Description string `json:"description"`
}

type Roster

type Roster struct {
	Roster []RosterPlayer `json:"roster"`
	Link   string         `json:"link"`
}

API Endpoint

type RosterPlayer

type RosterPlayer struct {
	Person       Player   `json:"person"`
	JerseyNumber int      `json:"jerseyNumber,string"`
	Position     Position `json:"position"`
}

type Schedule

type Schedule struct {
	TotalItems   int       `json:"totalItems"`
	TotalEvents  int       `json:"totalEvents"`
	TotalGames   int       `json:"totalGames"`
	TotalMatches int       `json:"totalMatches"`
	Wait         int       `json:"wait"`
	Dates        []GameDay `json:"dates"`
}

API endpoint

func (Schedule) String

func (s Schedule) String() string

Create a neatly formatted string for a schedule. The strings for each game for each day of the schedule are included.

type ScheduleParams

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

func NewScheduleParams

func NewScheduleParams() *ScheduleParams

func (*ScheduleParams) SetDate

func (sp *ScheduleParams) SetDate(date ...time.Time) *ScheduleParams

SetDate specifies a single date for the response or a range of dates for the response. Providing a single date will return the schedule for that date. Providing multiple dates will return the schedule for dates starting from the 1st date to the 2nd date.

func (*ScheduleParams) SetTeamId

func (sp *ScheduleParams) SetTeamId(teamId int) *ScheduleParams

SetTeamId limits the response to a specific team. Team ids can be found through the teams endpoint.

func (*ScheduleParams) ShowBroadcasts

func (sp *ScheduleParams) ShowBroadcasts() *ScheduleParams

ShowBroadcasts makes response include the broadcasts for games.

func (*ScheduleParams) ShowLinescore

func (sp *ScheduleParams) ShowLinescore() *ScheduleParams

ShowLinescore makes response include linescore for completed games.

func (*ScheduleParams) ShowTicketRetailers

func (sp *ScheduleParams) ShowTicketRetailers() *ScheduleParams

ShowTicketRetailers makes response include the different places to buy tickets for the upcoming games.

type Skater

type Skater struct {
	Person       Player   `json:"person"`
	JerseyNumber string   `json:"jerseyNumber"`
	Position     Position `json:"position"`
	Stats        struct {
		SkaterStats SkaterGameStats `json:"skaterStats"`
		GoalieStats GoalieGameStats `json:"goalieStats"`
	} `json:"stats"`
}

type SkaterGameStats

type SkaterGameStats struct {
	TimeOnIce            string `json:"timeOnIce"`
	Assists              int    `json:"assists"`
	Goals                int    `json:"goals"`
	Shots                int    `json:"shots"`
	Hits                 int    `json:"hits"`
	PowerPlayGoals       int    `json:"powerPlayGoals"`
	PowerPlayAssists     int    `json:"powerPlayAssists"`
	PenaltyMinutes       int    `json:"penaltyMinutes"`
	FaceOffWins          int    `json:"faceOffWins"`
	FaceoffTaken         int    `json:"faceoffTaken"`
	Takeaways            int    `json:"takeaways"`
	Giveaways            int    `json:"giveaways"`
	ShortHandedGoals     int    `json:"shortHandedGoals"`
	ShortHandedAssists   int    `json:"shortHandedAssists"`
	Blocked              int    `json:"blocked"`
	PlusMinus            int    `json:"plusMinus"`
	EvenTimeOnIce        string `json:"evenTimeOnIce"`
	PowerPlayTimeOnIce   string `json:"powerPlayTimeOnIce"`
	ShortHandedTimeOnIce string `json:"shortHandedTimeOnIce"`
}

type SkaterGoalsBySituation

type SkaterGoalsBySituation struct {
	GameWinningGoals int `json:"gameWinningGoals"`
	EmptyNetGoals    int `json:"emptyNetGoals"`
	GoalsBySituation
}

type SkaterStats

type SkaterStats struct {
	PlayerStats
	Assists                     int     `json:"assists"`
	Goals                       int     `json:"goals"`
	Pim                         int     `json:"pim"`
	Shots                       int     `json:"shots"`
	Hits                        int     `json:"hits"`
	PowerPlayGoals              int     `json:"powerPlayGoals"`
	PowerPlayPoints             int     `json:"powerPlayPoints"`
	PowerPlayTimeOnIce          string  `json:"powerPlayTimeOnIce"`
	EvenTimeOnIce               string  `json:"evenTimeOnIce"`
	PenaltyMinutes              int     `json:"penaltyMinutes,string"`
	FaceOffPct                  float64 `json:"faceOffPct"`
	ShotPct                     float64 `json:"shotPct"`
	GameWinningGoals            int     `json:"gameWinningGoals"`
	OverTimeGoals               int     `json:"overTimeGoals"`
	ShortHandedGoals            int     `json:"shortHandedGoals"`
	ShortHandedPoints           int     `json:"shortHandedPoints"`
	ShortHandedTimeOnIce        string  `json:"shortHandedTimeOnIce"`
	Blocked                     int     `json:"blocked"`
	PlusMinus                   int     `json:"plusMinus"`
	Points                      int     `json:"points"`
	Shifts                      int     `json:"shifts"`
	EvenTimeOnIcePerGame        string  `json:"evenTimeOnIcePerGame"`
	ShortHandedTimeOnIcePerGame string  `json:"shortHandedTimeOnIcePerGame"`
	PowerPlayTimeOnIcePerGame   string  `json:"powerPlayTimeOnIcePerGame"`
}

func ConvertPlayerStatsToSkaterStats

func ConvertPlayerStatsToSkaterStats(stats interface{}) (SkaterStats, bool)

ConvertPlayerStatsToSkaterStats attempts to cast an interface to the SkaterStats type. This is used to access the stats nested in the StatsSplit type for players.

type SkaterStatsByRank

type SkaterStatsByRank struct {
	RankPowerPlayGoals   string `json:"rankPowerPlayGoals"`
	RankBlockedShots     string `json:"rankBlockedShots"`
	RankAssists          string `json:"rankAssists"`
	RankShotPct          string `json:"rankShotPct"`
	RankGoals            string `json:"rankGoals"`
	RankHits             string `json:"rankHits"`
	RankPenaltyMinutes   string `json:"rankPenaltyMinutes"`
	RankShortHandedGoals string `json:"rankShortHandedGoals"`
	RankPlusMinus        string `json:"rankPlusMinus"`
	RankShots            string `json:"rankShots"`
	RankPoints           string `json:"rankPoints"`
	RankOvertimeGoals    string `json:"rankOvertimeGoals"`
	RankGamesPlayed      string `json:"rankGamesPlayed"`
}

type Standings

type Standings struct {
	StandingsType string       `json:"standingsType"`
	League        League       `json:"league"`
	Division      Division     `json:"division"`
	Conference    Conference   `json:"conference"`
	TeamRecords   []TeamRecord `json:"teamRecords"`
}

type StandingsParams

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

func NewStandingsParams

func NewStandingsParams() *StandingsParams

func (*StandingsParams) SetDate

func (sp *StandingsParams) SetDate(date time.Time) *StandingsParams

SetDate specifies which date to use in response. The response will represent the standings on that date.

func (*StandingsParams) SetSeason

func (sp *StandingsParams) SetSeason(season int) *StandingsParams

SetSeason specifies which season to use in response (use the year season started). The response will represent the standings for that season.

func (*StandingsParams) SetStandingsType

func (sp *StandingsParams) SetStandingsType(standingsType string) *StandingsParams

SetStandingsType specifies which standing type to use. Retrieve Standings Types from GetStandingsTypes endpoint

func (*StandingsParams) ShowDetailedRecords

func (sp *StandingsParams) ShowDetailedRecords() *StandingsParams

ShowDetailedRecords makes response include detailed information for each team. This includes home and away records, record in shootouts, last ten games, and split head-to-head records against divisions and conferences.

type StandingsType

type StandingsType struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type StatSplitIdentifier

type StatSplitIdentifier struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Link string `json:"link"`
}

type StatType

type StatType struct {
	DisplayName string `json:"displayName"`
}

type StatsSplit

type StatsSplit struct {
	Stat interface{} `json:"stat"`
	// contains filtered or unexported fields
}

type Streak

type Streak struct {
	StreakType   string `json:"streakType"`
	StreakNumber int    `json:"streakNumber"`
	StreakCode   string `json:"streakCode"`
}

type Team

type Team struct {
	TeamStats []TeamStatsForType `json:"teamStats"`
	// contains filtered or unexported fields
}

type TeamRecord

type TeamRecord struct {
	Team           Team         `json:"team"`
	LeagueRecord   LeagueRecord `json:"leagueRecord"`
	GoalsAgainst   int          `json:"goalsAgainst"`
	GoalsScored    int          `json:"goalsScored"`
	Points         int          `json:"points"`
	DivisionRank   string       `json:"divisionRank"`
	ConferenceRank string       `json:"conferenceRank"`
	LeagueRank     string       `json:"leagueRank"`
	WildCardRank   string       `json:"wildCardRank"`
	Row            int          `json:"row"`
	GamesPlayed    int          `json:"gamesPlayed"`
	Streak         Streak       `json:"streak"`
	LastUpdated    time.Time    `json:"lastUpdated"`
}

type TeamShootoutInfo

type TeamShootoutInfo struct {
	Scores   int `json:"scores"`
	Attempts int `json:"attempts"`
}

type TeamSkaterStats

type TeamSkaterStats struct {
	Goals                  int     `json:"goals"`
	Pim                    int     `json:"pim"`
	Shots                  int     `json:"shots"`
	PowerPlayPercentage    string  `json:"powerPlayPercentage"`
	PowerPlayGoals         float64 `json:"powerPlayGoals"`
	PowerPlayOpportunities float64 `json:"powerPlayOpportunities"`
	FaceOffWinPercentage   string  `json:"faceOffWinPercentage"`
	Blocked                int     `json:"blocked"`
	Takeaways              int     `json:"takeaways"`
	Giveaways              int     `json:"giveaways"`
	Hits                   int     `json:"hits"`
}

type TeamStatRanks

type TeamStatRanks struct {
	Wins                     string `json:"wins"`
	Losses                   string `json:"losses"`
	Ot                       string `json:"ot"`
	Pts                      string `json:"pts"`
	PtPctg                   string `json:"ptPctg"`
	GoalsPerGame             string `json:"goalsPerGame"`
	GoalsAgainstPerGame      string `json:"goalsAgainstPerGame"`
	EvGGARatio               string `json:"evGGARatio"`
	PowerPlayPercentage      string `json:"powerPlayPercentage"`
	PowerPlayGoals           string `json:"powerPlayGoals"`
	PowerPlayGoalsAgainst    string `json:"powerPlayGoalsAgainst"`
	PowerPlayOpportunities   string `json:"powerPlayOpportunities"`
	PenaltyKillOpportunities string `json:"penaltyKillOpportunities"`
	PenaltyKillPercentage    string `json:"penaltyKillPercentage"`
	ShotsPerGame             string `json:"shotsPerGame"`
	ShotsAllowed             string `json:"shotsAllowed"`
	WinScoreFirst            string `json:"winScoreFirst"`
	WinOppScoreFirst         string `json:"winOppScoreFirst"`
	WinLeadFirstPer          string `json:"winLeadFirstPer"`
	WinLeadSecondPer         string `json:"winLeadSecondPer"`
	WinOutshootOpp           string `json:"winOutshootOpp"`
	WinOutshotByOpp          string `json:"winOutshotByOpp"`
	FaceOffsTaken            string `json:"faceOffsTaken"`
	FaceOffsWon              string `json:"faceOffsWon"`
	FaceOffsLost             string `json:"faceOffsLost"`
	FaceOffWinPercentage     string `json:"faceOffWinPercentage"`
	SavePctRank              string `json:"savePctRank"`
	ShootingPctRank          string `json:"shootingPctRank"`
}

func ConvertTeamStatsToTeamRanks

func ConvertTeamStatsToTeamRanks(stats interface{}) (TeamStatRanks, bool)

ConvertTeamStatsToTeamRanks attempts to cast an interface to the TeamStatRanks type. This is used to access the stats nested in the TeamStatsSplit type.

type TeamStats

type TeamStats struct {
	GamesPlayed            int     `json:"gamesPlayed"`
	Wins                   int     `json:"wins"`
	Losses                 int     `json:"losses"`
	Ot                     int     `json:"ot"`
	Pts                    int     `json:"pts"`
	PtPctg                 float64 `json:"ptPctg,string"`
	GoalsPerGame           float64 `json:"goalsPerGame"`
	GoalsAgainstPerGame    float64 `json:"goalsAgainstPerGame"`
	EvGGARatio             float64 `json:"evGGARatio"`
	PowerPlayPercentage    float64 `json:"powerPlayPercentage,string"`
	PowerPlayGoals         float64 `json:"powerPlayGoals"`
	PowerPlayGoalsAgainst  float64 `json:"powerPlayGoalsAgainst"`
	PowerPlayOpportunities float64 `json:"powerPlayOpportunities"`
	PenaltyKillPercentage  float64 `json:"penaltyKillPercentage,string"`
	ShotsPerGame           float64 `json:"shotsPerGame"`
	ShotsAllowed           float64 `json:"shotsAllowed"`
	WinScoreFirst          float64 `json:"winScoreFirst"`
	WinOppScoreFirst       float64 `json:"winOppScoreFirst"`
	WinLeadFirstPer        float64 `json:"winLeadFirstPer"`
	WinLeadSecondPer       float64 `json:"winLeadSecondPer"`
	WinOutshootOpp         float64 `json:"winOutshootOpp"`
	WinOutshotByOpp        float64 `json:"winOutshotByOpp"`
	FaceOffsTaken          float64 `json:"faceOffsTaken"`
	FaceOffsWon            float64 `json:"faceOffsWon"`
	FaceOffsLost           float64 `json:"faceOffsLost"`
	FaceOffWinPercentage   float64 `json:"faceOffWinPercentage,string"`
	ShootingPctg           float64 `json:"shootingPctg"`
	SavePctg               float64 `json:"savePctg"`
}

func ConvertTeamStatsToTeamStats

func ConvertTeamStatsToTeamStats(stats interface{}) (TeamStats, bool)

ConvertTeamStatsToTeamStats attempts to cast an interface to the TeamStats type. This is used to access the stats nested in the TeamStatsSplit type.

type TeamStatsForType

type TeamStatsForType struct {
	Type   StatType         `json:"type"`
	Splits []TeamStatsSplit `json:"splits"`
}

type TeamStatsSplit

type TeamStatsSplit struct {
	Stat interface{} `json:"stat"`
	Team Team        `json:"team"`
}

type TeamsParams

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

func NewTeamsParams

func NewTeamsParams() *TeamsParams

func (*TeamsParams) SetSeason

func (tParams *TeamsParams) SetSeason(season int) *TeamsParams

SetSeason specifies which season to use in response (use the year season started). The response will represent the roster for that season.

func (*TeamsParams) SetStatsType

func (tParams *TeamsParams) SetStatsType(statsType string) *TeamsParams

SetStatsType specifies which team stats to get. Retrieve Standings Types from <TBD> endpoint.

func (*TeamsParams) SetTeamIds

func (tParams *TeamsParams) SetTeamIds(ids ...int) *TeamsParams

SetTeamIds specifies which teams to include in response. Can string team id together to get multiple teams.

func (*TeamsParams) ShowDetailedRoster

func (tParams *TeamsParams) ShowDetailedRoster() *TeamsParams

ShowDetailedRoster makes response include the roster of active players for teams.

func (*TeamsParams) ShowScheduleNext

func (tParams *TeamsParams) ShowScheduleNext() *TeamsParams

ShowScheduleNext makes response include details of the upcoming games for teams.

func (*TeamsParams) ShowSchedulePrev

func (tParams *TeamsParams) ShowSchedulePrev() *TeamsParams

ShowSchedulePrev makes response include details of the previous games for teams.

func (*TeamsParams) ShowTeamStats

func (tParams *TeamsParams) ShowTeamStats() *TeamsParams

ShowTeamStats makes response include the teams stats for the season.

type Ticket

type Ticket struct {
	TicketType string `json:"ticketType"`
	TicketLink string `json:"ticketLink"`
}

type Token

type Token struct {
	// Token 1
	TokenGUID string `json:"tokenGUID"`
	Type      string `json:"type"`
	VideoID   string `json:"videoId"`
	Href      string `json:"href"`
	Tags      []struct {
		Type        string `json:"@type"`
		Value       string `json:"@value"`
		DisplayName string `json:"@displayName"`
	} `json:"tags"`
	Date            string    `json:"date"`
	Headline        string    `json:"headline"`
	Duration        string    `json:"duration"`
	Blurb           string    `json:"blurb"`
	BigBlurb        string    `json:"bigBlurb"`
	MediaPlaybackID string    `json:"mediaPlaybackId"`
	Image           Image     `json:"image"`
	MediaURLS       MediaURLS `json:"mediaURLS"`

	// Token 2
	ID       string `json:"id"`
	TeamID   string `json:"teamId"`
	Position string `json:"position"`
	Name     string `json:"name"`
	SeoName  string `json:"seoName"`

	// Token 3
	HrefMobile string `json:"hrefMobile"`
}

type Venue

type Venue struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Link     string `json:"link"`
	City     string `json:"city"`
	TimeZone struct {
		ID     string `json:"id"`
		Offset int    `json:"offset"`
		Tz     string `json:"tz"`
	} `json:"timeZone"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL