module Slack::Web::Api::Endpoints::Files

Public Instance Methods

files_comments(options = {}) click to toggle source

Edit an existing comment on a file. Only the user who created a comment may make edits. Teams may configure a limited time window during which file comment edits are allowed.

@option options [file] :file

File containing the comment to edit.

@option options [Object] :id

The comment to edit.

@option options [Object] :comment

Text of the comment to edit.

@see api.slack.com/methods/files.comments @see github.com/dblock/slack-api-ref/blob/master/methods/files.comments.json

# File lib/slack/web/api/endpoints/files.rb, line 19
def files_comments(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
  throw ArgumentError.new('Required arguments :comment missing') if options[:comment].nil?
  post('files.comments', options)
end
files_delete(options = {}) click to toggle source

This method deletes a file from your team.

@option options [file] :file

ID of file to delete.

@see api.slack.com/methods/files.delete @see github.com/dblock/slack-api-ref/blob/master/methods/files.delete.json

# File lib/slack/web/api/endpoints/files.rb, line 33
def files_delete(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  post('files.delete', options)
end
files_info(options = {}) click to toggle source

This method returns information about a file in your team.

@option options [file] :file

File to fetch info for.

@see api.slack.com/methods/files.info @see github.com/dblock/slack-api-ref/blob/master/methods/files.info.json

# File lib/slack/web/api/endpoints/files.rb, line 45
def files_info(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  post('files.info', options)
end
files_list(options = {}) click to toggle source

This method returns a list of files within the team. It can be filtered and sliced in various ways.

@option options [user] :user

Filter files created by a single user.

@option options [Object] :ts_from

Filter files created after this timestamp (inclusive).

@option options [Object] :ts_to

Filter files created before this timestamp (inclusive).

@option options [Object] :types

Filter files by type:

all - All files
posts - Posts
snippets - Snippets
images - Image files
gdocs - Google docs
zips - Zip files
pdfs - PDF files

You can pass multiple values in the types argument, like types=posts,snippets.The default value is all, which does not filter the list.
.

@see api.slack.com/methods/files.list @see github.com/dblock/slack-api-ref/blob/master/methods/files.list.json

# File lib/slack/web/api/endpoints/files.rb, line 75
def files_list(options = {})
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
  post('files.list', options)
end
files_upload(options = {}) click to toggle source

This method allows you to create or upload an existing file.

@option options [file] :file

File contents via multipart/form-data.

@option options [Object] :content

File contents via a POST var.

@option options [Object] :filetype

Slack-internal file type identifier.

@option options [Object] :filename

Filename of file.

@option options [Object] :title

Title of file.

@option options [Object] :initial_comment

Initial comment to add to file.

@option options [Object] :channels

Comma-separated list of channel names or IDs where the file will be shared.

@see api.slack.com/methods/files.upload @see github.com/dblock/slack-api-ref/blob/master/methods/files.upload.json

# File lib/slack/web/api/endpoints/files.rb, line 99
def files_upload(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  throw ArgumentError.new('Required arguments :filename missing') if options[:filename].nil?
  post('files.upload', options)
end