Skip to content

Commit

Permalink
feat(pagination): avoid fetching when has_more: false (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Feb 6, 2025
1 parent 40d1ea2 commit 6d90a30
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/pagination/pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func (r pageJSON) RawJSON() string {
// there is no next page, this function will return a 'nil' for the page value, but
// will not return an error
func (r *Page[T]) GetNextPage() (res *Page[T], err error) {
if !r.JSON.HasMore.IsMissing() && r.HasMore == false {
return nil, nil
}
cfg := r.cfg.Clone(r.cfg.Context)
if r.cfg.Request.URL.Query().Has("before_id") {
next := r.FirstID
Expand Down

0 comments on commit 6d90a30

Please sign in to comment.