diff --git a/cmd/internal/statsapi/feed.go b/cmd/internal/statsapi/feed.go deleted file mode 100644 index f81b06c..0000000 --- a/cmd/internal/statsapi/feed.go +++ /dev/null @@ -1,74 +0,0 @@ -/* -Copyright © 2024 filifa - -This program is free software: you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation, either version 3 of the License, or (at your option) any later -version. - -This program is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ -package statsapi - -import ( - "encoding/json" -) - -type Feed struct { - MetaData metadata - LiveData livedata -} - -type metadata struct { - TimeStamp string -} - -type livedata struct { - Plays plays - Linescore linescore -} - -type linescore struct { - Teams teams -} - -type teams struct { - Home team - Away team -} - -type team struct { - Runs json.Number -} - -type plays struct { - AllPlays []Play - CurrentPlay Play -} - -type Play struct { - Result result - About about - AtBatIndex int -} - -type result struct { - Event string - Description string - RBI int - AwayScore int - HomeScore int -} - -type about struct { - AtBatIndex json.Number - IsTopInning bool - Inning json.Number - IsScoringPlay bool - CaptivatingIndex json.Number -} diff --git a/cmd/subscribe.go b/cmd/subscribe.go index 474e669..4498be8 100644 --- a/cmd/subscribe.go +++ b/cmd/subscribe.go @@ -30,6 +30,14 @@ import ( var gamePk int +type Feed struct { + MetaData metadata +} + +type metadata struct { + TimeStamp string +} + func patch(feedResp []byte, gamePk, ts, updateId string) ([]byte, error) { diffPatchResp, err := statsapi.RequestDiffPatch(gamePk, ts, updateId) if err != nil { @@ -74,7 +82,7 @@ func handleUnexpectedClose(gamePk string) (*statsapi.GamedayWebsocket, []byte, e } func updateFeed(ws *statsapi.GamedayWebsocket, feedResp []byte, gamePk string) ([]byte, error) { - var feed statsapi.Feed + var feed Feed err := json.Unmarshal(feedResp, &feed) if err != nil { return nil, err