completed adding MediaLofi for kontor-gin
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
This commit is contained in:
@@ -22,7 +22,7 @@ type LoginResponse struct {
|
||||
|
||||
type ExportData struct {
|
||||
Sport models.SportDTOList `json:"sport"`
|
||||
Player []models.PlayerDTO `json:"player"`
|
||||
Player models.PlayerDTOList `json:"player"`
|
||||
Team []models.TeamDTO `json:"team"`
|
||||
Position []models.PositionDTO `json:"field_position"`
|
||||
Rooster []models.RoosterDTO `json:"rooster"`
|
||||
@@ -65,6 +65,8 @@ func (e *ExportData) GetMap() map[string]any {
|
||||
switch path {
|
||||
case "tysc/sports":
|
||||
dataMap["sports"] = value
|
||||
case "tysc/players":
|
||||
dataMap["players"] = value
|
||||
}
|
||||
}
|
||||
return dataMap
|
||||
@@ -133,6 +135,7 @@ func GetData(server config.Server, apiVersion string) (data *ExportData, err err
|
||||
var login LoginResponse
|
||||
|
||||
client := resty.New()
|
||||
client.SetLoggerWarnLevel(true)
|
||||
PostJSON(client, server, "api/login", &login)
|
||||
|
||||
for path, value := range Registry {
|
||||
@@ -197,7 +200,7 @@ func WriteJson(data *ExportData, fileName string) error {
|
||||
|
||||
func GetJSON(client *resty.Client, token string, server config.Server, path string, v any) {
|
||||
url := fmt.Sprintf("%s/%s/%s", server.Url, config.Config.ApiVersion, path)
|
||||
if config.Verbose > 1 {
|
||||
if config.Verbose > 2 {
|
||||
slog.Info("GetJSON", "url", url)
|
||||
}
|
||||
_, err := client.R().
|
||||
@@ -208,14 +211,14 @@ func GetJSON(client *resty.Client, token string, server config.Server, path stri
|
||||
if err != nil {
|
||||
slog.Info(url, "error", err.Error())
|
||||
}
|
||||
if config.Verbose > 1 {
|
||||
if config.Verbose > 2 {
|
||||
slog.Info("GetJSON", "value", v)
|
||||
}
|
||||
}
|
||||
|
||||
func PostJSON(client *resty.Client, server config.Server, path string, v any) {
|
||||
url := fmt.Sprintf("%s/%s", server.Url, path)
|
||||
if config.Verbose > 1 {
|
||||
if config.Verbose > 2 {
|
||||
slog.Info("PostJSON", "url", url)
|
||||
}
|
||||
_, err := client.R().
|
||||
@@ -229,7 +232,7 @@ func PostJSON(client *resty.Client, server config.Server, path string, v any) {
|
||||
if err != nil {
|
||||
slog.Info("PostJSON", "error", err.Error())
|
||||
}
|
||||
if config.Verbose > 1 {
|
||||
if config.Verbose > 2 {
|
||||
slog.Info(url, "token", v)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user