-
Notifications
You must be signed in to change notification settings - Fork 683
Open
Description
Confirm this is a Go library issue and not an underlying Cloudflare API issue
- This is an issue with the Go library
Describe the bug
Trying to fetch items from a ZeroTrust Gateway List always returns in an empty results et.
Using mitmproxy shows that the API request is properly done and returns data.
After changing the function signatures in gatewaylistitem.go result are available.
37c37
< func (r *GatewayListItemService) List(ctx context.Context, listID string, query GatewayListItemListParams, opts ...option.RequestOption) (res *pagination.SinglePage[[]GatewayItem], err error) {
---
> func (r *GatewayListItemService) List(ctx context.Context, listID string, query GatewayListItemListParams, opts ...option.RequestOption) (res *pagination.SinglePage[GatewayItem], err error) {
63c63
< func (r *GatewayListItemService) ListAutoPaging(ctx context.Context, listID string, query GatewayListItemListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[[]GatewayItem] {
---
> func (r *GatewayListItemService) ListAutoPaging(ctx context.Context, listID string, query GatewayListItemListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[GatewayItem] {To Reproduce
- Create a ZeroTrust Gateway List
- Add an entry to that List
- Try to fetch items from the List
Code snippets
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go/v6"
"github.com/cloudflare/cloudflare-go/v6/option"
"github.com/cloudflare/cloudflare-go/v6/zero_trust"
)
func main() {
accountId := "[ACCOUNT ID]"
apiToken := "[TOKEN HERE]"
listId := "[LIST ID]"
client := cloudflare.NewClient(
option.WithAPIToken(apiToken),
)
ctx := context.Background()
page := client.ZeroTrust.Gateway.Lists.Items.ListAutoPaging(
ctx,
listId,
zero_trust.GatewayListItemListParams{
AccountID: cloudflare.F(accountId),
},
)
for page.Next() {
l := page.Current()
fmt.Println(l)
}
if page.Err() != nil {
panic(page.Err())
}
}OS
Ubuntu 24.04
Go version
Go 1.24.7
Library version
github.com/cloudflare/cloudflare-go/v6
Metadata
Metadata
Assignees
Labels
No labels