Class: SlackWebApi::FilesRemoteController

Inherits:
BaseController show all
Defined in:
lib/slack_web_api/controllers/files_remote_controller.rb

Overview

FilesRemoteController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from SlackWebApi::BaseController

Instance Method Details

#files_remote_add(token: nil, external_id: nil, title: nil, filetype: nil, external_url: nil, preview_image: nil, indexable_file_contents: nil) ⇒ ApiResponse

Adds a file from a remote service scope: remote_files:write the file. shared. via multipart/form-data. (txt, pdf, doc, etc.) containing textual search terms that are used to improve discovery of the remote file.

Parameters:

  • token (String) (defaults to: nil)

    Optional parameter: Authentication token. Requires

  • external_id (String) (defaults to: nil)

    Optional parameter: Creator defined GUID for

  • title (String) (defaults to: nil)

    Optional parameter: Title of the file being

  • filetype (String) (defaults to: nil)

    Optional parameter: type of file

  • external_url (String) (defaults to: nil)

    Optional parameter: URL of the remote file.

  • preview_image (String) (defaults to: nil)

    Optional parameter: Preview of the document

  • indexable_file_contents (String) (defaults to: nil)

    Optional parameter: A text file

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/slack_web_api/controllers/files_remote_controller.rb', line 24

def files_remote_add(token: nil,
                     external_id: nil,
                     title: nil,
                     filetype: nil,
                     external_url: nil,
                     preview_image: nil,
                     indexable_file_contents: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/files.remote.add',
                                 Server::DEFAULT)
               .form_param(new_parameter(token, key: 'token'))
               .form_param(new_parameter(external_id, key: 'external_id'))
               .form_param(new_parameter(title, key: 'title'))
               .form_param(new_parameter(filetype, key: 'filetype'))
               .form_param(new_parameter(external_url, key: 'external_url'))
               .form_param(new_parameter(preview_image, key: 'preview_image'))
               .form_param(new_parameter(indexable_file_contents, key: 'indexable_file_contents'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#files_remote_info(token: nil, file: nil, external_id: nil) ⇒ ApiResponse

Retrieve information about a remote file added to Slack scope: remote_files:read ID. the file.

Parameters:

  • token (String) (defaults to: nil)

    Optional parameter: Authentication token. Requires

  • file (String) (defaults to: nil)

    Optional parameter: Specify a file by providing its

  • external_id (String) (defaults to: nil)

    Optional parameter: Creator defined GUID for

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/slack_web_api/controllers/files_remote_controller.rb', line 63

def files_remote_info(token: nil,
                      file: nil,
                      external_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/files.remote.info',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(token, key: 'token'))
               .query_param(new_parameter(file, key: 'file'))
               .query_param(new_parameter(external_id, key: 'external_id'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#files_remote_list(token: nil, channel: nil, ts_from: nil, ts_to: nil, limit: nil, cursor: nil) ⇒ ApiResponse

Retrieve information about a remote file added to Slack scope: remote_files:read specific channel, indicated by its ID. timestamp (inclusive). timestamp (inclusive). return. 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](/docs/pagination) for more detail.

Parameters:

  • token (String) (defaults to: nil)

    Optional parameter: Authentication token. Requires

  • channel (String) (defaults to: nil)

    Optional parameter: Filter files appearing in a

  • ts_from (Float) (defaults to: nil)

    Optional parameter: Filter files created after this

  • ts_to (Float) (defaults to: nil)

    Optional parameter: Filter files created before this

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of items to

  • cursor (String) (defaults to: nil)

    Optional parameter: Paginate through collections of

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/slack_web_api/controllers/files_remote_controller.rb', line 103

def files_remote_list(token: nil,
                      channel: nil,
                      ts_from: nil,
                      ts_to: nil,
                      limit: nil,
                      cursor: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/files.remote.list',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(token, key: 'token'))
               .query_param(new_parameter(channel, key: 'channel'))
               .query_param(new_parameter(ts_from, key: 'ts_from'))
               .query_param(new_parameter(ts_to, key: 'ts_to'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#files_remote_remove(token: nil, file: nil, external_id: nil) ⇒ ApiResponse

Remove a remote file. scope: remote_files:write ID. the file.

Parameters:

  • token (String) (defaults to: nil)

    Optional parameter: Authentication token. Requires

  • file (String) (defaults to: nil)

    Optional parameter: Specify a file by providing its

  • external_id (String) (defaults to: nil)

    Optional parameter: Creator defined GUID for

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/slack_web_api/controllers/files_remote_controller.rb', line 140

def files_remote_remove(token: nil,
                        file: nil,
                        external_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/files.remote.remove',
                                 Server::DEFAULT)
               .form_param(new_parameter(token, key: 'token'))
               .form_param(new_parameter(file, key: 'file'))
               .form_param(new_parameter(external_id, key: 'external_id'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#files_remote_share(token: nil, file: nil, external_id: nil, channels: nil) ⇒ ApiResponse

Share a remote file into a channel. scope: remote_files:share Slack by providing its ID. Either this field or external_id or both are required. identifier (GUID) for the file, as set by the app registering the file with Slack. Either this field or file or both are required. channel IDs where the file will be shared.

Parameters:

  • token (String) (defaults to: nil)

    Optional parameter: Authentication token. Requires

  • file (String) (defaults to: nil)

    Optional parameter: Specify a file registered with

  • external_id (String) (defaults to: nil)

    Optional parameter: The globally unique

  • channels (String) (defaults to: nil)

    Optional parameter: Comma-separated list of

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/slack_web_api/controllers/files_remote_controller.rb', line 175

def files_remote_share(token: nil,
                       file: nil,
                       external_id: nil,
                       channels: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/files.remote.share',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(token, key: 'token'))
               .query_param(new_parameter(file, key: 'file'))
               .query_param(new_parameter(external_id, key: 'external_id'))
               .query_param(new_parameter(channels, key: 'channels'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#files_remote_update(token: nil, file: nil, external_id: nil, title: nil, filetype: nil, external_url: nil, preview_image: nil, indexable_file_contents: nil) ⇒ ApiResponse

Updates an existing remote file. scope: remote_files:write ID. the file. shared. via multipart/form-data. containing contents that can be used to improve searchability for the remote file.

Parameters:

  • token (String) (defaults to: nil)

    Optional parameter: Authentication token. Requires

  • file (String) (defaults to: nil)

    Optional parameter: Specify a file by providing its

  • external_id (String) (defaults to: nil)

    Optional parameter: Creator defined GUID for

  • title (String) (defaults to: nil)

    Optional parameter: Title of the file being

  • filetype (String) (defaults to: nil)

    Optional parameter: type of file

  • external_url (String) (defaults to: nil)

    Optional parameter: URL of the remote file.

  • preview_image (String) (defaults to: nil)

    Optional parameter: Preview of the document

  • indexable_file_contents (String) (defaults to: nil)

    Optional parameter: File

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/slack_web_api/controllers/files_remote_controller.rb', line 217

def files_remote_update(token: nil,
                        file: nil,
                        external_id: nil,
                        title: nil,
                        filetype: nil,
                        external_url: nil,
                        preview_image: nil,
                        indexable_file_contents: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/files.remote.update',
                                 Server::DEFAULT)
               .form_param(new_parameter(token, key: 'token'))
               .form_param(new_parameter(file, key: 'file'))
               .form_param(new_parameter(external_id, key: 'external_id'))
               .form_param(new_parameter(title, key: 'title'))
               .form_param(new_parameter(filetype, key: 'filetype'))
               .form_param(new_parameter(external_url, key: 'external_url'))
               .form_param(new_parameter(preview_image, key: 'preview_image'))
               .form_param(new_parameter(indexable_file_contents, key: 'indexable_file_contents'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end