@@ -86,6 +86,9 @@ func (r v4PagePaginationJSON) RawJSON() string {
86
86
// there is no next page, this function will return a 'nil' for the page value, but
87
87
// will not return an error
88
88
func (r * V4PagePagination [T ]) GetNextPage () (res * V4PagePagination [T ], err error ) {
89
+ if len (r .Result .Items ) == 0 {
90
+ return nil , nil
91
+ }
89
92
u := r .cfg .Request .URL
90
93
currentPage , err := strconv .ParseInt (u .Query ().Get ("page" ), 10 , 64 )
91
94
if err != nil {
@@ -210,6 +213,9 @@ func (r v4PagePaginationArrayJSON) RawJSON() string {
210
213
// there is no next page, this function will return a 'nil' for the page value, but
211
214
// will not return an error
212
215
func (r * V4PagePaginationArray [T ]) GetNextPage () (res * V4PagePaginationArray [T ], err error ) {
216
+ if len (r .Result ) == 0 {
217
+ return nil , nil
218
+ }
213
219
u := r .cfg .Request .URL
214
220
currentPage , err := strconv .ParseInt (u .Query ().Get ("page" ), 10 , 64 )
215
221
if err != nil {
@@ -336,6 +342,9 @@ func (r cursorPaginationJSON) RawJSON() string {
336
342
// there is no next page, this function will return a 'nil' for the page value, but
337
343
// will not return an error
338
344
func (r * CursorPagination [T ]) GetNextPage () (res * CursorPagination [T ], err error ) {
345
+ if len (r .Result ) == 0 {
346
+ return nil , nil
347
+ }
339
348
next := r .ResultInfo .Cursor
340
349
if len (next ) == 0 {
341
350
return nil , nil
@@ -462,6 +471,9 @@ func (r cursorLimitPaginationJSON) RawJSON() string {
462
471
// there is no next page, this function will return a 'nil' for the page value, but
463
472
// will not return an error
464
473
func (r * CursorLimitPagination [T ]) GetNextPage () (res * CursorLimitPagination [T ], err error ) {
474
+ if len (r .Result ) == 0 {
475
+ return nil , nil
476
+ }
465
477
next := r .ResultInfo .Cursor
466
478
if len (next ) == 0 {
467
479
return nil , nil
@@ -560,6 +572,9 @@ func (r singlePageJSON) RawJSON() string {
560
572
// there is no next page, this function will return a 'nil' for the page value, but
561
573
// will not return an error
562
574
func (r * SinglePage [T ]) GetNextPage () (res * SinglePage [T ], err error ) {
575
+ if len (r .Result ) == 0 {
576
+ return nil , nil
577
+ }
563
578
// This page represents a response that isn't actually paginated at the API level
564
579
// so there will never be a next page.
565
580
cfg := (* requestconfig .RequestConfig )(nil )
0 commit comments