cloudflare-go
cloudflare-go copied to clipboard
Hide pagination info when auto-pagination is enabled
Current cloudflare-go version
0.54.0
Description
As mentioned in https://github.com/cloudflare/cloudflare-go/issues/612#issuecomment-890554597, I wonder if it makes sense for the functions with auto-pagination to return a modified ResultInfo saying that "there's only one big single page" (that is, Page is 1, TotalPages is 1, and Count matches Total, etc,).
Use cases
It should be an invariant that Count always matches the number of returned entries, hiding the details of pagination when auto-pagination is enabled.
Potential cloudflare-go usage
rs, ri, err := ListDNSRecords(ctx, ...)
// len(rs) == ri.Count should always hold whenever err == nil
References
This was discussed in #612. The discussion there was dismissed because we intended to enable auto-pagination unconditionally back then. However, the new API allows library users to turn off auto-pagination and thus the same design question re-appears.