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

Public Instance Methods

files_delete(options = {}) click to toggle source

Deletes a file.

@option options [file] :file

ID of file to delete.

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

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

Change the properties of a file (undocumented)

@option options [Object] :file

ID of the file to be edited

@option options [Object] :title

New title of the file

@option options [Object] :filetype

New filetype of the file. See https://api.slack.com/types/file#file_types for a list of all supported types.

@see github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.edit.json

# File lib/slack/web/api/endpoints/files.rb, line 31
def files_edit(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  throw ArgumentError.new('Required arguments :title missing') if options[:title].nil?
  logger.warn('The files.edit method is undocumented.')
  post('files.edit', options)
end
files_info(options = {}) { |page| ... } click to toggle source

Gets information about a file.

@option options [file] :file

Specify a file by providing its ID.

@option options [Object] :cursor

Parameter for pagination. File comments are paginated for a single file. Set cursor equal to the next_cursor attribute returned by the previous request's response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first "page" of the collection of comments. See pagination for more details.

@option options [Object] :limit

The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached.

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

# File lib/slack/web/api/endpoints/files.rb, line 49
def files_info(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  if block_given?
    Pagination::Cursor.new(self, :files_info, options).each do |page|
      yield page
    end
  else
    post('files.info', options)
  end
end
files_list(options = {}) click to toggle source

List for a team, in a channel, or from a user with applied filters.

@option options [channel] :channel

Filter files appearing in a specific channel, indicated by its ID.

@option options [Object] :show_files_hidden_by_limit

Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit.

@option options [Object] :team_id

encoded team id to list files in, required if org token is used.

@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 (see below). You can pass multiple values in the types argument, like types=spaces,snippets.The default value is all, which does not filter the list.

@option options [user] :user

Filter files created by a single user.

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

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

Revokes public/external sharing access for a file

@option options [file] :file

File to revoke.

@see api.slack.com/methods/files.revokePublicURL @see github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.revokePublicURL.json

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

Share an existing file in a channel (undocumented)

@option options [Object] :file

ID of the file to be shared

@option options [channel] :channel

Channel to share the file in. Works with both public (channel ID) and private channels (group ID).

@see github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.share.json

# File lib/slack/web/api/endpoints/files.rb, line 105
def files_share(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
  logger.warn('The files.share method is undocumented.')
  post('files.share', options)
end
files_sharedPublicURL(options = {}) click to toggle source

Enables a file for public/external sharing.

@option options [file] :file

File to share.

@see api.slack.com/methods/files.sharedPublicURL @see github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.sharedPublicURL.json

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

Uploads or creates a file.

@option options [Object] :channels

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

@option options [Object] :content

File contents via a POST variable. If omitting this parameter, you must provide a file.

@option options [file] :file

File contents via multipart/form-data. If omitting this parameter, you must submit content.

@option options [Object] :filename

Filename of file.

@option options [Object] :filetype

A file type identifier.

@option options [Object] :initial_comment

The message text introducing the file in specified channels.

@option options [Object] :thread_ts

Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.

@option options [Object] :title

Title of file.

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

# File lib/slack/web/api/endpoints/files.rb, line 146
def files_upload(options = {})
  post('files.upload', options)
end