slack-ruby-client 0.14.5 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop.yml +11 -3
  4. data/.rubocop_todo.yml +61 -23
  5. data/.travis.yml +1 -5
  6. data/CHANGELOG.md +43 -4
  7. data/CONTRIBUTING.md +17 -6
  8. data/Dangerfile +1 -1
  9. data/Gemfile +1 -2
  10. data/LICENSE.md +1 -1
  11. data/README.md +86 -52
  12. data/UPGRADING.md +20 -2
  13. data/bin/commands.rb +23 -0
  14. data/bin/commands/admin_analytics.rb +16 -0
  15. data/bin/commands/admin_apps.rb +15 -2
  16. data/bin/commands/admin_apps_approved.rb +17 -0
  17. data/bin/commands/admin_apps_restricted.rb +17 -0
  18. data/bin/commands/admin_barriers.rb +47 -0
  19. data/bin/commands/admin_conversations.rb +159 -0
  20. data/bin/commands/admin_conversations_ekm.rb +17 -0
  21. data/bin/commands/admin_conversations_restrictAccess.rb +37 -0
  22. data/bin/commands/admin_conversations_whitelist.rb +37 -0
  23. data/bin/commands/admin_emoji.rb +54 -0
  24. data/bin/commands/admin_inviteRequests.rb +36 -0
  25. data/bin/commands/admin_inviteRequests_approved.rb +16 -0
  26. data/bin/commands/admin_inviteRequests_denied.rb +16 -0
  27. data/bin/commands/admin_teams.rb +27 -0
  28. data/bin/commands/admin_teams_admins.rb +16 -0
  29. data/bin/commands/admin_teams_owners.rb +16 -0
  30. data/bin/commands/admin_teams_settings.rb +64 -0
  31. data/bin/commands/admin_usergroups.rb +48 -0
  32. data/bin/commands/admin_users.rb +97 -0
  33. data/bin/commands/admin_users_session.rb +22 -0
  34. data/bin/commands/api.rb +0 -1
  35. data/bin/commands/apps_connections.rb +13 -0
  36. data/bin/commands/apps_event_authorizations.rb +16 -0
  37. data/bin/commands/auth_teams.rb +16 -0
  38. data/bin/commands/bots.rb +1 -0
  39. data/bin/commands/calls.rb +52 -0
  40. data/bin/commands/calls_participants.rb +25 -0
  41. data/bin/commands/channels.rb +1 -155
  42. data/bin/commands/chat.rb +14 -12
  43. data/bin/commands/chat_scheduledMessages.rb +1 -0
  44. data/bin/commands/conversations.rb +15 -4
  45. data/bin/commands/dnd.rb +3 -1
  46. data/bin/commands/files.rb +7 -5
  47. data/bin/commands/files_remote.rb +3 -3
  48. data/bin/commands/groups.rb +1 -162
  49. data/bin/commands/im.rb +1 -63
  50. data/bin/commands/migration.rb +1 -0
  51. data/bin/commands/mpim.rb +1 -61
  52. data/bin/commands/oauth.rb +1 -1
  53. data/bin/commands/pins.rb +0 -2
  54. data/bin/commands/reactions.rb +1 -0
  55. data/bin/commands/search.rb +4 -1
  56. data/bin/commands/team.rb +3 -0
  57. data/bin/commands/usergroups.rb +6 -1
  58. data/bin/commands/usergroups_users.rb +2 -0
  59. data/bin/commands/users.rb +5 -3
  60. data/bin/commands/users_profile.rb +5 -5
  61. data/bin/commands/views.rb +1 -1
  62. data/bin/commands/workflows.rb +38 -0
  63. data/lib/slack-ruby-client.rb +5 -4
  64. data/lib/slack/events/request.rb +7 -3
  65. data/lib/slack/messages/message.rb +0 -4
  66. data/lib/slack/real_time/client.rb +2 -1
  67. data/lib/slack/real_time/concurrency.rb +0 -2
  68. data/lib/slack/real_time/concurrency/async.rb +1 -3
  69. data/lib/slack/real_time/config.rb +5 -14
  70. data/lib/slack/real_time/models/base.rb +0 -4
  71. data/lib/slack/real_time/socket.rb +2 -2
  72. data/lib/slack/real_time/stores/base.rb +3 -1
  73. data/lib/slack/version.rb +1 -1
  74. data/lib/slack/web/api/endpoints.rb +47 -0
  75. data/lib/slack/web/api/endpoints/admin_analytics.rb +28 -0
  76. data/lib/slack/web/api/endpoints/admin_apps.rb +22 -2
  77. data/lib/slack/web/api/endpoints/admin_apps_approved.rb +35 -0
  78. data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +35 -0
  79. data/lib/slack/web/api/endpoints/admin_barriers.rb +82 -0
  80. data/lib/slack/web/api/endpoints/admin_conversations.rb +246 -0
  81. data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +35 -0
  82. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +61 -0
  83. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +64 -0
  84. data/lib/slack/web/api/endpoints/admin_emoji.rb +88 -0
  85. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +61 -0
  86. data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +33 -0
  87. data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +33 -0
  88. data/lib/slack/web/api/endpoints/admin_teams.rb +50 -0
  89. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +34 -0
  90. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +34 -0
  91. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +99 -0
  92. data/lib/slack/web/api/endpoints/admin_usergroups.rb +77 -0
  93. data/lib/slack/web/api/endpoints/admin_users.rb +161 -0
  94. data/lib/slack/web/api/endpoints/admin_users_session.rb +38 -0
  95. data/lib/slack/web/api/endpoints/api.rb +0 -2
  96. data/lib/slack/web/api/endpoints/apps_connections.rb +21 -0
  97. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +34 -0
  98. data/lib/slack/web/api/endpoints/auth_teams.rb +33 -0
  99. data/lib/slack/web/api/endpoints/bots.rb +2 -0
  100. data/lib/slack/web/api/endpoints/calls.rb +83 -0
  101. data/lib/slack/web/api/endpoints/calls_participants.rb +42 -0
  102. data/lib/slack/web/api/endpoints/channels.rb +1 -245
  103. data/lib/slack/web/api/endpoints/chat.rb +23 -19
  104. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +3 -1
  105. data/lib/slack/web/api/endpoints/conversations.rb +37 -19
  106. data/lib/slack/web/api/endpoints/dnd.rb +4 -0
  107. data/lib/slack/web/api/endpoints/files.rb +8 -4
  108. data/lib/slack/web/api/endpoints/files_remote.rb +4 -4
  109. data/lib/slack/web/api/endpoints/groups.rb +0 -253
  110. data/lib/slack/web/api/endpoints/im.rb +0 -101
  111. data/lib/slack/web/api/endpoints/migration.rb +2 -0
  112. data/lib/slack/web/api/endpoints/mpim.rb +0 -96
  113. data/lib/slack/web/api/endpoints/oauth.rb +1 -4
  114. data/lib/slack/web/api/endpoints/pins.rb +3 -8
  115. data/lib/slack/web/api/endpoints/reactions.rb +5 -3
  116. data/lib/slack/web/api/endpoints/search.rb +6 -0
  117. data/lib/slack/web/api/endpoints/stars.rb +2 -2
  118. data/lib/slack/web/api/endpoints/team.rb +6 -0
  119. data/lib/slack/web/api/endpoints/usergroups.rb +10 -0
  120. data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -0
  121. data/lib/slack/web/api/endpoints/users.rb +7 -5
  122. data/lib/slack/web/api/endpoints/users_profile.rb +3 -3
  123. data/lib/slack/web/api/endpoints/views.rb +1 -1
  124. data/lib/slack/web/api/endpoints/workflows.rb +61 -0
  125. data/lib/slack/web/api/errors.rb +848 -0
  126. data/lib/slack/web/api/errors/internal_error.rb +14 -0
  127. data/lib/slack/web/api/errors/slack_error.rb +12 -0
  128. data/lib/slack/web/api/mixins.rb +1 -0
  129. data/lib/slack/web/api/mixins/channels.id.rb +1 -3
  130. data/lib/slack/web/api/mixins/conversations.id.rb +25 -0
  131. data/lib/slack/web/api/mixins/groups.id.rb +1 -3
  132. data/lib/slack/web/api/mixins/ids.id.rb +3 -5
  133. data/lib/slack/web/api/mixins/users.id.rb +1 -3
  134. data/lib/slack/web/api/patches/{chat.6.block-kit-support.patch → chat.1.patch} +26 -24
  135. data/lib/slack/web/api/templates/endpoints.erb +1 -0
  136. data/lib/slack/web/api/templates/errors.erb +20 -0
  137. data/lib/slack/web/api/templates/method.erb +4 -1
  138. data/lib/slack/web/api/templates/method_spec.erb +1 -1
  139. data/lib/slack/web/client.rb +1 -1
  140. data/lib/slack/web/config.rb +2 -0
  141. data/lib/slack/web/faraday/connection.rb +23 -20
  142. data/lib/slack/web/faraday/response/raise_error.rb +16 -2
  143. data/lib/slack/web/faraday/response/wrap_error.rb +24 -0
  144. data/lib/slack/web/pagination/cursor.rb +2 -2
  145. data/lib/tasks/real_time.rake +1 -1
  146. data/lib/tasks/web.rake +21 -4
  147. data/slack-ruby-client.gemspec +5 -5
  148. data/spec/fixtures/slack/web/channels_info.yml +108 -15
  149. data/spec/fixtures/slack/web/{groups_info.yml → conversations_info.yml} +4 -4
  150. data/spec/fixtures/slack/web/conversations_setTopic.yml +69 -0
  151. data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +142 -0
  152. data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +208 -0
  153. data/spec/fixtures/slack/web/views_open_error.yml +76 -0
  154. data/spec/slack/events/request_spec.rb +13 -8
  155. data/spec/slack/real_time/client_spec.rb +18 -1
  156. data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +10 -0
  157. data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +10 -0
  158. data/spec/slack/real_time/rtm_connect_spec.rb +1 -1
  159. data/spec/slack/real_time/rtm_start_spec.rb +1 -1
  160. data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +13 -0
  161. data/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb +8 -0
  162. data/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb +8 -0
  163. data/spec/slack/web/api/endpoints/admin_apps_spec.rb +5 -0
  164. data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +38 -0
  165. data/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb +8 -0
  166. data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +32 -0
  167. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +93 -0
  168. data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +37 -0
  169. data/spec/slack/web/api/endpoints/admin_inviteRequests_approved_spec.rb +8 -0
  170. data/spec/slack/web/api/endpoints/admin_inviteRequests_denied_spec.rb +8 -0
  171. data/spec/slack/web/api/endpoints/admin_inviteRequests_spec.rb +18 -0
  172. data/spec/slack/web/api/endpoints/admin_teams_admins_spec.rb +13 -0
  173. data/spec/slack/web/api/endpoints/admin_teams_owners_spec.rb +13 -0
  174. data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +53 -0
  175. data/spec/slack/web/api/endpoints/admin_teams_spec.rb +16 -0
  176. data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +37 -0
  177. data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +8 -0
  178. data/spec/slack/web/api/endpoints/admin_users_spec.rb +67 -0
  179. data/spec/slack/web/api/endpoints/apps_connections_spec.rb +8 -0
  180. data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +13 -0
  181. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +2 -2
  182. data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +3 -3
  183. data/spec/slack/web/api/endpoints/apps_spec.rb +2 -2
  184. data/spec/slack/web/api/endpoints/auth_teams_spec.rb +8 -0
  185. data/spec/slack/web/api/endpoints/calls_participants_spec.rb +24 -0
  186. data/spec/slack/web/api/endpoints/calls_spec.rb +31 -0
  187. data/spec/slack/web/api/endpoints/conversations_spec.rb +20 -12
  188. data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
  189. data/spec/slack/web/api/endpoints/files_comments_spec.rb +2 -2
  190. data/spec/slack/web/api/endpoints/files_remote_spec.rb +3 -3
  191. data/spec/slack/web/api/endpoints/files_spec.rb +4 -4
  192. data/spec/slack/web/api/endpoints/im_spec.rb +0 -31
  193. data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -31
  194. data/spec/slack/web/api/endpoints/oauth_spec.rb +3 -14
  195. data/spec/slack/web/api/endpoints/pins_spec.rb +1 -4
  196. data/spec/slack/web/api/endpoints/reactions_spec.rb +3 -3
  197. data/spec/slack/web/api/endpoints/reminders_spec.rb +2 -2
  198. data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +2 -2
  199. data/spec/slack/web/api/endpoints/workflows_spec.rb +26 -0
  200. data/spec/slack/web/api/errors/slack_error_spec.rb +22 -0
  201. data/spec/slack/web/api/mixins/channels_spec.rb +1 -1
  202. data/spec/slack/web/api/mixins/conversations_list_spec.rb +21 -0
  203. data/spec/slack/web/api/mixins/conversations_spec.rb +43 -0
  204. data/spec/slack/web/api/mixins/groups_spec.rb +1 -1
  205. data/spec/slack/web/api/mixins/users_spec.rb +1 -1
  206. data/spec/slack/web/client_spec.rb +121 -0
  207. data/spec/slack/web/faraday/response/raise_error_spec.rb +33 -9
  208. data/spec/support/vcr.rb +4 -0
  209. metadata +145 -55
  210. data/examples/hi_real_time/Gemfile +0 -6
  211. data/examples/hi_real_time/hi.gif +0 -0
  212. data/examples/hi_real_time/hi.rb +0 -41
  213. data/examples/hi_real_time_async_celluloid/Gemfile +0 -7
  214. data/examples/hi_real_time_async_celluloid/Procfile +0 -2
  215. data/examples/hi_real_time_async_celluloid/hi.rb +0 -39
  216. data/examples/hi_real_time_async_eventmachine/Gemfile +0 -7
  217. data/examples/hi_real_time_async_eventmachine/Procfile +0 -2
  218. data/examples/hi_real_time_async_eventmachine/hi.rb +0 -39
  219. data/lib/slack/real_time/concurrency/celluloid.rb +0 -142
  220. data/lib/slack/real_time/concurrency/eventmachine.rb +0 -85
  221. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +0 -13
  222. data/lib/slack/web/api/patches/chat.2.attachments-json.patch +0 -17
  223. data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +0 -21
  224. data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +0 -17
  225. data/lib/slack/web/api/patches/chat.5.postEphemeral-text-or-attachments.patch +0 -15
  226. data/spec/slack/real_time/concurrency/celluloid_spec.rb +0 -116
  227. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +0 -57
  228. data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +0 -13
  229. data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +0 -13
  230. data/spec/slack/web/api/endpoints/views_spec.rb +0 -29
  231. data/spec/slack/web/api/errors/service_unavailable_spec.rb +0 -17
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ desc 'AppsEventAuthorizations methods.'
5
+ command 'apps_event_authorizations' do |g|
6
+ g.desc 'Get a list of authorizations for the given event context. Each authorization represents an app installation that the event is visible to.'
7
+ g.long_desc %( Get a list of authorizations for the given event context. Each authorization represents an app installation that the event is visible to. )
8
+ g.command 'list' do |c|
9
+ c.flag 'event_context', desc: '.'
10
+ c.flag 'cursor', desc: '.'
11
+ c.flag 'limit', desc: '.'
12
+ c.action do |_global_options, options, _args|
13
+ puts JSON.dump($client.apps_event_authorizations_list(options))
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ desc 'AuthTeams methods.'
5
+ command 'auth_teams' do |g|
6
+ g.desc 'List the workspaces a token can access.'
7
+ g.long_desc %( List the workspaces a token can access. )
8
+ g.command 'list' do |c|
9
+ c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
10
+ c.flag 'include_icon', desc: 'Whether to return icon paths for each workspace. An icon path represents a URI pointing to the image signifying the workspace.'
11
+ c.flag 'limit', desc: 'The maximum number of workspaces to return. Must be a positive integer no larger than 1000.'
12
+ c.action do |_global_options, options, _args|
13
+ puts JSON.dump($client.auth_teams_list(options))
14
+ end
15
+ end
16
+ end
data/bin/commands/bots.rb CHANGED
@@ -7,6 +7,7 @@ command 'bots' do |g|
7
7
  g.long_desc %( Gets information about a bot user. )
8
8
  g.command 'info' do |c|
9
9
  c.flag 'bot', desc: 'Bot user to get info on.'
10
+ c.flag 'team_id', desc: 'encoded team id or enterprise id where the bot exists, required if org token is used.'
10
11
  c.action do |_global_options, options, _args|
11
12
  puts JSON.dump($client.bots_info(options))
12
13
  end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ desc 'Calls methods.'
5
+ command 'calls' do |g|
6
+ g.desc 'Registers a new Call.'
7
+ g.long_desc %( Registers a new Call. )
8
+ g.command 'add' do |c|
9
+ c.flag 'external_unique_id', desc: 'An ID supplied by the 3rd-party Call provider. It must be unique across all Calls from that service.'
10
+ c.flag 'join_url', desc: 'The URL required for a client to join the Call.'
11
+ c.flag 'created_by', desc: 'The valid Slack user ID of the user who created this Call. When this method is called with a user token, the created_by field is optional and defaults to the authed user of the token. Otherwise, the field is required.'
12
+ c.flag 'date_start', desc: 'Call start time in UTC UNIX timestamp format.'
13
+ c.flag 'desktop_app_join_url', desc: 'When supplied, available Slack clients will attempt to directly launch the 3rd-party Call with this URL.'
14
+ c.flag 'external_display_id', desc: 'An optional, human-readable ID supplied by the 3rd-party Call provider. If supplied, this ID will be displayed in the Call object.'
15
+ c.flag 'title', desc: 'The name of the Call.'
16
+ c.flag 'users', desc: 'The list of users to register as participants in the Call. Read more on how to specify users here.'
17
+ c.action do |_global_options, options, _args|
18
+ puts JSON.dump($client.calls_add(options))
19
+ end
20
+ end
21
+
22
+ g.desc 'Ends a Call.'
23
+ g.long_desc %( Ends a Call. )
24
+ g.command 'end' do |c|
25
+ c.flag 'id', desc: 'id returned when registering the call using the calls.add method.'
26
+ c.flag 'duration', desc: 'Call duration in seconds.'
27
+ c.action do |_global_options, options, _args|
28
+ puts JSON.dump($client.calls_end(options))
29
+ end
30
+ end
31
+
32
+ g.desc 'Returns information about a Call.'
33
+ g.long_desc %( Returns information about a Call. )
34
+ g.command 'info' do |c|
35
+ c.flag 'id', desc: 'id of the Call returned by the calls.add method.'
36
+ c.action do |_global_options, options, _args|
37
+ puts JSON.dump($client.calls_info(options))
38
+ end
39
+ end
40
+
41
+ g.desc 'Updates information about a Call.'
42
+ g.long_desc %( Updates information about a Call. )
43
+ g.command 'update' do |c|
44
+ c.flag 'id', desc: 'id returned by the calls.add method.'
45
+ c.flag 'desktop_app_join_url', desc: 'When supplied, available Slack clients will attempt to directly launch the 3rd-party Call with this URL.'
46
+ c.flag 'join_url', desc: 'The URL required for a client to join the Call.'
47
+ c.flag 'title', desc: 'The name of the Call.'
48
+ c.action do |_global_options, options, _args|
49
+ puts JSON.dump($client.calls_update(options))
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ desc 'CallsParticipants methods.'
5
+ command 'calls_participants' do |g|
6
+ g.desc 'Registers new participants added to a Call.'
7
+ g.long_desc %( Registers new participants added to a Call. )
8
+ g.command 'add' do |c|
9
+ c.flag 'id', desc: 'id returned by the calls.add method.'
10
+ c.flag 'users', desc: 'The list of users to add as participants in the Call. Read more on how to specify users here.'
11
+ c.action do |_global_options, options, _args|
12
+ puts JSON.dump($client.calls_participants_add(options))
13
+ end
14
+ end
15
+
16
+ g.desc 'Registers participants removed from a Call.'
17
+ g.long_desc %( Registers participants removed from a Call. )
18
+ g.command 'remove' do |c|
19
+ c.flag 'id', desc: 'id returned by the calls.add method.'
20
+ c.flag 'users', desc: 'The list of users to remove as participants in the Call. Read more on how to specify users here.'
21
+ c.action do |_global_options, options, _args|
22
+ puts JSON.dump($client.calls_participants_remove(options))
23
+ end
24
+ end
25
+ end
@@ -1,27 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'Channels methods.'
4
+ desc "Get info on your team's Slack channels, create or archive channels, invite users, set the topic and purpose, and mark a channel as read."
5
5
  command 'channels' do |g|
6
- g.desc 'Archives a channel.'
7
- g.long_desc %( Archives a channel. )
8
- g.command 'archive' do |c|
9
- c.flag 'channel', desc: 'Channel to archive.'
10
- c.action do |_global_options, options, _args|
11
- puts JSON.dump($client.channels_archive(options))
12
- end
13
- end
14
-
15
- g.desc 'Creates a channel.'
16
- g.long_desc %( Creates a channel. )
17
- g.command 'create' do |c|
18
- c.flag 'name', desc: 'Name of channel to create.'
19
- c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
20
- c.action do |_global_options, options, _args|
21
- puts JSON.dump($client.channels_create(options))
22
- end
23
- end
24
-
25
6
  g.desc 'Delete a channel (undocumented)'
26
7
  g.long_desc %( Delete a channel )
27
8
  g.command 'delete' do |c|
@@ -31,19 +12,6 @@ command 'channels' do |g|
31
12
  end
32
13
  end
33
14
 
34
- g.desc 'Fetches history of messages and events from a channel.'
35
- g.long_desc %( Fetches history of messages and events from a channel. )
36
- g.command 'history' do |c|
37
- c.flag 'channel', desc: 'Channel to fetch history for.'
38
- c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
39
- c.flag 'latest', desc: 'End of time range of messages to include in results.'
40
- c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
41
- c.flag 'unreads', desc: 'Include unread_count_display in the output?.'
42
- c.action do |_global_options, options, _args|
43
- puts JSON.dump($client.channels_history(options))
44
- end
45
- end
46
-
47
15
  g.desc 'This method returns the ID of a team channel.'
48
16
  g.long_desc %( This method returns the ID of a team channel. )
49
17
  g.command 'id' do |c|
@@ -52,126 +20,4 @@ command 'channels' do |g|
52
20
  puts JSON.dump($client.channels_id(options))
53
21
  end
54
22
  end
55
-
56
- g.desc 'Gets information about a channel.'
57
- g.long_desc %( Gets information about a channel. )
58
- g.command 'info' do |c|
59
- c.flag 'channel', desc: 'Channel to get info on.'
60
- c.flag 'include_locale', desc: 'Set this to true to receive the locale for this channel. Defaults to false.'
61
- c.action do |_global_options, options, _args|
62
- puts JSON.dump($client.channels_info(options))
63
- end
64
- end
65
-
66
- g.desc 'Invites a user to a channel.'
67
- g.long_desc %( Invites a user to a channel. )
68
- g.command 'invite' do |c|
69
- c.flag 'channel', desc: 'Channel to invite user to.'
70
- c.flag 'user', desc: 'User to invite to channel.'
71
- c.action do |_global_options, options, _args|
72
- puts JSON.dump($client.channels_invite(options))
73
- end
74
- end
75
-
76
- g.desc 'Joins a channel, creating it if needed.'
77
- g.long_desc %( Joins a channel, creating it if needed. )
78
- g.command 'join' do |c|
79
- c.flag 'name', desc: 'Name of channel to join.'
80
- c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
81
- c.action do |_global_options, options, _args|
82
- puts JSON.dump($client.channels_join(options))
83
- end
84
- end
85
-
86
- g.desc 'Removes a user from a channel.'
87
- g.long_desc %( Removes a user from a channel. )
88
- g.command 'kick' do |c|
89
- c.flag 'channel', desc: 'Channel to remove user from.'
90
- c.flag 'user', desc: 'User to remove from channel.'
91
- c.action do |_global_options, options, _args|
92
- puts JSON.dump($client.channels_kick(options))
93
- end
94
- end
95
-
96
- g.desc 'Leaves a channel.'
97
- g.long_desc %( Leaves a channel. )
98
- g.command 'leave' do |c|
99
- c.flag 'channel', desc: 'Channel to leave.'
100
- c.action do |_global_options, options, _args|
101
- puts JSON.dump($client.channels_leave(options))
102
- end
103
- end
104
-
105
- g.desc 'Lists all channels in a Slack team.'
106
- g.long_desc %( Lists all channels in a Slack team. )
107
- g.command 'list' do |c|
108
- c.flag 'cursor', desc: "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."
109
- c.flag 'exclude_archived', desc: 'Exclude archived channels from the list.'
110
- c.flag 'exclude_members', desc: 'Exclude the members collection from each channel.'
111
- c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
112
- c.action do |_global_options, options, _args|
113
- puts JSON.dump($client.channels_list(options))
114
- end
115
- end
116
-
117
- g.desc 'Sets the read cursor in a channel.'
118
- g.long_desc %( Sets the read cursor in a channel. )
119
- g.command 'mark' do |c|
120
- c.flag 'channel', desc: 'Channel to set reading cursor in.'
121
- c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
122
- c.action do |_global_options, options, _args|
123
- puts JSON.dump($client.channels_mark(options))
124
- end
125
- end
126
-
127
- g.desc 'Renames a channel.'
128
- g.long_desc %( Renames a channel. )
129
- g.command 'rename' do |c|
130
- c.flag 'channel', desc: 'Channel to rename.'
131
- c.flag 'name', desc: 'New name for channel.'
132
- c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
133
- c.action do |_global_options, options, _args|
134
- puts JSON.dump($client.channels_rename(options))
135
- end
136
- end
137
-
138
- g.desc 'Retrieve a thread of messages posted to a channel'
139
- g.long_desc %( Retrieve a thread of messages posted to a channel )
140
- g.command 'replies' do |c|
141
- c.flag 'channel', desc: 'Channel to fetch thread from.'
142
- c.flag 'thread_ts', desc: "Unique identifier of a thread's parent message."
143
- c.action do |_global_options, options, _args|
144
- puts JSON.dump($client.channels_replies(options))
145
- end
146
- end
147
-
148
- g.desc 'Sets the purpose for a channel.'
149
- g.long_desc %( Sets the purpose for a channel. )
150
- g.command 'setPurpose' do |c|
151
- c.flag 'channel', desc: 'Channel to set the purpose of.'
152
- c.flag 'purpose', desc: 'The new purpose.'
153
- c.flag 'name_tagging', desc: 'if it is true, treat this like a message and not an unescaped thing.'
154
- c.action do |_global_options, options, _args|
155
- puts JSON.dump($client.channels_setPurpose(options))
156
- end
157
- end
158
-
159
- g.desc 'Sets the topic for a channel.'
160
- g.long_desc %( Sets the topic for a channel. )
161
- g.command 'setTopic' do |c|
162
- c.flag 'channel', desc: 'Channel to set the topic of.'
163
- c.flag 'topic', desc: 'The new topic.'
164
- c.action do |_global_options, options, _args|
165
- puts JSON.dump($client.channels_setTopic(options))
166
- end
167
- end
168
-
169
- g.desc 'Unarchives a channel.'
170
- g.long_desc %( Unarchives a channel. )
171
- g.command 'unarchive' do |c|
172
- c.flag 'channel', desc: 'Channel to unarchive.'
173
- c.action do |_global_options, options, _args|
174
- puts JSON.dump($client.channels_unarchive(options))
175
- end
176
- end
177
23
  end
data/bin/commands/chat.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'Chat methods.'
4
+ desc 'Post chat messages to Slack.'
5
5
  command 'chat' do |g|
6
6
  g.desc 'Execute a slash command in a public channel (undocumented)'
7
7
  g.long_desc %( Execute a slash command in a public channel )
@@ -61,7 +61,7 @@ command 'chat' do |g|
61
61
  g.command 'postEphemeral' do |c|
62
62
  c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.'
63
63
  c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.'
64
- c.flag 'text', desc: "Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead."
64
+ c.flag 'text', desc: 'How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.'
65
65
  c.flag 'user', desc: 'id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.'
66
66
  c.flag 'as_user', desc: 'Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false.'
67
67
  c.flag 'blocks', desc: 'A JSON-based array of structured blocks, presented as a URL-encoded string.'
@@ -80,16 +80,17 @@ command 'chat' do |g|
80
80
  g.long_desc %( Sends a message to a channel. )
81
81
  g.command 'postMessage' do |c|
82
82
  c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.'
83
- c.flag 'text', desc: "Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation."
84
83
  c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.'
85
84
  c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.'
86
85
  c.flag 'blocks', desc: 'A JSON-based array of structured blocks, presented as a URL-encoded string.'
86
+ c.flag 'draft_id', desc: 'The id of the draft associated with the message.'
87
87
  c.flag 'icon_emoji', desc: 'Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.'
88
88
  c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.'
89
89
  c.flag 'link_names', desc: 'Find and link channel names and usernames.'
90
90
  c.flag 'mrkdwn', desc: 'Disable Slack markup parsing by setting to false. Enabled by default.'
91
91
  c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.'
92
92
  c.flag 'reply_broadcast', desc: 'Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.'
93
+ c.flag 'text', desc: 'How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.'
93
94
  c.flag 'thread_ts', desc: "Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead."
94
95
  c.flag 'unfurl_links', desc: 'Pass true to enable unfurling of primarily text-based content.'
95
96
  c.flag 'unfurl_media', desc: 'Pass false to disable unfurling of media content.'
@@ -104,12 +105,12 @@ command 'chat' do |g|
104
105
  g.command 'scheduleMessage' do |c|
105
106
  c.flag 'channel', desc: 'Channel, private group, or DM channel to send message to. Can be an encoded ID, or a name. See below for more details.'
106
107
  c.flag 'post_at', desc: 'Unix EPOCH timestamp of time in future to send the message.'
107
- c.flag 'text', desc: "Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation."
108
- c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.'
108
+ c.flag 'text', desc: 'How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.'
109
+ c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See chat.postMessage.'
109
110
  c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.'
110
111
  c.flag 'blocks', desc: 'A JSON-based array of structured blocks, presented as a URL-encoded string.'
111
112
  c.flag 'link_names', desc: 'Find and link channel names and usernames.'
112
- c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.'
113
+ c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See chat.postMessage.'
113
114
  c.flag 'reply_broadcast', desc: 'Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.'
114
115
  c.flag 'thread_ts', desc: "Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead."
115
116
  c.flag 'unfurl_links', desc: 'Pass true to enable unfurling of primarily text-based content.'
@@ -125,7 +126,8 @@ command 'chat' do |g|
125
126
  c.flag 'channel', desc: 'Channel ID of the message.'
126
127
  c.flag 'ts', desc: 'Timestamp of the message to add unfurl behavior to.'
127
128
  c.flag 'unfurls', desc: 'URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments.'
128
- c.flag 'user_auth_message', desc: 'Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior.'
129
+ c.flag 'user_auth_blocks', desc: 'Provide a JSON based array of structured blocks presented as URL-encoded string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior.'
130
+ c.flag 'user_auth_message', desc: 'Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior. Provides two buttons, Not now or Never ask me again.'
129
131
  c.flag 'user_auth_required', desc: 'Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain.'
130
132
  c.flag 'user_auth_url', desc: 'Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.'
131
133
  c.action do |_global_options, options, _args|
@@ -137,13 +139,13 @@ command 'chat' do |g|
137
139
  g.long_desc %( Updates a message. )
138
140
  g.command 'update' do |c|
139
141
  c.flag 'channel', desc: 'Channel containing the message to be updated.'
140
- c.flag 'text', desc: "New text for the message, using the default formatting rules. It's not required when presenting attachments."
141
142
  c.flag 'ts', desc: 'Timestamp of the message to be updated.'
142
143
  c.flag 'as_user', desc: 'Pass true to update the message as the authed user. Bot users in this context are considered authed users.'
143
- c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting text.'
144
- c.flag 'blocks', desc: 'A JSON-based array of structured blocks, presented as a URL-encoded string.'
145
- c.flag 'link_names', desc: 'Find and link channel names and usernames. Defaults to none. See below.'
146
- c.flag 'parse', desc: 'Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.'
144
+ c.flag 'attachments', desc: "A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting text. If you don't include this field, the message's previous attachments will be retained. To remove previous attachments, include an empty array for this field."
145
+ c.flag 'blocks', desc: "A JSON-based array of structured blocks, presented as a URL-encoded string. If you don't include this field, the message's previous blocks will be retained. To remove previous blocks, include an empty array for this field."
146
+ c.flag 'link_names', desc: 'Find and link channel names and usernames. Defaults to none. If you do not specify a value for this field, the original value set for the message will be overwritten with the default, none.'
147
+ c.flag 'parse', desc: 'Change how messages are treated. Defaults to client, unlike chat.postMessage. Accepts either none or full. If you do not specify a value for this field, the original value set for the message will be overwritten with the default, client.'
148
+ c.flag 'text', desc: "New text for the message, using the default formatting rules. It's not required when presenting blocks or attachments."
147
149
  c.action do |_global_options, options, _args|
148
150
  puts JSON.dump($client.chat_update(options))
149
151
  end
@@ -11,6 +11,7 @@ command 'chat_scheduledMessages' do |g|
11
11
  c.flag 'latest', desc: 'A UNIX timestamp of the latest value in the time range.'
12
12
  c.flag 'limit', desc: 'Maximum number of original entries to return.'
13
13
  c.flag 'oldest', desc: 'A UNIX timestamp of the oldest value in the time range.'
14
+ c.flag 'team_id', desc: 'encoded team id to list channels in, required if org token is used.'
14
15
  c.action do |_global_options, options, _args|
15
16
  puts JSON.dump($client.chat_scheduledMessages_list(options))
16
17
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'Conversations methods.'
4
+ desc "Interface with all kinds of conversations the same way, whether they're public or private channels, direct messages, or otherwise."
5
5
  command 'conversations' do |g|
6
6
  g.desc 'Archives a conversation.'
7
7
  g.long_desc %( Archives a conversation. )
@@ -26,7 +26,7 @@ command 'conversations' do |g|
26
26
  g.command 'create' do |c|
27
27
  c.flag 'name', desc: 'Name of the public or private channel to create.'
28
28
  c.flag 'is_private', desc: 'Create a private channel instead of a public one.'
29
- c.flag 'user_ids', desc: 'Required for workspace apps. A list of between 1 and 30 human users that will be added to the newly-created conversation. This argument has no effect when used by classic Slack apps.'
29
+ c.flag 'team_id', desc: 'encoded team id to create the channel in, required if org token is used.'
30
30
  c.action do |_global_options, options, _args|
31
31
  puts JSON.dump($client.conversations_create(options))
32
32
  end
@@ -61,7 +61,7 @@ command 'conversations' do |g|
61
61
  g.long_desc %( Invites users to a channel. )
62
62
  g.command 'invite' do |c|
63
63
  c.flag 'channel', desc: 'The ID of the public or private channel to invite user(s) to.'
64
- c.flag 'users', desc: 'A comma separated list of user IDs. Up to 30 users may be listed.'
64
+ c.flag 'users', desc: 'A comma separated list of user IDs. Up to 1000 users may be listed.'
65
65
  c.action do |_global_options, options, _args|
66
66
  puts JSON.dump($client.conversations_invite(options))
67
67
  end
@@ -101,12 +101,23 @@ command 'conversations' do |g|
101
101
  c.flag 'cursor', desc: "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."
102
102
  c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
103
103
  c.flag 'limit', desc: "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. Must be an integer no larger than 1000."
104
+ c.flag 'team_id', desc: 'encoded team id to list channels in, required if token belongs to org-wide app.'
104
105
  c.flag 'types', desc: 'Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.'
105
106
  c.action do |_global_options, options, _args|
106
107
  puts JSON.dump($client.conversations_list(options))
107
108
  end
108
109
  end
109
110
 
111
+ g.desc 'Sets the read cursor in a channel.'
112
+ g.long_desc %( Sets the read cursor in a channel. )
113
+ g.command 'mark' do |c|
114
+ c.flag 'channel', desc: 'Channel or conversation to set the read cursor for.'
115
+ c.flag 'ts', desc: 'Unique identifier of message you want marked as most recently seen in this conversation.'
116
+ c.action do |_global_options, options, _args|
117
+ puts JSON.dump($client.conversations_mark(options))
118
+ end
119
+ end
120
+
110
121
  g.desc 'Retrieve members of a conversation.'
111
122
  g.long_desc %( Retrieve members of a conversation. )
112
123
  g.command 'members' do |c|
@@ -143,7 +154,7 @@ command 'conversations' do |g|
143
154
  g.long_desc %( Retrieve a thread of messages posted to a conversation )
144
155
  g.command 'replies' do |c|
145
156
  c.flag 'channel', desc: 'Conversation ID to fetch thread from.'
146
- c.flag 'ts', desc: "Unique identifier of a thread's parent message."
157
+ c.flag 'ts', desc: "Unique identifier of either a thread's parent message or a message in the thread. ts must be the timestamp of an existing message with 0 or more replies. If there are no replies then just the single message referenced by ts will return - it is just an ordinary, unthreaded message."
147
158
  c.flag 'cursor', desc: "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."
148
159
  c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results only when either timestamp is specified.'
149
160
  c.flag 'latest', desc: 'End of time range of messages to include in results.'