We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 00715b2 commit 67c1361Copy full SHA for 67c1361
pkg/connector/client/pagination.go
@@ -85,9 +85,16 @@ func GetNextToken(
85
limit int,
86
total int,
87
) string {
88
+ nextPage := page + 1
89
+ nextOffset := nextPage * limit
90
+
91
+ if nextOffset >= total {
92
+ return ""
93
+ }
94
95
bytes, err := json.Marshal(
96
Pagination{
- Page: page + 1,
97
+ Page: nextPage,
98
},
99
)
100
if err != nil {
pkg/connector/users_test.go
@@ -43,6 +43,11 @@ func TestUsersList(t *testing.T) {
43
44
require.Nil(t, err)
45
test.AssertNoRatelimitAnnotations(t, listAnnotations)
46
47
+ if nextToken == "" {
48
+ break
49
50
51
var token client.Pagination
52
err = json.Unmarshal([]byte(nextToken), &token)
53
0 commit comments