Module: Slack::Web::Api::Endpoints::Files

Included in:
Slack::Web::Api::Endpoints
Defined in:
lib/slack/web/api/endpoints/files.rb

Instance Method Summary collapse

Instance Method Details

#files_delete(options = {}) ⇒ Object

This method deletes a file from your team.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :file (file)

    ID of file to delete.

See Also:



15
16
17
18
# File 'lib/slack/web/api/endpoints/files.rb', line 15

def files_delete(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  post('files.delete', options)
end

#files_info(options = {}) ⇒ Object

This method returns information about a file in your team.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :file (file)

    Specify a file by providing its ID.

See Also:



27
28
29
30
# File 'lib/slack/web/api/endpoints/files.rb', line 27

def files_info(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  post('files.info', options)
end

#files_list(options = {}) ⇒ Object

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

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :user (user)

    Filter files created by a single user.

  • :channel (channel)

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

  • :ts_from (Object)

    Filter files created after this timestamp (inclusive).

  • :ts_to (Object)

    Filter files created before this timestamp (inclusive).

  • :types (Object)

    Filter files by type:

    all - All files spaces - 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=spaces,snippets.The default value is all, which does not filter the list. .

See Also:



59
60
61
62
63
# File 'lib/slack/web/api/endpoints/files.rb', line 59

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)
end

#files_revokePublicURL(options = {}) ⇒ Object

This method disables public/external sharing for a file.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :file (file)

    File to revoke.

See Also:



72
73
74
75
# File 'lib/slack/web/api/endpoints/files.rb', line 72

def files_revokePublicURL(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  post('files.revokePublicURL', options)
end

#files_sharedPublicURL(options = {}) ⇒ Object

This method enables public/external sharing for a file.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :file (file)

    File to share.

See Also:



84
85
86
87
# File 'lib/slack/web/api/endpoints/files.rb', line 84

def files_sharedPublicURL(options = {})
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
  post('files.sharedPublicURL', options)
end

#files_upload(options = {}) ⇒ Object

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

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :file (file)

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

  • :content (Object)

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

  • :filetype (Object)

    A file type identifier.

  • :filename (Object)

    Filename of file.

  • :title (Object)

    Title of file.

  • :initial_comment (Object)

    Initial comment to add to file.

  • :channels (Object)

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

See Also:



108
109
110
111
# File 'lib/slack/web/api/endpoints/files.rb', line 108

def files_upload(options = {})
  throw ArgumentError.new('Required arguments :filename missing') if options[:filename].nil?
  post('files.upload', options)
end