Compare commits

..

1 commit

Author SHA1 Message Date
c34bd49749
chore(deps): update golangci/golangci-lint docker tag to v2
Some checks failed
ci/woodpecker/push/build Pipeline is pending
ci/woodpecker/push/test Pipeline is pending
ci/woodpecker/push/lint Pipeline failed
2025-04-07 23:04:17 +00:00
2 changed files with 7 additions and 25 deletions

View file

@ -5,7 +5,6 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"strconv" "strconv"
"strings"
"time" "time"
"git.ar21.de/yolokube/grafana-backuper/pkg/grafana/schema" "git.ar21.de/yolokube/grafana-backuper/pkg/grafana/schema"
@ -168,25 +167,15 @@ func (c *DashboardVersionClient) list(
return nil, nil, err return nil, nil, err
} }
var versions schema.DashboardVersionListResponseV10 var body schema.DashboardVersionListResponse
body := schema.DashboardVersionListResponse{}
resp, err := c.client.do(req, &body) resp, err := c.client.do(req, &body)
if err != nil { if err != nil {
if !strings.Contains(err.Error(), "cannot unmarshal object") { return nil, resp, err
return nil, resp, err
}
bodyV10 := schema.DashboardVersionListResponseV10{}
resp, err = c.client.do(req, &bodyV10)
if err != nil {
return nil, resp, err
}
versions = bodyV10
} else {
versions = body.Versions
} }
dashboardVersions := make([]*DashboardVersion, 0, len(versions)) dashboardVersions := make([]*DashboardVersion, 0, len(body))
for _, dashboardVersion := range versions { for _, dashboardVersion := range body {
dashboardVersions = append(dashboardVersions, DashboardVersionFromSchema(dashboardVersion)) dashboardVersions = append(dashboardVersions, DashboardVersionFromSchema(dashboardVersion))
} }

View file

@ -1,8 +1,6 @@
package schema package schema
import ( import "time"
"time"
)
type DashboardVersion struct { type DashboardVersion struct {
ID uint `json:"id"` ID uint `json:"id"`
@ -17,9 +15,4 @@ type DashboardVersion struct {
Data any `json:"data"` Data any `json:"data"`
} }
type DashboardVersionListResponseV10 []DashboardVersion type DashboardVersionListResponse []DashboardVersion
type DashboardVersionListResponse struct {
ContinueToken string `json:"continueToken"`
Versions DashboardVersionListResponseV10 `json:"versions"`
}