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

View file

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