File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ func (r *Page[T]) UnmarshalJSON(data []byte) error {
43
43
// there is no next page, this function will return a 'nil' for the page value, but
44
44
// will not return an error
45
45
func (r * Page [T ]) GetNextPage () (res * Page [T ], err error ) {
46
+ if len (r .Data ) == 0 {
47
+ return nil , nil
48
+ }
46
49
// This page represents a response that isn't actually paginated at the API level
47
50
// so there will never be a next page.
48
51
cfg := (* requestconfig .RequestConfig )(nil )
@@ -137,6 +140,10 @@ func (r *CursorPage[T]) UnmarshalJSON(data []byte) error {
137
140
// there is no next page, this function will return a 'nil' for the page value, but
138
141
// will not return an error
139
142
func (r * CursorPage [T ]) GetNextPage () (res * CursorPage [T ], err error ) {
143
+ if len (r .Data ) == 0 {
144
+ return nil , nil
145
+ }
146
+
140
147
if r .JSON .HasMore .Valid () && r .HasMore == false {
141
148
return nil , nil
142
149
}
You can’t perform that action at this time.
0 commit comments