Module: Slack::Web::Api::Endpoints::FilesRemote

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

Instance Method Summary collapse

Instance Method Details

#files_remote_add(options = {}) ⇒ Object

Adds a file from a remote service

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :external_id (string)

    Creator defined GUID for the file.

  • :external_url (string)

    URL of the remote file.

  • :title (string)

    Title of the file being shared.

  • :filetype (string)

    type of file.

  • :indexable_file_contents (Object)

    A text file (txt, pdf, doc, etc.) containing textual search terms that are used to improve discovery of the remote file.

  • :preview_image (Object)

    Preview of the document via multipart/form-data.

Raises:

  • (ArgumentError)

See Also:



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

def files_remote_add(options = {})
  raise ArgumentError, 'Required arguments :external_id missing' if options[:external_id].nil?
  raise ArgumentError, 'Required arguments :external_url missing' if options[:external_url].nil?
  raise ArgumentError, 'Required arguments :title missing' if options[:title].nil?
  post('files.remote.add', options)
end

#files_remote_info(options = {}) ⇒ Object

Retrieve information about a remote file added to Slack

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :external_id (string)

    Creator defined GUID for the file.

  • :file (file)

    Specify a file by providing its ID.

See Also:



42
43
44
# File 'lib/slack/web/api/endpoints/files_remote.rb', line 42

def files_remote_info(options = {})
  post('files.remote.info', options)
end

#files_remote_list(options = {}) ⇒ Object

Retrieve information about a remote file added to Slack

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

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

  • :cursor (string)

    Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request’s response_metadata. Default value fetches the first “page” of the collection. See pagination for more detail.

  • :limit (integer)

    The maximum number of items to return.

  • :ts_from (string)

    Filter files created after this timestamp (inclusive).

  • :ts_to (string)

    Filter files created before this timestamp (inclusive).

See Also:



61
62
63
64
65
66
67
68
69
70
# File 'lib/slack/web/api/endpoints/files_remote.rb', line 61

def files_remote_list(options = {})
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
  if block_given?
    Pagination::Cursor.new(self, :files_remote_list, options).each do |page|
      yield page
    end
  else
    post('files.remote.list', options)
  end
end

#files_remote_remove(options = {}) ⇒ Object

Remove a remote file.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :external_id (string)

    Creator defined GUID for the file.

  • :file (file)

    Specify a file by providing its ID.

See Also:



81
82
83
# File 'lib/slack/web/api/endpoints/files_remote.rb', line 81

def files_remote_remove(options = {})
  post('files.remote.remove', options)
end

#files_remote_share(options = {}) ⇒ Object

Share a remote file into a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channels (string)

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

  • :external_id (string)

    The globally unique identifier (GUID) for the file, as set by the app registering the file with Slack. Either this field or file or both are required.

  • :file (file)

    Specify a file registered with Slack by providing its ID. Either this field or external_id or both are required.

Raises:

  • (ArgumentError)

See Also:



96
97
98
99
# File 'lib/slack/web/api/endpoints/files_remote.rb', line 96

def files_remote_share(options = {})
  raise ArgumentError, 'Required arguments :channels missing' if options[:channels].nil?
  post('files.remote.share', options)
end

#files_remote_update(options = {}) ⇒ Object

Updates an existing remote file.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :external_id (string)

    Creator defined GUID for the file.

  • :external_url (string)

    URL of the remote file.

  • :file (file)

    Specify a file by providing its ID.

  • :filetype (string)

    type of file.

  • :indexable_file_contents (Object)

    File containing contents that can be used to improve searchability for the remote file.

  • :preview_image (Object)

    Preview of the document via multipart/form-data.

  • :title (string)

    Title of the file being shared.

See Also:



120
121
122
# File 'lib/slack/web/api/endpoints/files_remote.rb', line 120

def files_remote_update(options = {})
  post('files.remote.update', options)
end