This commit is contained in:
filifa 2025-04-06 22:07:02 -04:00
parent 3a217181b4
commit 8b511930d1
1 changed files with 4 additions and 6 deletions

View File

@ -18,29 +18,27 @@ package cmd
import ( import (
"context" "context"
"encoding/json"
"fmt" "fmt"
"io"
"log" "log"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"scm.dairydemon.net/filifa/mlbstats/api"
) )
func feed(cmd *cobra.Command, args []string) { func feed(cmd *cobra.Command, args []string) {
client := api.NewAPIClient(api.NewConfiguration()) req := statsAPIClient.GameAPI.LiveGameV1(context.Background(), gamePk)
req := client.GameAPI.LiveGameV1(context.Background(), gamePk)
resp, err := req.Execute() resp, err := req.Execute()
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
json, err := json.Marshal(resp.Body) body, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
fmt.Println(string(json)) fmt.Println(string(body))
} }
// feedCmd represents the feed command // feedCmd represents the feed command