Class: SlackWebApi::AdminConversationsController

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

Overview

AdminConversationsController

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

#admin_conversations_archive(token, channel_id) ⇒ ApiResponse

Archive a public or private channel. scope: admin.conversations:write

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel_id (String)

    Required parameter: The channel to archive.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 14

def admin_conversations_archive(token,
                                channel_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.conversations.archive',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel_id, key: 'channel_id')
                            .is_required(true))
               .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(AdminConversationsArchiveSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsArchiveErrorSchemaException))
    .execute
end

#admin_conversations_convert_to_private(token, channel_id) ⇒ ApiResponse

Convert a public channel to a private channel. scope: admin.conversations:write private.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel_id (String)

    Required parameter: The channel to convert to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 43

def admin_conversations_convert_to_private(token,
                                           channel_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.conversations.convertToPrivate',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel_id, key: 'channel_id')
                            .is_required(true))
               .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(AdminConversationsConvertToPrivateSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsConvertToPrivateErrorSchemaException))
    .execute
end

#admin_conversations_create(token, name, is_private, description: nil, org_wide: nil, team_id: nil) ⇒ ApiResponse

Create a public or private channel-based conversation. scope: admin.conversations:write channel to create. true, creates a private channel instead of a public channel or private channel to create. the channel will be available org-wide. Note: if the channel is not ‘org_wide=true`, you must specify a team_id for this channel channel in. Note: this argument is required unless you set `org_wide=true`.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • name (String)

    Required parameter: Name of the public or private

  • is_private (TrueClass | FalseClass)

    Required parameter: When

  • description (String) (defaults to: nil)

    Optional parameter: Description of the public

  • org_wide (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: When true,

  • team_id (String) (defaults to: nil)

    Optional parameter: The workspace to create the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 82

def admin_conversations_create(token,
                               name,
                               is_private,
                               description: nil,
                               org_wide: nil,
                               team_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.conversations.create',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(name, key: 'name')
                            .is_required(true))
               .form_param(new_parameter(is_private, key: 'is_private')
                            .is_required(true))
               .form_param(new_parameter(description, key: 'description'))
               .form_param(new_parameter(org_wide, key: 'org_wide'))
               .form_param(new_parameter(team_id, key: 'team_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(AdminConversationsCreateSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsCreateErrorSchemaException))
    .execute
end

#admin_conversations_delete(token, channel_id) ⇒ ApiResponse

Delete a public or private channel. scope: admin.conversations:write

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel_id (String)

    Required parameter: The channel to delete.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 119

def admin_conversations_delete(token,
                               channel_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.conversations.delete',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel_id, key: 'channel_id')
                            .is_required(true))
               .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(AdminConversationsDeleteSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsDeleteErrorSchemaException))
    .execute
end

#admin_conversations_disconnect_shared(token, channel_id, leaving_team_ids: nil) ⇒ ApiResponse

Disconnect a connected channel from one or more workspaces. scope: admin.conversations:write disconnected from some workspaces. removed from the channel. Currently only a single team id can be specified.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel_id (String)

    Required parameter: The channel to be

  • leaving_team_ids (String) (defaults to: nil)

    Optional parameter: The team to be

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 151

def admin_conversations_disconnect_shared(token,
                                          channel_id,
                                          leaving_team_ids: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.conversations.disconnectShared',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel_id, key: 'channel_id')
                            .is_required(true))
               .form_param(new_parameter(leaving_team_ids, key: 'leaving_team_ids'))
               .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(AdminConversationsRenameSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsDisconnectSharedErrorSchemaException))
    .execute
end

#admin_conversations_get_conversation_prefs(token, channel_id) ⇒ ApiResponse

Get conversation preferences for a public or private channel. scope: admin.conversations:read preferences for.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel_id (String)

    Required parameter: The channel to get

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 182

def admin_conversations_get_conversation_prefs(token,
                                               channel_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/admin.conversations.getConversationPrefs',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .query_param(new_parameter(channel_id, key: 'channel_id')
                             .is_required(true))
               .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(AdminConversationsGetConversationPrefsSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsUnarchiveErrorSchemaException))
    .execute
end

#admin_conversations_get_teams(token, channel_id, cursor: nil, limit: nil) ⇒ ApiResponse

Get all the workspaces a given public or private channel is connected to within this Enterprise org. scope: admin.conversations:read connected workspaces within the organization for. returned by the previous call to list items in the next page return. Must be between 1 - 1000 both inclusive.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel_id (String)

    Required parameter: The channel to determine

  • cursor (String) (defaults to: nil)

    Optional parameter: Set cursor to next_cursor

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of items to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



216
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
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 216

def admin_conversations_get_teams(token,
                                  channel_id,
                                  cursor: nil,
                                  limit: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/admin.conversations.getTeams',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .query_param(new_parameter(channel_id, key: 'channel_id')
                             .is_required(true))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AdminConversationsGetTeamsSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsGetTeamsErrorSchemaException))
    .execute
end

#admin_conversations_invite(token, user_ids, channel_id) ⇒ ApiResponse

Invite a user to a public or private channel. scope: admin.conversations:write will be invited to.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • user_ids (String)

    Required parameter: The users to invite.

  • channel_id (String)

    Required parameter: The channel that the users

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 250

def admin_conversations_invite(token,
                               user_ids,
                               channel_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.conversations.invite',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(user_ids, key: 'user_ids')
                            .is_required(true))
               .form_param(new_parameter(channel_id, key: 'channel_id')
                            .is_required(true))
               .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(AdminConversationsInviteSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsInviteErrorSchemaException))
    .execute
end

#admin_conversations_rename(token, channel_id, name) ⇒ ApiResponse

Rename a public or private channel. scope: admin.conversations:write

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel_id (String)

    Required parameter: The channel to rename.

  • name (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 282

def admin_conversations_rename(token,
                               channel_id,
                               name)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.conversations.rename',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel_id, key: 'channel_id')
                            .is_required(true))
               .form_param(new_parameter(name, key: 'name')
                            .is_required(true))
               .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(AdminConversationsRenameSchema1.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsUnarchiveErrorSchema2Exception))
    .execute
end

#admin_conversations_search(token, team_ids: nil, query: nil, limit: nil, cursor: nil, search_channel_types: nil, sort: nil, sort_dir: nil) ⇒ ApiResponse

Search for public or private channels in an Enterprise organization. scope: admin.conversations:read team IDs, signifying the workspaces to search through. by. returned. Must be between 1 - 20 both inclusive. Default is 10. returned by the previous call to list items in the next page. channel to include or exclude in the search. For example private will search private channels, while private_exclude will exclude them. For a full list of types, check the [Types section](#types). (search ranking based on what we think is closest), name (alphabetical), member_count (number of users in the channel), and created (date channel was created). You can optionally pair this with the sort_dir arg to change how it is sorted values are asc for ascending order like (1, 2, 3) or (a, b, c), and desc for descending order like (3, 2, 1) or (c, b, a)

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • team_ids (String) (defaults to: nil)

    Optional parameter: Comma separated string of

  • query (String) (defaults to: nil)

    Optional parameter: Name of the the channel to query

  • limit (Integer) (defaults to: nil)

    Optional parameter: Maximum number of items to be

  • cursor (String) (defaults to: nil)

    Optional parameter: Set cursor to next_cursor

  • search_channel_types (String) (defaults to: nil)

    Optional parameter: The type of

  • sort (String) (defaults to: nil)

    Optional parameter: Possible values are relevant

  • sort_dir (String) (defaults to: nil)

    Optional parameter: Sort direction. Possible

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 332

def admin_conversations_search(token,
                               team_ids: nil,
                               query: nil,
                               limit: nil,
                               cursor: nil,
                               search_channel_types: nil,
                               sort: nil,
                               sort_dir: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/admin.conversations.search',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(team_ids, key: 'team_ids'))
               .query_param(new_parameter(query, key: 'query'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(search_channel_types, key: 'search_channel_types'))
               .query_param(new_parameter(sort, key: 'sort'))
               .query_param(new_parameter(sort_dir, key: 'sort_dir'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AdminConversationsSearchSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsSearchErrorSchemaException))
    .execute
end

#admin_conversations_set_conversation_prefs(token, channel_id, prefs) ⇒ ApiResponse

Set the posting permissions for a public or private channel. scope: admin.conversations:write prefs for stringified JSON format.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel_id (String)

    Required parameter: The channel to set the

  • prefs (String)

    Required parameter: The prefs for this channel in a

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 374

def admin_conversations_set_conversation_prefs(token,
                                               channel_id,
                                               prefs)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.conversations.setConversationPrefs',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel_id, key: 'channel_id')
                            .is_required(true))
               .form_param(new_parameter(prefs, key: 'prefs')
                            .is_required(true))
               .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(AdminConversationsSetConversationPrefsSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsSetConversationPrefsErrorSchemaException))
    .execute
end

#admin_conversations_set_teams(token, channel_id, team_id: nil, target_team_ids: nil, org_channel: nil) ⇒ ApiResponse

Set the workspaces in an Enterprise grid org that connect to a public or private channel. scope: admin.conversations:write add or remove to workspaces. channel belongs. Omit this argument if the channel is a cross-workspace shared channel. of workspaces to which the channel should be shared. Not required if the channel is being shared org-wide. channel has to be converted to an org channel

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel_id (String)

    Required parameter: The encoded channel_id to

  • team_id (String) (defaults to: nil)

    Optional parameter: The workspace to which the

  • target_team_ids (String) (defaults to: nil)

    Optional parameter: A comma-separated list

  • org_channel (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: True if

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 415

def admin_conversations_set_teams(token,
                                  channel_id,
                                  team_id: nil,
                                  target_team_ids: nil,
                                  org_channel: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.conversations.setTeams',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel_id, key: 'channel_id')
                            .is_required(true))
               .form_param(new_parameter(team_id, key: 'team_id'))
               .form_param(new_parameter(target_team_ids, key: 'target_team_ids'))
               .form_param(new_parameter(org_channel, key: 'org_channel'))
               .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

#admin_conversations_unarchive(token, channel_id) ⇒ ApiResponse

Unarchive a public or private channel. scope: admin.conversations:write

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel_id (String)

    Required parameter: The channel to unarchive.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/slack_web_api/controllers/admin_conversations_controller.rb', line 449

def admin_conversations_unarchive(token,
                                  channel_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.conversations.unarchive',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel_id, key: 'channel_id')
                            .is_required(true))
               .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(AdminConversationsUnarchiveSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             AdminConversationsUnarchiveErrorSchema3Exception))
    .execute
end