Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination Support #20

Merged
merged 22 commits into from Mar 16, 2019

Conversation

Projects
None yet
1 participant
@jwright
Copy link
Member

jwright commented Mar 15, 2019

This PR adds the ability to page cursor-paging supported API methods with the ease of passing in a page named parameter to the methods that support paging.

For example, to page the conversations.list api method, you would simply add the page parameter:

conversations = client.conversations.all(page: { limit: 1000 })

This will page through all the pages of your conversations.

It supports the ability to retry if the client receives a rate limit error. The api will automatically sleep the specified number of seconds that slack requests based on the error.

To try multiple times, you would simply add the parameter to the page:

conversations = client.conversations.all(page: { limit: 1000, max_retries: 5 })

Another feature is that you can be pro-active around the rate limiting and have the client sleep the number of seconds or fraction of seconds passed in between pages with the sleep_interval:

conversations = client.conversations.all(page: { limit: 1000, sleep_interval: 0.5 })

@jwright jwright changed the title Pagination Pagination Support Mar 15, 2019

@jwright jwright merged commit 60f3082 into master Mar 16, 2019

@jwright jwright deleted the pagination branch Mar 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.