start reorg
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"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) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"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) {
|
||||
|
||||
@@ -18,7 +18,7 @@ package cmd
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
||||
"scm.dairydemon.net/filifa/mlbstats/cmd/internal/statsapi"
|
||||
)
|
||||
|
||||
var leagueIDs = map[string]statsapi.LeagueID{
|
||||
|
||||
@@ -17,12 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"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
|
||||
@@ -30,19 +32,30 @@ var team teamAbbr
|
||||
var sport = sportAbbr("mlb")
|
||||
|
||||
func schedule(cmd *cobra.Command, args []string) {
|
||||
teamId := ""
|
||||
var teamIds []int32
|
||||
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 {
|
||||
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
|
||||
|
||||
@@ -18,7 +18,7 @@ package cmd
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
||||
"scm.dairydemon.net/filifa/mlbstats/cmd/internal/statsapi"
|
||||
)
|
||||
|
||||
var sportIDs = map[string]statsapi.SportID{
|
||||
|
||||
@@ -17,25 +17,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"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
|
||||
|
||||
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 {
|
||||
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
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/spf13/cobra"
|
||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
||||
"scm.dairydemon.net/filifa/mlbstats/cmd/internal/statsapi"
|
||||
)
|
||||
|
||||
var gamePk int
|
||||
|
||||
@@ -18,7 +18,7 @@ package cmd
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"scm.dairydemon.net/filifa/mlblive/cmd/internal/statsapi"
|
||||
"scm.dairydemon.net/filifa/mlbstats/cmd/internal/statsapi"
|
||||
)
|
||||
|
||||
var teamIDs = map[string]statsapi.TeamID{
|
||||
|
||||
Reference in New Issue
Block a user