@@ -3,13 +3,11 @@ package codefresh
33import (
44 "context"
55 "fmt"
6-
7- "github.com/codefresh-io/go-sdk/pkg/codefresh/model"
86)
97
108type (
119 ICliReleasesAPI interface {
12- GetLatest (ctx context.Context ) (* model. Release , error )
10+ GetLatest (ctx context.Context ) (string , error )
1311 }
1412
1513 CliReleases struct {
1816
1917 graphQlGetLatestReleaseResponse struct {
2018 Data struct {
21- LatestCliRelease model. Release
19+ LatestCliRelease string
2220 }
2321 Errors []graphqlError
2422 }
@@ -28,7 +26,7 @@ func newCliReleasesAPI(codefresh *codefresh) ICliReleasesAPI {
2826 return & CliReleases {codefresh : codefresh }
2927}
3028
31- func (releases * CliReleases ) GetLatest (ctx context.Context ) (* model. Release , error ) {
29+ func (releases * CliReleases ) GetLatest (ctx context.Context ) (string , error ) {
3230 jsonData := map [string ]interface {}{
3331 "query" : `{
3432 latestCliRelease {
@@ -40,16 +38,16 @@ func (releases *CliReleases) GetLatest(ctx context.Context) (*model.Release, err
4038 res := graphQlGetLatestReleaseResponse {}
4139 err := releases .codefresh .graphqlAPI (ctx , jsonData , & res )
4240 if err != nil {
43- return nil , fmt .Errorf ("failed making a graphql API call to runtime: %w" , err )
41+ return "" , fmt .Errorf ("failed making a graphql API call to runtime: %w" , err )
4442 }
4543
4644 if len (res .Errors ) > 0 {
47- return nil , graphqlErrorResponse {errors : res .Errors }
45+ return "" , graphqlErrorResponse {errors : res .Errors }
4846 }
4947
50- if & res .Data .LatestCliRelease == ( * model . Release )( nil ) {
51- return nil , fmt .Errorf ("failed finding latest release" )
48+ if res .Data .LatestCliRelease == "" {
49+ return "" , fmt .Errorf ("failed finding latest release" )
5250 }
5351
54- return & res .Data .LatestCliRelease , nil
52+ return res .Data .LatestCliRelease , nil
5553}
0 commit comments