statsapi

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 4 Imported by: 0

README

go-statsapi

Golang client for MLB Stats API.

Getting Started

package main

import (
    "fmt"
    "github.com/prs-watch/go-statsapi"
)

func main() {
    params := new(statsapi.Params)
    params.Season = "2019"
    params.TeamID = "143"

    atts := statsapi.Attendance(params)
    fmt.Println(atts)
}

Installation

go get github.com/prs-watch/go-statsapi

Functions

  • statsapi.Attendance()
    • get attendance data.
  • statsapi.Awards()
    • get list of awardIds.
  • statsapi.AwardRecips()
    • get recipients by award you pass as method param.
  • statsapi.Divisions()
    • get list of MLB and MiLB divisions.
  • statsapi.Roster()
    • get team roster.
  • statsapi.BoxScore()
    • get specific game's boxscore.
  • statsapi.LineScore()
    • get specific game's linescore.
  • statsapi.Standings()
    • get standings.
  • statsapi.TeamLeaders()
    • get team leaders of given stat.
  • statsapi.LeagueLeaders()
    • get league leaders of given stat.
  • statsapi.PlayerInfo()
    • get specific player's info.
  • statsapi.PlayByPlay()
    • get specific game's play-by-play.

Documentation

Index

Constants

View Source
const (
	BaseURL = "https://statsapi.mlb.com/api"
	Ver     = "v1"
)

consts

Variables

This section is empty.

Functions

func Attendance

func Attendance(params *Params) (body string, err error)

Attendance : get attendance.

func AwardRecips

func AwardRecips(awardID string, params *Params) (body string, err error)

AwardRecips : get each award recipients.

func Awards

func Awards(params *Params) (body string, err error)

Awards : get awards list.

func BoxScore

func BoxScore(gamePK string, params *Params) (body string, err error)

BoxScore : get specific game's boxscore.

func Divisions

func Divisions(params *Params) (body string, err error)

Divisions : get division list.

func LeagueLeaders added in v0.0.2

func LeagueLeaders(params *Params) (body string, err error)

LeagueLeaders : get league leaders of given stat.

func LineScore added in v0.0.2

func LineScore(gamePK string, params *Params) (body string, err error)

LineScore : get specific game's linescore.

func PlayByPlay added in v0.0.2

func PlayByPlay(gamePK string, params *Params) (body string, err error)

PlayByPlay : get specific game's play-by-play.

func PlayerInfo added in v0.0.2

func PlayerInfo(personID string, params *Params) (body string, err error)

PlayerInfo : get specific player's info.

func Roster

func Roster(teamID string, params *Params) (body string, err error)

Roster : get team roster.

func Standings added in v0.0.2

func Standings(params *Params) (body string, err error)

Standings : get standings.

func TeamLeaders added in v0.0.2

func TeamLeaders(teamID string, params *Params) (body string, err error)

TeamLeaders : get team leaders of given stat.

Types

type Params

type Params struct {
	TeamID           string
	LeagueID         string
	LeagueListid     string
	Season           string
	Date             string
	GameType         string
	Fields           string
	SportsID         string
	Hydrate          string
	DivisionID       string
	RosterType       string
	Timecode         string
	StandingsType    string
	LeaderCategories string
	LeaderGameTypes  string
	PlayerPool       string
	StatGroup        string
	StatType         string
}

Params object

Jump to

Keyboard shortcuts

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