Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#1621)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Apr 2, 2024
1 parent b40dc92 commit 2ad6f5e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions internal/shared/pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,15 +517,15 @@ func (r *CursorLimitPaginationAutoPager[T]) Index() int {
}

type SinglePage[T any] struct {
Items []T `json:"-,inline"`
JSON singlePageJSON `json:"-"`
cfg *requestconfig.RequestConfig
res *http.Response
Result []T `json:"-,inline"`
JSON singlePageJSON `json:"-"`
cfg *requestconfig.RequestConfig
res *http.Response
}

// singlePageJSON contains the JSON metadata for the struct [SinglePage[T]]
type singlePageJSON struct {
Items apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -580,17 +580,17 @@ func NewSinglePageAutoPager[T any](page *SinglePage[T], err error) *SinglePageAu
}

func (r *SinglePageAutoPager[T]) Next() bool {
if r.page == nil || len(r.page.Items) == 0 {
if r.page == nil || len(r.page.Result) == 0 {
return false
}
if r.idx >= len(r.page.Items) {
if r.idx >= len(r.page.Result) {
r.idx = 0
r.page, r.err = r.page.GetNextPage()
if r.err != nil || r.page == nil || len(r.page.Items) == 0 {
if r.err != nil || r.page == nil || len(r.page.Result) == 0 {
return false
}
}
r.cur = r.page.Items[r.idx]
r.cur = r.page.Result[r.idx]
r.run += 1
r.idx += 1
return true
Expand Down

0 comments on commit 2ad6f5e

Please sign in to comment.