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

Add pagination to Web API files_list #301

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* [#293](https://github.com/slack-ruby/slack-ruby-client/pull/293): Rubocop auto-correct and comprehensive todo - [@jcraigk](https://github.com/jcraigk).
* [#297](https://github.com/slack-ruby/slack-ruby-client/pull/297): Various Rubocop fixes - [@jcraigk](https://github.com/jcraigk).
* [#298](https://github.com/slack-ruby/slack-ruby-client/pull/298): Add `admin.apps`, `admin.app.requests` and `views` endpoints - [@jmanian](https://github.com/jmanian).
* [#299](https://github.com/slack-ruby/slack-ruby-client/issues/299): files_list does not paginate - [@rangerscience](https://github.com/rangerscience)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Danger is complaining that the text doesn't start with a capital letter, so make it "Added pagination support to file_list."

* Your contribution here.

### 0.14.4 (2019/7/28)
Expand Down
8 changes: 7 additions & 1 deletion lib/slack/web/api/endpoints/files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ def files_info(options = {})
def files_list(options = {})
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
post('files.list', options)
if block_given?
Pagination::Cursor.new(self, :files_list, options).each do |page|
yield page
end
else
post('files.list', options)
end
end

#
Expand Down