Module: Slack::Endpoint::Files

Included in:
Slack::Endpoint
Defined in:
lib/slack/endpoint/files.rb

Instance Method Summary collapse

Instance Method Details

#files_comments_add(options = {}) ⇒ Object

Add a comment to an existing file.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :comment (Object)

    Text of the comment to add.

  • :file (Object)

    File to add a comment to.

See Also:



16
17
18
19
20
# File 'lib/slack/endpoint/files.rb', line 16

def files_comments_add(options={})
  throw ArgumentError.new("Required arguments :comment missing") if options[:comment].nil?
  throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
  post("files.comments.add", options)
end

#files_comments_delete(options = {}) ⇒ Object

Deletes an existing comment on a file.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :file (Object)

    File to delete a comment from.

  • :id (Object)

    The comment to delete.

See Also:



32
33
34
35
36
# File 'lib/slack/endpoint/files.rb', line 32

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

#files_comments_edit(options = {}) ⇒ Object

Edit an existing file comment.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :comment (Object)

    Text of the comment to edit.

  • :file (Object)

    File containing the comment to edit.

  • :id (Object)

    The comment to edit.

See Also:



50
51
52
53
54
55
# File 'lib/slack/endpoint/files.rb', line 50

def files_comments_edit(options={})
  throw ArgumentError.new("Required arguments :comment missing") if options[:comment].nil?
  throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
  throw ArgumentError.new("Required arguments :id missing") if options[:id].nil?
  post("files.comments.edit", options)
end

#files_delete(options = {}) ⇒ Object

Deletes a file.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :file (Object)

    ID of file to delete.

See Also:



65
66
67
68
# File 'lib/slack/endpoint/files.rb', line 65

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

#files_info(options = {}) ⇒ Object

Gets information about a team file.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :file (Object)

    Specify a file by providing its ID.

  • :count (Object)

    Number of items to return per page.

  • :page (Object)

    Page number of results to return.

See Also:



82
83
84
85
# File 'lib/slack/endpoint/files.rb', line 82

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

#files_list(options = {}) ⇒ Object

Lists & filters team files.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (Object)

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

  • :count (Object)

    Number of items to return per page.

  • :page (Object)

    Page number of results to return.

  • :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.

  • :user (Object)

    Filter files created by a single user.

See Also:



119
120
121
# File 'lib/slack/endpoint/files.rb', line 119

def files_list(options={})
  post("files.list", options)
end

#files_revokePublicURL(options = {}) ⇒ Object

Revokes public/external sharing access for a file

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :file (Object)

    File to revoke

See Also:



131
132
133
134
# File 'lib/slack/endpoint/files.rb', line 131

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

#files_sharedPublicURL(options = {}) ⇒ Object

Enables a file for public/external sharing.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :file (Object)

    File to share

See Also:



144
145
146
147
# File 'lib/slack/endpoint/files.rb', line 144

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

#files_startPartialUpload(options = {}) ⇒ Object

This is for starting the upload process of a file. It only requires a filename, and gives back a ticket ID so that later, the upload can be found and updated with all the remaining file info.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :file (Object)

    File contents via multipart/form-data.

See Also:



158
159
160
# File 'lib/slack/endpoint/files.rb', line 158

def files_startPartialUpload(options={})
  post("files.startPartialUpload", options)
end

#files_upload(options = {}) ⇒ Object

Uploads or creates a file.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channels (Object)

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

  • :content (Object)

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

  • :file (Object)

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

  • :filename (Object)

    Filename of file.

  • :filetype (Object)

    A file type identifier.

  • :initial_comment (Object)

    Initial comment to add to file.

  • :title (Object)

    Title of file.

See Also:



182
183
184
# File 'lib/slack/endpoint/files.rb', line 182

def files_upload(options={})
  post("files.upload", options)
end