change names
This commit is contained in:
@@ -8,16 +8,16 @@ import (
|
||||
|
||||
var DefaultClient = NewClient(http.DefaultClient)
|
||||
|
||||
func Schedule(sportId, teamId string) ([]byte, error) {
|
||||
return DefaultClient.Schedule(sportId, teamId)
|
||||
func RequestSchedule(sportId, teamId string) ([]byte, error) {
|
||||
return DefaultClient.RequestSchedule(sportId, teamId)
|
||||
}
|
||||
|
||||
func Feed(gamePk string) ([]byte, error) {
|
||||
return DefaultClient.Feed(gamePk)
|
||||
func RequestFeed(gamePk string) ([]byte, error) {
|
||||
return DefaultClient.RequestFeed(gamePk)
|
||||
}
|
||||
|
||||
func DiffPatch(gamePk, startTimecode, pushUpdateId string) ([]byte, error) {
|
||||
return DefaultClient.DiffPatch(gamePk, startTimecode, pushUpdateId)
|
||||
func RequestDiffPatch(gamePk, startTimecode, pushUpdateId string) ([]byte, error) {
|
||||
return DefaultClient.RequestDiffPatch(gamePk, startTimecode, pushUpdateId)
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
@@ -35,7 +35,7 @@ func NewClient(c *http.Client) *Client {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) Schedule(sportId, teamId string) ([]byte, error) {
|
||||
func (c *Client) RequestSchedule(sportId, teamId string) ([]byte, error) {
|
||||
endpoint := url.URL{Path: "api/v1/schedule"}
|
||||
query := endpoint.Query()
|
||||
query.Add("sportId", sportId)
|
||||
@@ -47,14 +47,14 @@ func (c *Client) Schedule(sportId, teamId string) ([]byte, error) {
|
||||
return c.get(url.String())
|
||||
}
|
||||
|
||||
func (c *Client) Feed(gamePk string) ([]byte, error) {
|
||||
func (c *Client) RequestFeed(gamePk string) ([]byte, error) {
|
||||
endpoint := url.URL{Path: "api/v1.1/game/" + gamePk + "/feed/live"}
|
||||
url := c.baseURL.ResolveReference(&endpoint)
|
||||
|
||||
return c.get(url.String())
|
||||
}
|
||||
|
||||
func (c *Client) DiffPatch(gamePk, startTimecode, pushUpdateId string) ([]byte, error) {
|
||||
func (c *Client) RequestDiffPatch(gamePk, startTimecode, pushUpdateId string) ([]byte, error) {
|
||||
endpoint := url.URL{Path: "api/v1.1/game/" + gamePk + "/feed/live/diffPatch"}
|
||||
query := endpoint.Query()
|
||||
query.Add("language", "en")
|
||||
|
||||
@@ -2,17 +2,13 @@ package statsapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type FeedParams struct {
|
||||
GamePk string
|
||||
}
|
||||
|
||||
type FeedResponse map[string]any
|
||||
type Feed map[string]any
|
||||
|
||||
type Play struct {
|
||||
Result result
|
||||
|
||||
@@ -9,7 +9,7 @@ type ScheduleParams struct {
|
||||
TeamId string
|
||||
}
|
||||
|
||||
type ScheduleResponse struct {
|
||||
type Schedule struct {
|
||||
TotalGames json.Number
|
||||
TotalGamesInProgress json.Number
|
||||
Dates []date
|
||||
|
||||
Reference in New Issue
Block a user