fix content
This commit is contained in:
parent
8b511930d1
commit
9a032e177d
|
@ -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 content(cmd *cobra.Command, args []string) {
|
func content(cmd *cobra.Command, args []string) {
|
||||||
client := api.NewAPIClient(api.NewConfiguration())
|
req := statsAPIClient.GameAPI.Content(context.Background(), gamePk)
|
||||||
req := client.GameAPI.Content(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))
|
||||||
}
|
}
|
||||||
|
|
||||||
// contentCmd represents the content command
|
// contentCmd represents the content command
|
||||||
|
|
Loading…
Reference in New Issue