@@ -86,6 +86,9 @@ func (r v4PagePaginationJSON) RawJSON() string {
8686// there is no next page, this function will return a 'nil' for the page value, but
8787// will not return an error
8888func (r * V4PagePagination [T ]) GetNextPage () (res * V4PagePagination [T ], err error ) {
89+ if len (r .Result .Items ) == 0 {
90+ return nil , nil
91+ }
8992 u := r .cfg .Request .URL
9093 currentPage , err := strconv .ParseInt (u .Query ().Get ("page" ), 10 , 64 )
9194 if err != nil {
@@ -210,6 +213,9 @@ func (r v4PagePaginationArrayJSON) RawJSON() string {
210213// there is no next page, this function will return a 'nil' for the page value, but
211214// will not return an error
212215func (r * V4PagePaginationArray [T ]) GetNextPage () (res * V4PagePaginationArray [T ], err error ) {
216+ if len (r .Result ) == 0 {
217+ return nil , nil
218+ }
213219 u := r .cfg .Request .URL
214220 currentPage , err := strconv .ParseInt (u .Query ().Get ("page" ), 10 , 64 )
215221 if err != nil {
@@ -336,6 +342,9 @@ func (r cursorPaginationJSON) RawJSON() string {
336342// there is no next page, this function will return a 'nil' for the page value, but
337343// will not return an error
338344func (r * CursorPagination [T ]) GetNextPage () (res * CursorPagination [T ], err error ) {
345+ if len (r .Result ) == 0 {
346+ return nil , nil
347+ }
339348 next := r .ResultInfo .Cursor
340349 if len (next ) == 0 {
341350 return nil , nil
@@ -462,6 +471,9 @@ func (r cursorLimitPaginationJSON) RawJSON() string {
462471// there is no next page, this function will return a 'nil' for the page value, but
463472// will not return an error
464473func (r * CursorLimitPagination [T ]) GetNextPage () (res * CursorLimitPagination [T ], err error ) {
474+ if len (r .Result ) == 0 {
475+ return nil , nil
476+ }
465477 next := r .ResultInfo .Cursor
466478 if len (next ) == 0 {
467479 return nil , nil
@@ -560,6 +572,9 @@ func (r singlePageJSON) RawJSON() string {
560572// there is no next page, this function will return a 'nil' for the page value, but
561573// will not return an error
562574func (r * SinglePage [T ]) GetNextPage () (res * SinglePage [T ], err error ) {
575+ if len (r .Result ) == 0 {
576+ return nil , nil
577+ }
563578 // This page represents a response that isn't actually paginated at the API level
564579 // so there will never be a next page.
565580 cfg := (* requestconfig .RequestConfig )(nil )
0 commit comments