cloudflare-go icon indicating copy to clipboard operation
cloudflare-go copied to clipboard

Support for List Images v2 and continuation tokens

Open Jille opened this issue 1 year ago • 2 comments

Current cloudflare-go version

0.81.0

Description

https://developers.cloudflare.com/api/operations/cloudflare-images-list-images-v2 describes the new v2 api for listing images.

The current ListImages call doesn't return any pagination info however.

Use cases

I want to list all images, match them against those I still reference, and delete the rest.

Potential cloudflare-go usage

var cursor string
for {
  imgs, info, err := cf.ListImagesV2(ctx, rc, cloudflare.ListImagesParams{Cursor: cursor})
  if err != nil {}
  stuff(imgs)
  if info.Cursor == "" {
    break
  }
  cursor = info.Cursor
}

References

No response

Jille avatar Nov 17 '23 08:11 Jille