lib/slack/web/api/endpoints/files.rb in slack-ruby-client-1.1.0 vs lib/slack/web/api/endpoints/files.rb in slack-ruby-client-2.0.0
- old
+ new
@@ -5,18 +5,36 @@
module Web
module Api
module Endpoints
module Files
#
+ # Finishes an upload started with files.getUploadURLExternal
+ #
+ # @option options [array] :files
+ # Array of file ids and their corresponding (optional) titles.
+ # @option options [Object] :channel_id
+ # Channel ID where the file will be shared. If not specified the file will be private.
+ # @option options [string] :initial_comment
+ # The message text introducing the file in specified channels.
+ # @option options [string] :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.
+ # @see https://api.slack.com/methods/files.completeUploadExternal
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.completeUploadExternal.json
+ def files_completeUploadExternal(options = {})
+ raise ArgumentError, 'Required arguments :files missing' if options[:files].nil?
+ post('files.completeUploadExternal', options)
+ end
+
+ #
# Deletes a file.
#
# @option options [file] :file
# ID of file to delete.
# @see https://api.slack.com/methods/files.delete
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.delete.json
def files_delete(options = {})
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
post('files.delete', options)
end
#
# Change the properties of a file (undocumented)
@@ -27,17 +45,36 @@
# 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 https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.edit.json
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?
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
+ raise ArgumentError, 'Required arguments :title missing' if options[:title].nil?
logger.warn('The files.edit method is undocumented.')
post('files.edit', options)
end
#
+ # Gets a URL for an edge external file upload
+ #
+ # @option options [string] :filename
+ # Name of the file being uploaded.
+ # @option options [integer] :length
+ # Size in bytes of the file being uploaded.
+ # @option options [string] :alt_txt
+ # Description of image for screen-reader.
+ # @option options [string] :snippet_type
+ # Syntax type of the snippet being uploaded.
+ # @see https://api.slack.com/methods/files.getUploadURLExternal
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.getUploadURLExternal.json
+ def files_getUploadURLExternal(options = {})
+ raise ArgumentError, 'Required arguments :filename missing' if options[:filename].nil?
+ raise ArgumentError, 'Required arguments :length missing' if options[:length].nil?
+ post('files.getUploadURLExternal', options)
+ end
+
+ #
# Gets information about a file.
#
# @option options [file] :file
# Specify a file by providing its ID.
# @option options [string] :cursor
@@ -45,11 +82,11 @@
# @option options [integer] :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 https://api.slack.com/methods/files.info
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.info.json
def files_info(options = {})
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
+ raise ArgumentError, '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
@@ -90,11 +127,11 @@
# @option options [file] :file
# File to revoke.
# @see https://api.slack.com/methods/files.revokePublicURL
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.revokePublicURL.json
def files_revokePublicURL(options = {})
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
post('files.revokePublicURL', options)
end
#
# Share an existing file in a channel (undocumented)
@@ -103,12 +140,12 @@
# 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 https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.share.json
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?
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
+ raise ArgumentError, '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
@@ -118,10 +155,10 @@
# @option options [file] :file
# File to share.
# @see https://api.slack.com/methods/files.sharedPublicURL
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.sharedPublicURL.json
def files_sharedPublicURL(options = {})
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
post('files.sharedPublicURL', options)
end
#
# Uploads or creates a file.