start reorg
This commit is contained in:
parent
d4297bd7b1
commit
137400f3fb
|
@ -1 +1 @@
|
||||||
mlblive
|
mlbstats
|
||||||
|
|
|
@ -22,7 +22,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
"scm.dairydemon.net/filifa/mlbstats/cmd/internal/statsapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func content(cmd *cobra.Command, args []string) {
|
func content(cmd *cobra.Command, args []string) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
"scm.dairydemon.net/filifa/mlbstats/cmd/internal/statsapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func feed(cmd *cobra.Command, args []string) {
|
func feed(cmd *cobra.Command, args []string) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
"scm.dairydemon.net/filifa/mlbstats/cmd/internal/statsapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
var leagueIDs = map[string]statsapi.LeagueID{
|
var leagueIDs = map[string]statsapi.LeagueID{
|
||||||
|
|
|
@ -17,12 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"encoding/json"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
"github.com/antihax/optional"
|
||||||
|
"scm.dairydemon.net/filifa/mlbstats/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
var date string
|
var date string
|
||||||
|
@ -30,19 +32,30 @@ var team teamAbbr
|
||||||
var sport = sportAbbr("mlb")
|
var sport = sportAbbr("mlb")
|
||||||
|
|
||||||
func schedule(cmd *cobra.Command, args []string) {
|
func schedule(cmd *cobra.Command, args []string) {
|
||||||
teamId := ""
|
var teamIds []int32
|
||||||
if team != "" {
|
if team != "" {
|
||||||
teamId = strconv.Itoa(int(teamIDs[string(team)]))
|
teamIds = append(teamIds, int32(teamIDs[string(team)]))
|
||||||
}
|
}
|
||||||
|
|
||||||
sportId := strconv.Itoa(int(sportIDs[string(sport)]))
|
sportId := int32(sportIDs[string(sport)])
|
||||||
|
|
||||||
sched, err := statsapi.RequestSchedule(sportId, teamId, date)
|
opts := api.ScheduleApiScheduleOpts{
|
||||||
|
TeamId: optional.NewInterface(teamIds),
|
||||||
|
SportId: optional.NewInterface([]int32{sportId}),
|
||||||
|
}
|
||||||
|
|
||||||
|
client := api.NewAPIClient(api.NewConfiguration())
|
||||||
|
sched, _, err := client.ScheduleApi.Schedule(context.Background(), false, &opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(string(sched))
|
json, err := json.Marshal(sched)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(string(json))
|
||||||
}
|
}
|
||||||
|
|
||||||
// scheduleCmd represents the schedule command
|
// scheduleCmd represents the schedule command
|
||||||
|
|
|
@ -18,7 +18,7 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
"scm.dairydemon.net/filifa/mlbstats/cmd/internal/statsapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
var sportIDs = map[string]statsapi.SportID{
|
var sportIDs = map[string]statsapi.SportID{
|
||||||
|
|
|
@ -17,25 +17,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
"github.com/antihax/optional"
|
||||||
|
"scm.dairydemon.net/filifa/mlbstats/api"
|
||||||
|
"scm.dairydemon.net/filifa/mlbstats/api/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
var league leagueAbbr
|
var league leagueAbbr
|
||||||
|
|
||||||
func standings(cmd *cobra.Command, args []string) {
|
func standings(cmd *cobra.Command, args []string) {
|
||||||
leagueId := strconv.Itoa(int(leagueIDs[string(league)]))
|
var leagueIds []int32
|
||||||
|
leagueIds = append(leagueIds, int32(leagueIDs[string(league)]))
|
||||||
|
|
||||||
standing, err := statsapi.RequestStandings(leagueId)
|
opts := api.StandingsApiStandings1Opts{
|
||||||
|
LeagueId: optional.NewInterface(leagueIds),
|
||||||
|
}
|
||||||
|
|
||||||
|
client := api.NewAPIClient(api.NewConfiguration())
|
||||||
|
standing, _, err := client.StandingsApi.Standings1(context.Background(),string(models.REGULAR_SEASON_StandingsType), &opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(string(standing))
|
json, err := json.Marshal(standing)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(string(json))
|
||||||
}
|
}
|
||||||
|
|
||||||
// standingsCmd represents the standings command
|
// standingsCmd represents the standings command
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
"scm.dairydemon.net/filifa/mlbstats/cmd/internal/statsapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
var gamePk int
|
var gamePk int
|
||||||
|
|
|
@ -18,7 +18,7 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
"scm.dairydemon.net/filifa/mlbstats/cmd/internal/statsapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
var teamIDs = map[string]statsapi.TeamID{
|
var teamIDs = map[string]statsapi.TeamID{
|
||||||
|
|
13
go.mod
13
go.mod
|
@ -1,12 +1,17 @@
|
||||||
module scm.dairydemon.net/filifa/mlblive
|
module scm.dairydemon.net/filifa/mlbstats
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
|
github.com/antihax/optional v1.0.0
|
||||||
github.com/gorilla/websocket v1.5.3 // indirect
|
github.com/evanphx/json-patch/v5 v5.9.0
|
||||||
|
github.com/gorilla/websocket v1.5.3
|
||||||
|
github.com/spf13/cobra v1.8.1
|
||||||
|
golang.org/x/oauth2 v0.29.0
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/spf13/cobra v1.8.1 // indirect
|
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
5
go.sum
5
go.sum
|
@ -1,6 +1,9 @@
|
||||||
|
github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=
|
||||||
|
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=
|
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=
|
||||||
github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
|
github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
|
||||||
|
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
|
@ -12,5 +15,7 @@ github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
|
||||||
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
golang.org/x/oauth2 v0.29.0 h1:WdYw2tdTK1S8olAzWHdgeqfy+Mtm9XNhv/xJsY65d98=
|
||||||
|
golang.org/x/oauth2 v0.29.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|
Loading…
Reference in New Issue