notion-sdk-ruby icon indicating copy to clipboard operation
notion-sdk-ruby copied to clipboard

Auto pagination

Open mgmarlow opened this issue 2 years ago • 0 comments

Working with pagination is a very manual process that requires lots of consumer code. See example, #11. Some best practices should be baked into the library:

  • Handling Notion rate limit errors
  • Max # of retries (configurable)
  • Respectful default sleeps in-between requests (configurable)

I think a great example of this is the Stripe API auto pagination, source.

Create a new method, #auto_paging_each, on the Notion::List object to support auto-iterating through multiple pages.

notion_client.search(search_params).auto_paging_each do |data|
  ...
end

mgmarlow avatar Aug 24 '22 15:08 mgmarlow