nhl

package module
v0.0.0-...-828eda4 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bold

func Bold(s string) string

func DisplayContent

func DisplayContent(headerContent, s string)

func ParameterQuery

func ParameterQuery(p *Params) (string, error)

ParameterQuery is used as modifiers for requests

func Strikethrough

func Strikethrough(s string) string

func SubtleText

func SubtleText(s string) string

func Underline

func Underline(s string) string

Types

type Away

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

type Client

type Client struct {
	// Services used for talking to different parts of the NHL API API
	Schedules *SchedulesService
	Teams     *TeamsService
	// contains filtered or unexported fields
}

Client struct is used to create a new NHL API endpoint

func NewClient

func NewClient(apiurl string, httpClient *http.Client) (*Client, error)

NewClient returns a new NHL API API client

func (*Client) SetDebug

func (c *Client) SetDebug(b bool)

SetDebug is used to toggle debugging, set to true for debug

func (*Client) SetToken

func (c *Client) SetToken(token string)

SetToken is used to set the http token bearer for interaction with the API

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(u string)

SetUserAgent is used to set the user agent for interaction with the API

type Conference

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

type Content

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

type Dates

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

type Division

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

type Franchise

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

type Game

type Game struct {
	GameDate time.Time `json:"gameDate"`
	GameType string    `json:"gameType"`
	Season   string    `json:"season"`
	Link     string    `json:"link"`
	Content  Content   `json:"content"`
	Status   Status    `json:"status"`
	Venue    Venue     `json:"venue,omitempty"`
	Teams    struct {
		Away Away `json:"away"`
		Home Home `json:"home"`
	} `json:"teams"`
	GamePk int `json:"gamePk"`
}

type Home

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

type LeagueRecord

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

type MetaData

type MetaData struct {
	TimeStamp string `json:"timeStamp"`
}

type Params

type Params struct {
	Expand    string `schema:"expand,omitempty"`
	TeamID    string `schema:"teamId,omitempty"`
	StartDate string `schema:"startDate,omitempty"`
	Date      string `schema:"date,omitempty"`
	EndDate   string `schema:"endDate,omitempty"`
}

type ScheduleFilter

type ScheduleFilter struct {
	Expand    string `schema:"expand"`
	TeamID    string `schema:"teamId"`
	StartDate string `schema:"startDate"`
	Date      string `schema:"date"`
	EndDate   string `schema:"endDate"`
}

type Schedules

type Schedules struct {
	Copyright    string   `json:"copyright"`
	MetaData     MetaData `json:"metaData"`
	Dates        []Dates  `json:"dates"`
	TotalEvents  int      `json:"totalEvents"`
	TotalGames   int      `json:"totalGames"`
	TotalMatches int      `json:"totalMatches"`
	Wait         int      `json:"wait"`
	TotalItems   int      `json:"totalItems"`
}

type SchedulesService

type SchedulesService service

func (*SchedulesService) List

func (s *SchedulesService) List(ctx context.Context, p *Params) (*Schedules, error)

List L2 domains. cendot.Params are used to list L2 domains based on odata queries.

type Status

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

type Team

type Team struct {
	ShortName       string     `json:"shortName,omitempty"`
	Name            string     `json:"name"`
	Link            string     `json:"link"`
	Abbreviation    string     `json:"abbreviation,omitempty"`
	TeamName        string     `json:"teamName,omitempty"`
	LocationName    string     `json:"locationName,omitempty"`
	FirstYearOfPlay string     `json:"firstYearOfPlay,omitempty"`
	OfficialSiteURL string     `json:"officialSiteUrl,omitempty"`
	Division        Division   `json:"division,omitempty"`
	Conference      Conference `json:"conference,omitempty"`
	Franchise       Franchise  `json:"franchise,omitempty"`
	Venue           Venue      `json:"venue,omitempty"`
	ID              int        `json:"id"`
	FranchiseID     int        `json:"franchiseId,omitempty"`
	Active          bool       `json:"active,omitempty"`
}

type Teams

type Teams struct {
	Copyright string `json:"copyright"`
	Teams     []Team `json:"teams"`
}

type TeamsService

type TeamsService service

func (*TeamsService) List

func (s *TeamsService) List(ctx context.Context, p *Params) (*Teams, error)

List teams. Params are used to filter results.

type TimeZone

type TimeZone struct {
	ID     string `json:"id"`
	TZ     string `json:"tz"`
	Offset int    `json:"offset"`
}

type Venue

type Venue struct {
	Name     string   `json:"name"`
	Link     string   `json:"link"`
	City     string   `json:"city,omitempty"`
	TimeZone TimeZone `json:"timeZone,omitempty"`
	ID       int      `json:"id"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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