Handle cursor-based, offset-based, LDAP, and nested pagination in your connector.
Always paginate. Even if your test environment has 10 users, production might have 10,000. The SDK handles pagination orchestration - use it from day one.
Every List(), Entitlements(), and Grants() method returns a next page token:
// Return next page token, or "" when donereturn resources, nextPageToken, nil, nil
The SDK calls your method repeatedly until you return an empty token. Your job: fetch and convert one page at a time.
Use the API’s next token for termination, not result count. Some APIs return empty pages before the final page, so len(results) < pageSize isn’t reliable. Return "" only when the API signals no more pages.
When you have hierarchies, you often need to paginate at multiple levels: “page through orgs, and for each org, page through repos.” The SDK’s pagination.Bag handles this.
Real systems often have deep hierarchies. The Baton model handles these naturally: declare parent-child relationships and the SDK walks the tree for you.