restore functionality for images
This commit is contained in:
parent
068804baf8
commit
335e5d9700
|
@ -99,16 +99,9 @@ func listDigitalOceanImages(listImages imageListFunc) ([]interface{}, error) {
|
|||
allImages = append(allImages, image)
|
||||
}
|
||||
|
||||
if resp.Links == nil || resp.Links.IsLastPage() {
|
||||
if resp.Links == nil || resp.Links.Pages == nil {
|
||||
break
|
||||
}
|
||||
|
||||
page, err := resp.Links.CurrentPage()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error retrieving images: %s", err)
|
||||
}
|
||||
|
||||
opts.Page = page + 1
|
||||
}
|
||||
|
||||
return allImages, nil
|
||||
|
|
|
@ -56,7 +56,7 @@ type Client struct {
|
|||
Keys KeysService
|
||||
Regions RegionsService
|
||||
Sizes SizesService
|
||||
Snapshots SnapshotsService
|
||||
Snapshots SnapshotsService
|
||||
Storage StorageService
|
||||
StorageActions StorageActionsService
|
||||
Tags TagsService
|
||||
|
@ -101,7 +101,7 @@ type Response struct {
|
|||
|
||||
// Links that were returned with the response. These are parsed from
|
||||
// request body and not the header.
|
||||
Links []*LinkAction
|
||||
Links *Links
|
||||
|
||||
// Meta describes generic information about the response.
|
||||
Meta *Meta
|
||||
|
|
|
@ -234,11 +234,7 @@ func (s *ImagesServiceOp) list(ctx context.Context, opt *ListOptions, listOpt *l
|
|||
return nil, resp, err
|
||||
}
|
||||
if l := root.Links; l != nil {
|
||||
var wrappedActions []*LinkAction
|
||||
for _, element := range (*l).Actions {
|
||||
wrappedActions = append(wrappedActions, &element)
|
||||
}
|
||||
resp.Links = wrappedActions
|
||||
resp.Links = l;
|
||||
}
|
||||
if m := root.Meta; m != nil {
|
||||
resp.Meta = m
|
||||
|
|
Loading…
Reference in New Issue