slack-ruby-client 1.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/workflows/integration_test.yml +45 -0
  4. data/.github/workflows/lint.yml +14 -0
  5. data/.github/workflows/pr_lint.yml +21 -0
  6. data/.github/workflows/test.yml +37 -0
  7. data/.gitignore +4 -3
  8. data/.rubocop.yml +6 -1
  9. data/.rubocop_todo.yml +88 -34
  10. data/.ruby-version +1 -0
  11. data/CHANGELOG.md +36 -0
  12. data/CONTRIBUTING.md +6 -5
  13. data/Gemfile +13 -1
  14. data/Gemfile.danger +6 -0
  15. data/README.md +78 -76
  16. data/RELEASING.md +2 -2
  17. data/SECURITY.md +9 -0
  18. data/UPGRADING.md +28 -0
  19. data/bin/commands/admin_analytics.rb +16 -10
  20. data/bin/commands/admin_apps.rb +48 -42
  21. data/bin/commands/admin_apps_approved.rb +17 -11
  22. data/bin/commands/admin_apps_requests.rb +28 -11
  23. data/bin/commands/admin_apps_restricted.rb +17 -11
  24. data/bin/commands/admin_audit_anomaly_allow.rb +29 -0
  25. data/bin/commands/admin_auth_policy.rb +37 -31
  26. data/bin/commands/admin_barriers.rb +44 -38
  27. data/bin/commands/admin_conversations.rb +221 -163
  28. data/bin/commands/admin_conversations_ekm.rb +17 -11
  29. data/bin/commands/admin_conversations_restrictAccess.rb +35 -29
  30. data/bin/commands/admin_emoji.rb +50 -44
  31. data/bin/commands/admin_inviteRequests.rb +34 -28
  32. data/bin/commands/admin_inviteRequests_approved.rb +16 -10
  33. data/bin/commands/admin_inviteRequests_denied.rb +16 -10
  34. data/bin/commands/admin_roles.rb +46 -0
  35. data/bin/commands/admin_teams.rb +26 -20
  36. data/bin/commands/admin_teams_admins.rb +16 -10
  37. data/bin/commands/admin_teams_owners.rb +16 -10
  38. data/bin/commands/admin_teams_settings.rb +59 -53
  39. data/bin/commands/admin_usergroups.rb +45 -39
  40. data/bin/commands/admin_users.rb +91 -85
  41. data/bin/commands/admin_users_session.rb +72 -66
  42. data/bin/commands/admin_users_unsupportedVersions.rb +21 -0
  43. data/bin/commands/api.rb +14 -8
  44. data/bin/commands/apps.rb +15 -9
  45. data/bin/commands/apps_connections.rb +13 -7
  46. data/bin/commands/apps_event_authorizations.rb +16 -10
  47. data/bin/commands/apps_manifest.rb +48 -41
  48. data/bin/commands/auth.rb +21 -15
  49. data/bin/commands/auth_teams.rb +16 -10
  50. data/bin/commands/bookmarks.rb +59 -0
  51. data/bin/commands/bots.rb +15 -9
  52. data/bin/commands/calls.rb +49 -43
  53. data/bin/commands/calls_participants.rb +24 -18
  54. data/bin/commands/chat.rb +150 -141
  55. data/bin/commands/chat_scheduledMessages.rb +19 -13
  56. data/bin/commands/conversations.rb +233 -225
  57. data/bin/commands/dialog.rb +15 -9
  58. data/bin/commands/dnd.rb +46 -40
  59. data/bin/commands/emoji.rb +14 -7
  60. data/bin/commands/files.rb +112 -83
  61. data/bin/commands/files_comments.rb +15 -9
  62. data/bin/commands/files_remote.rb +73 -67
  63. data/bin/commands/functions_workflows_steps.rb +22 -0
  64. data/bin/commands/functions_workflows_steps_responses.rb +22 -0
  65. data/bin/commands/migration.rb +16 -10
  66. data/bin/commands/oauth.rb +18 -12
  67. data/bin/commands/oauth_v2.rb +28 -22
  68. data/bin/commands/openid_connect.rb +26 -20
  69. data/bin/commands/pins.rb +33 -26
  70. data/bin/commands/reactions.rb +52 -46
  71. data/bin/commands/reminders.rb +53 -47
  72. data/bin/commands/rtm.rb +15 -24
  73. data/bin/commands/search.rb +43 -37
  74. data/bin/commands/stars.rb +38 -32
  75. data/bin/commands/team.rb +47 -38
  76. data/bin/commands/team_billing.rb +13 -7
  77. data/bin/commands/team_preferences.rb +13 -7
  78. data/bin/commands/team_profile.rb +14 -8
  79. data/bin/commands/tooling_tokens.rb +14 -8
  80. data/bin/commands/usergroups.rb +64 -58
  81. data/bin/commands/usergroups_users.rb +27 -21
  82. data/bin/commands/users.rb +111 -105
  83. data/bin/commands/users_admin.rb +28 -22
  84. data/bin/commands/users_prefs.rb +13 -7
  85. data/bin/commands/users_profile.rb +26 -20
  86. data/bin/commands/views.rb +47 -39
  87. data/bin/commands/workflows.rb +36 -30
  88. data/bin/slack +48 -43
  89. data/lib/slack/real_time/api/message.rb +3 -2
  90. data/lib/slack/real_time/api/templates/event_handler.erb +5 -1
  91. data/lib/slack/real_time/api/typing.rb +2 -1
  92. data/lib/slack/real_time/client.rb +10 -28
  93. data/lib/slack/real_time/config.rb +3 -3
  94. data/lib/slack/real_time/models/channel.rb +4 -0
  95. data/lib/slack/real_time/models/{group.rb → mpim.rb} +1 -1
  96. data/lib/slack/real_time/models.rb +2 -1
  97. data/lib/slack/real_time/stores/base.rb +25 -9
  98. data/lib/slack/real_time/stores/starter.rb +323 -309
  99. data/lib/slack/real_time/stores/store.rb +265 -198
  100. data/lib/slack/real_time/stores.rb +1 -7
  101. data/lib/slack/version.rb +1 -1
  102. data/lib/slack/web/api/endpoints/admin_analytics.rb +2 -2
  103. data/lib/slack/web/api/endpoints/admin_apps.rb +2 -2
  104. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +16 -0
  105. data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +34 -0
  106. data/lib/slack/web/api/endpoints/admin_auth_policy.rb +7 -7
  107. data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
  108. data/lib/slack/web/api/endpoints/admin_conversations.rb +110 -28
  109. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +6 -6
  110. data/lib/slack/web/api/endpoints/admin_emoji.rb +9 -9
  111. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +2 -2
  112. data/lib/slack/web/api/endpoints/admin_roles.rb +73 -0
  113. data/lib/slack/web/api/endpoints/admin_teams.rb +2 -2
  114. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +1 -1
  115. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +1 -1
  116. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +11 -11
  117. data/lib/slack/web/api/endpoints/admin_usergroups.rb +7 -7
  118. data/lib/slack/web/api/endpoints/admin_users.rb +16 -16
  119. data/lib/slack/web/api/endpoints/admin_users_session.rb +8 -8
  120. data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +25 -0
  121. data/lib/slack/web/api/endpoints/apps.rb +2 -2
  122. data/lib/slack/web/api/endpoints/apps_connections.rb +1 -1
  123. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +1 -1
  124. data/lib/slack/web/api/endpoints/apps_manifest.rb +8 -6
  125. data/lib/slack/web/api/endpoints/bookmarks.rb +88 -0
  126. data/lib/slack/web/api/endpoints/bots.rb +1 -1
  127. data/lib/slack/web/api/endpoints/calls.rb +5 -5
  128. data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
  129. data/lib/slack/web/api/endpoints/chat.rb +37 -31
  130. data/lib/slack/web/api/endpoints/conversations.rb +38 -34
  131. data/lib/slack/web/api/endpoints/dialog.rb +2 -2
  132. data/lib/slack/web/api/endpoints/dnd.rb +1 -1
  133. data/lib/slack/web/api/endpoints/emoji.rb +2 -0
  134. data/lib/slack/web/api/endpoints/files.rb +45 -10
  135. data/lib/slack/web/api/endpoints/files_comments.rb +2 -2
  136. data/lib/slack/web/api/endpoints/files_remote.rb +8 -8
  137. data/lib/slack/web/api/endpoints/functions_workflows_steps.rb +28 -0
  138. data/lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb +28 -0
  139. data/lib/slack/web/api/endpoints/migration.rb +1 -1
  140. data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
  141. data/lib/slack/web/api/endpoints/pins.rb +5 -3
  142. data/lib/slack/web/api/endpoints/reactions.rb +4 -4
  143. data/lib/slack/web/api/endpoints/reminders.rb +5 -5
  144. data/lib/slack/web/api/endpoints/rtm.rb +0 -23
  145. data/lib/slack/web/api/endpoints/search.rb +3 -3
  146. data/lib/slack/web/api/endpoints/team.rb +13 -1
  147. data/lib/slack/web/api/endpoints/tooling_tokens.rb +1 -1
  148. data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
  149. data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -3
  150. data/lib/slack/web/api/endpoints/users.rb +4 -4
  151. data/lib/slack/web/api/endpoints/users_admin.rb +2 -2
  152. data/lib/slack/web/api/endpoints/users_profile.rb +1 -1
  153. data/lib/slack/web/api/endpoints/views.rb +16 -11
  154. data/lib/slack/web/api/endpoints/workflows.rb +4 -4
  155. data/lib/slack/web/api/endpoints.rb +12 -0
  156. data/lib/slack/web/api/errors.rb +146 -8
  157. data/lib/slack/web/api/mixins/conversations.id.rb +1 -1
  158. data/lib/slack/web/api/mixins/users.id.rb +1 -1
  159. data/lib/slack/web/api/mixins/users.search.rb +2 -1
  160. data/lib/slack/web/api/patches/{chat.1.patch → chat.attachments-blocks.patch} +13 -14
  161. data/lib/slack/web/api/patches/{dialog.1.open-json-support.patch → dialog.encoded-json.patch} +4 -4
  162. data/lib/slack/web/api/patches/views.view-json.patch +55 -0
  163. data/lib/slack/web/api/templates/command.erb +18 -12
  164. data/lib/slack/web/api/templates/method.erb +1 -1
  165. data/lib/slack/web/config.rb +2 -2
  166. data/lib/slack/web/faraday/connection.rb +4 -4
  167. data/lib/slack/web/faraday/request.rb +2 -0
  168. data/lib/slack/web/faraday/response/raise_error.rb +2 -10
  169. data/lib/slack/web/faraday/response/wrap_error.rb +1 -1
  170. data/lib/slack-ruby-client.rb +2 -1
  171. data/lib/tasks/real_time.rake +44 -24
  172. data/lib/tasks/web.rake +9 -8
  173. data/slack-ruby-client.gemspec +5 -14
  174. data/spec/fixtures/slack/web/rtm_connect.yml +85 -1
  175. data/spec/integration/integration_spec.rb +1 -1
  176. data/spec/slack/events/config_spec.rb +2 -0
  177. data/spec/slack/events/request_spec.rb +5 -1
  178. data/spec/slack/messages/formatting_spec.rb +10 -0
  179. data/spec/slack/real_time/api/message_spec.rb +1 -1
  180. data/spec/slack/real_time/api/ping_spec.rb +1 -1
  181. data/spec/slack/real_time/api/typing_spec.rb +1 -1
  182. data/spec/slack/real_time/client_spec.rb +91 -127
  183. data/spec/slack/real_time/event_handlers/bot_spec.rb +19 -17
  184. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
  185. data/spec/slack/real_time/event_handlers/im_spec.rb +30 -27
  186. data/spec/slack/real_time/event_handlers/{group_spec.rb → private_channel_spec.rb} +35 -27
  187. data/spec/slack/real_time/event_handlers/{channel_spec.rb → public_channel_spec.rb} +27 -23
  188. data/spec/slack/real_time/event_handlers/team_spec.rb +7 -8
  189. data/spec/slack/real_time/event_handlers/user_spec.rb +6 -5
  190. data/spec/slack/real_time/stores/store_spec.rb +50 -0
  191. data/spec/slack/slack_spec.rb +5 -4
  192. data/spec/slack/version_spec.rb +1 -1
  193. data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +5 -0
  194. data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +8 -0
  195. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +31 -0
  196. data/spec/slack/web/api/endpoints/admin_roles_spec.rb +30 -0
  197. data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +8 -0
  198. data/spec/slack/web/api/endpoints/bookmarks_spec.rb +40 -0
  199. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +45 -17
  200. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +6 -2
  201. data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +33 -16
  202. data/spec/slack/web/api/endpoints/files_spec.rb +13 -0
  203. data/spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb +13 -0
  204. data/spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb +13 -0
  205. data/spec/slack/web/api/mixins/conversations_spec.rb +2 -0
  206. data/spec/slack/web/api/mixins/users_spec.rb +2 -0
  207. data/spec/slack/web/api/pagination/cursor_spec.rb +11 -7
  208. data/spec/slack/web/client_spec.rb +39 -11
  209. data/spec/slack/web/faraday/response/raise_error_spec.rb +1 -1
  210. data/spec/support/real_time/connected_client.rb +1 -1
  211. data/spec/support/real_time/loaded_client.rb +120 -0
  212. metadata +45 -197
  213. data/.travis.yml +0 -29
  214. data/bin/commands/admin_conversations_whitelist.rb +0 -37
  215. data/bin/commands/apps_permissions.rb +0 -23
  216. data/bin/commands/apps_permissions_resources.rb +0 -15
  217. data/bin/commands/apps_permissions_scopes.rb +0 -13
  218. data/bin/commands/apps_permissions_users.rb +0 -26
  219. data/bin/commands/channels.rb +0 -23
  220. data/bin/commands/groups.rb +0 -14
  221. data/bin/commands/im.rb +0 -6
  222. data/bin/commands/mpim.rb +0 -6
  223. data/bin/commands.rb +0 -66
  224. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +0 -64
  225. data/lib/slack/web/api/endpoints/apps_permissions.rb +0 -36
  226. data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +0 -31
  227. data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +0 -21
  228. data/lib/slack/web/api/endpoints/apps_permissions_users.rb +0 -50
  229. data/lib/slack/web/api/endpoints/channels.rb +0 -25
  230. data/lib/slack/web/api/endpoints/groups.rb +0 -13
  231. data/lib/slack/web/api/endpoints/im.rb +0 -13
  232. data/lib/slack/web/api/endpoints/mpim.rb +0 -13
  233. data/lib/slack/web/api/endpoints/presence.rb +0 -23
  234. data/lib/slack/web/api/patches/views.1.view-json.patch +0 -40
  235. data/lib/slack/web/api/patches/views.1.views-published.patch +0 -16
  236. data/lib/slack/web/api/templates/commands.erb +0 -6
  237. data/spec/fixtures/slack/web/rtm_start.yml +0 -815
  238. data/spec/slack/real_time/rtm_start_spec.rb +0 -14
  239. data/spec/slack/real_time/store_spec.rb +0 -12
@@ -1,253 +1,261 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'Conversations methods.'
5
- command 'conversations' do |g|
6
- g.desc 'Accepts an invitation to a Slack Connect channel.'
7
- g.long_desc %( Accepts an invitation to a Slack Connect channel. )
8
- g.command 'acceptSharedInvite' do |c|
9
- c.flag 'channel_name', desc: 'Name of the channel. If the channel does not exist already in your workspace, this name is the one that the channel will take.'
10
- c.flag 'channel_id', desc: "ID of the channel that you'd like to accept. Must provide either invite_id or channel_id."
11
- c.flag 'free_trial_accepted', desc: "Whether you'd like to use your workspace's free trial to begin using Slack Connect."
12
- c.flag 'invite_id', desc: 'See the shared_channel_invite_received event payload for more details on how to retrieve the ID of the invitation.'
13
- c.flag 'is_private', desc: 'Whether the channel should be private.'
14
- c.flag 'team_id', desc: 'The ID of the workspace to accept the channel in. If an org-level token is used to call this method, the team_id argument is required.'
15
- c.action do |_global_options, options, _args|
16
- puts JSON.dump($client.conversations_acceptSharedInvite(options))
17
- end
18
- end
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'Conversations methods.'
8
+ command 'conversations' do |g|
9
+ g.desc 'Accepts an invitation to a Slack Connect channel.'
10
+ g.long_desc %( Accepts an invitation to a Slack Connect channel. )
11
+ g.command 'acceptSharedInvite' do |c|
12
+ c.flag 'channel_name', desc: 'Name of the channel. If the channel does not exist already in your workspace, this name is the one that the channel will take.'
13
+ c.flag 'channel_id', desc: "ID of the channel that you'd like to accept. Must provide either invite_id or channel_id."
14
+ c.flag 'free_trial_accepted', desc: "Whether you'd like to use your workspace's free trial to begin using Slack Connect."
15
+ c.flag 'invite_id', desc: 'See the shared_channel_invite_received event payload for more details on how to retrieve the ID of the invitation.'
16
+ c.flag 'is_private', desc: 'Whether the channel should be private.'
17
+ c.flag 'team_id', desc: 'The ID of the workspace to accept the channel in. If an org-level token is used to call this method, the team_id argument is required.'
18
+ c.action do |_global_options, options, _args|
19
+ puts JSON.dump(@client.conversations_acceptSharedInvite(options))
20
+ end
21
+ end
19
22
 
20
- g.desc 'Approves an invitation to a Slack Connect channel'
21
- g.long_desc %( Approves an invitation to a Slack Connect channel )
22
- g.command 'approveSharedInvite' do |c|
23
- c.flag 'invite_id', desc: 'ID of the shared channel invite to approve.'
24
- c.flag 'target_team', desc: 'The team or enterprise id of the other party involved in the invitation you are approving.'
25
- c.action do |_global_options, options, _args|
26
- puts JSON.dump($client.conversations_approveSharedInvite(options))
27
- end
28
- end
23
+ g.desc 'Approves an invitation to a Slack Connect channel'
24
+ g.long_desc %( Approves an invitation to a Slack Connect channel )
25
+ g.command 'approveSharedInvite' do |c|
26
+ c.flag 'invite_id', desc: 'ID of the shared channel invite to approve.'
27
+ c.flag 'target_team', desc: 'The team or enterprise id of the other party involved in the invitation you are approving.'
28
+ c.action do |_global_options, options, _args|
29
+ puts JSON.dump(@client.conversations_approveSharedInvite(options))
30
+ end
31
+ end
29
32
 
30
- g.desc 'Archives a conversation.'
31
- g.long_desc %( Archives a conversation. )
32
- g.command 'archive' do |c|
33
- c.flag 'channel', desc: 'ID of conversation to archive.'
34
- c.action do |_global_options, options, _args|
35
- puts JSON.dump($client.conversations_archive(options))
36
- end
37
- end
33
+ g.desc 'Archives a conversation.'
34
+ g.long_desc %( Archives a conversation. )
35
+ g.command 'archive' do |c|
36
+ c.flag 'channel', desc: 'ID of conversation to archive.'
37
+ c.action do |_global_options, options, _args|
38
+ puts JSON.dump(@client.conversations_archive(options))
39
+ end
40
+ end
38
41
 
39
- g.desc 'Closes a direct message or multi-person direct message.'
40
- g.long_desc %( Closes a direct message or multi-person direct message. )
41
- g.command 'close' do |c|
42
- c.flag 'channel', desc: 'Conversation to close.'
43
- c.action do |_global_options, options, _args|
44
- puts JSON.dump($client.conversations_close(options))
45
- end
46
- end
42
+ g.desc 'Closes a direct message or multi-person direct message.'
43
+ g.long_desc %( Closes a direct message or multi-person direct message. )
44
+ g.command 'close' do |c|
45
+ c.flag 'channel', desc: 'Conversation to close.'
46
+ c.action do |_global_options, options, _args|
47
+ puts JSON.dump(@client.conversations_close(options))
48
+ end
49
+ end
47
50
 
48
- g.desc 'Initiates a public or private channel-based conversation'
49
- g.long_desc %( Initiates a public or private channel-based conversation )
50
- g.command 'create' do |c|
51
- c.flag 'name', desc: 'Name of the public or private channel to create.'
52
- c.flag 'is_private', desc: 'Create a private channel instead of a public one.'
53
- c.flag 'team_id', desc: 'encoded team id to create the channel in, required if org token is used.'
54
- c.action do |_global_options, options, _args|
55
- puts JSON.dump($client.conversations_create(options))
56
- end
57
- end
51
+ g.desc 'Initiates a public or private channel-based conversation'
52
+ g.long_desc %( Initiates a public or private channel-based conversation )
53
+ g.command 'create' do |c|
54
+ c.flag 'name', desc: 'Name of the public or private channel to create.'
55
+ c.flag 'is_private', desc: 'Create a private channel instead of a public one.'
56
+ c.flag 'team_id', desc: 'encoded team id to create the channel in, required if org token is used.'
57
+ c.action do |_global_options, options, _args|
58
+ puts JSON.dump(@client.conversations_create(options))
59
+ end
60
+ end
58
61
 
59
- g.desc 'Declines a Slack Connect channel invite.'
60
- g.long_desc %( Declines a Slack Connect channel invite. )
61
- g.command 'declineSharedInvite' do |c|
62
- c.flag 'invite_id', desc: 'ID of the Slack Connect invite to decline. Subscribe to the shared_channel_invite_accepted event to receive IDs of Slack Connect channel invites that have been accepted and are awaiting approval.'
63
- c.flag 'target_team', desc: 'The team or enterprise id of the other party involved in the invitation you are declining.'
64
- c.action do |_global_options, options, _args|
65
- puts JSON.dump($client.conversations_declineSharedInvite(options))
66
- end
67
- end
62
+ g.desc 'Declines a Slack Connect channel invite.'
63
+ g.long_desc %( Declines a Slack Connect channel invite. )
64
+ g.command 'declineSharedInvite' do |c|
65
+ c.flag 'invite_id', desc: 'ID of the Slack Connect invite to decline. Subscribe to the shared_channel_invite_accepted event to receive IDs of Slack Connect channel invites that have been accepted and are awaiting approval.'
66
+ c.flag 'target_team', desc: 'The team or enterprise id of the other party involved in the invitation you are declining.'
67
+ c.action do |_global_options, options, _args|
68
+ puts JSON.dump(@client.conversations_declineSharedInvite(options))
69
+ end
70
+ end
68
71
 
69
- g.desc "Fetches a conversation's history of messages and events."
70
- g.long_desc %( Fetches a conversation's history of messages and events. )
71
- g.command 'history' do |c|
72
- c.flag 'channel', desc: 'Conversation ID to fetch history for.'
73
- 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."
74
- c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results only when either timestamp is specified.'
75
- c.flag 'latest', desc: 'End of time range of messages to include in results. Default is the current time.'
76
- 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."
77
- c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
78
- c.action do |_global_options, options, _args|
79
- puts JSON.dump($client.conversations_history(options))
80
- end
81
- end
72
+ g.desc "Fetches a conversation's history of messages and events."
73
+ g.long_desc %( Fetches a conversation's history of messages and events. )
74
+ g.command 'history' do |c|
75
+ c.flag 'channel', desc: 'Conversation ID to fetch history for.'
76
+ 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."
77
+ c.flag 'include_all_metadata', desc: 'Return all metadata associated with this message.'
78
+ c.flag 'inclusive', desc: 'Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified.'
79
+ c.flag 'latest', desc: 'Only messages before this Unix timestamp will be included in results. Default is the current time.'
80
+ 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."
81
+ c.flag 'oldest', desc: 'Only messages after this Unix timestamp will be included in results.'
82
+ c.action do |_global_options, options, _args|
83
+ puts JSON.dump(@client.conversations_history(options))
84
+ end
85
+ end
82
86
 
83
- g.desc 'Retrieve information about a conversation.'
84
- g.long_desc %( Retrieve information about a conversation. )
85
- g.command 'info' do |c|
86
- c.flag 'channel', desc: 'Conversation ID to learn more about.'
87
- c.flag 'include_locale', desc: 'Set this to true to receive the locale for this conversation. Defaults to false.'
88
- c.flag 'include_num_members', desc: 'Set to true to include the member count for the specified conversation. Defaults to false.'
89
- c.action do |_global_options, options, _args|
90
- puts JSON.dump($client.conversations_info(options))
91
- end
92
- end
87
+ g.desc 'Retrieve information about a conversation.'
88
+ g.long_desc %( Retrieve information about a conversation. )
89
+ g.command 'info' do |c|
90
+ c.flag 'channel', desc: 'Conversation ID to learn more about.'
91
+ c.flag 'include_locale', desc: 'Set this to true to receive the locale for this conversation. Defaults to false.'
92
+ c.flag 'include_num_members', desc: 'Set to true to include the member count for the specified conversation. Defaults to false.'
93
+ c.action do |_global_options, options, _args|
94
+ puts JSON.dump(@client.conversations_info(options))
95
+ end
96
+ end
93
97
 
94
- g.desc 'Invites users to a channel.'
95
- g.long_desc %( Invites users to a channel. )
96
- g.command 'invite' do |c|
97
- c.flag 'channel', desc: 'The ID of the public or private channel to invite user(s) to.'
98
- c.flag 'users', desc: 'A comma separated list of user IDs. Up to 1000 users may be listed.'
99
- c.action do |_global_options, options, _args|
100
- puts JSON.dump($client.conversations_invite(options))
101
- end
102
- end
98
+ g.desc 'Invites users to a channel.'
99
+ g.long_desc %( Invites users to a channel. )
100
+ g.command 'invite' do |c|
101
+ c.flag 'channel', desc: 'The ID of the public or private channel to invite user(s) to.'
102
+ c.flag 'users', desc: 'A comma separated list of user IDs. Up to 1000 users may be listed.'
103
+ c.action do |_global_options, options, _args|
104
+ puts JSON.dump(@client.conversations_invite(options))
105
+ end
106
+ end
103
107
 
104
- g.desc 'Sends an invitation to a Slack Connect channel'
105
- g.long_desc %( Sends an invitation to a Slack Connect channel )
106
- g.command 'inviteShared' do |c|
107
- c.flag 'channel', desc: "ID of the channel on your team that you'd like to share."
108
- c.flag 'emails', desc: 'Optional email to receive this invite. Either emails or user_ids must be provided.'
109
- c.flag 'external_limited', desc: 'Optional boolean on whether invite is to a external limited member. Defaults to true.'
110
- c.flag 'user_ids', desc: 'Optional user_id to receive this invite. Either emails or user_ids must be provided.'
111
- c.action do |_global_options, options, _args|
112
- puts JSON.dump($client.conversations_inviteShared(options))
113
- end
114
- end
108
+ g.desc 'Sends an invitation to a Slack Connect channel'
109
+ g.long_desc %( Sends an invitation to a Slack Connect channel )
110
+ g.command 'inviteShared' do |c|
111
+ c.flag 'channel', desc: "ID of the channel on your team that you'd like to share."
112
+ c.flag 'emails', desc: 'Optional email to receive this invite. Either emails or user_ids must be provided.'
113
+ c.flag 'external_limited', desc: 'Optional boolean on whether invite is to a external limited member. Defaults to true.'
114
+ c.flag 'user_ids', desc: 'Optional user_id to receive this invite. Either emails or user_ids must be provided.'
115
+ c.action do |_global_options, options, _args|
116
+ puts JSON.dump(@client.conversations_inviteShared(options))
117
+ end
118
+ end
115
119
 
116
- g.desc 'Joins an existing conversation.'
117
- g.long_desc %( Joins an existing conversation. )
118
- g.command 'join' do |c|
119
- c.flag 'channel', desc: 'ID of conversation to join.'
120
- c.action do |_global_options, options, _args|
121
- puts JSON.dump($client.conversations_join(options))
122
- end
123
- end
120
+ g.desc 'Joins an existing conversation.'
121
+ g.long_desc %( Joins an existing conversation. )
122
+ g.command 'join' do |c|
123
+ c.flag 'channel', desc: 'ID of conversation to join.'
124
+ c.action do |_global_options, options, _args|
125
+ puts JSON.dump(@client.conversations_join(options))
126
+ end
127
+ end
124
128
 
125
- g.desc 'Removes a user from a conversation.'
126
- g.long_desc %( Removes a user from a conversation. )
127
- g.command 'kick' do |c|
128
- c.flag 'channel', desc: 'ID of conversation to remove user from.'
129
- c.flag 'user', desc: 'User ID to be removed.'
130
- c.action do |_global_options, options, _args|
131
- puts JSON.dump($client.conversations_kick(options))
132
- end
133
- end
129
+ g.desc 'Removes a user from a conversation.'
130
+ g.long_desc %( Removes a user from a conversation. )
131
+ g.command 'kick' do |c|
132
+ c.flag 'channel', desc: 'ID of conversation to remove user from.'
133
+ c.flag 'user', desc: 'User ID to be removed.'
134
+ c.action do |_global_options, options, _args|
135
+ puts JSON.dump(@client.conversations_kick(options))
136
+ end
137
+ end
134
138
 
135
- g.desc 'Leaves a conversation.'
136
- g.long_desc %( Leaves a conversation. )
137
- g.command 'leave' do |c|
138
- c.flag 'channel', desc: 'Conversation to leave.'
139
- c.action do |_global_options, options, _args|
140
- puts JSON.dump($client.conversations_leave(options))
141
- end
142
- end
139
+ g.desc 'Leaves a conversation.'
140
+ g.long_desc %( Leaves a conversation. )
141
+ g.command 'leave' do |c|
142
+ c.flag 'channel', desc: 'Conversation to leave.'
143
+ c.action do |_global_options, options, _args|
144
+ puts JSON.dump(@client.conversations_leave(options))
145
+ end
146
+ end
143
147
 
144
- g.desc 'Lists all channels in a Slack team.'
145
- g.long_desc %( Lists all channels in a Slack team. )
146
- g.command 'list' do |c|
147
- 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
- c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
149
- 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."
150
- c.flag 'team_id', desc: 'encoded team id to list channels in, required if token belongs to org-wide app.'
151
- 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.'
152
- c.action do |_global_options, options, _args|
153
- puts JSON.dump($client.conversations_list(options))
154
- end
155
- end
148
+ g.desc 'Lists all channels in a Slack team.'
149
+ g.long_desc %( Lists all channels in a Slack team. )
150
+ g.command 'list' do |c|
151
+ 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."
152
+ c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
153
+ 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."
154
+ c.flag 'team_id', desc: 'encoded team id to list channels in, required if token belongs to org-wide app.'
155
+ 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.'
156
+ c.action do |_global_options, options, _args|
157
+ puts JSON.dump(@client.conversations_list(options))
158
+ end
159
+ end
156
160
 
157
- g.desc 'Lists shared channel invites that have been generated or received but have not been approved by all parties'
158
- g.long_desc %( Lists shared channel invites that have been generated or received but have not been approved by all parties )
159
- g.command 'listConnectInvites' do |c|
160
- c.flag 'cursor', desc: 'Set to next_cursor returned by previous call to list items in subsequent page.'
161
- c.flag 'team_id', desc: 'Encoded team id for the workspace to retrieve invites for, required if org token is used.'
162
- c.action do |_global_options, options, _args|
163
- puts JSON.dump($client.conversations_listConnectInvites(options))
164
- end
165
- end
161
+ g.desc 'Lists shared channel invites that have been generated or received but have not been approved by all parties'
162
+ g.long_desc %( Lists shared channel invites that have been generated or received but have not been approved by all parties )
163
+ g.command 'listConnectInvites' do |c|
164
+ c.flag 'cursor', desc: 'Set to next_cursor returned by previous call to list items in subsequent page.'
165
+ c.flag 'team_id', desc: 'Encoded team id for the workspace to retrieve invites for, required if org token is used.'
166
+ c.action do |_global_options, options, _args|
167
+ puts JSON.dump(@client.conversations_listConnectInvites(options))
168
+ end
169
+ end
166
170
 
167
- g.desc 'Sets the read cursor in a channel.'
168
- g.long_desc %( Sets the read cursor in a channel. )
169
- g.command 'mark' do |c|
170
- c.flag 'channel', desc: 'Channel or conversation to set the read cursor for.'
171
- c.flag 'ts', desc: 'Unique identifier of message you want marked as most recently seen in this conversation.'
172
- c.action do |_global_options, options, _args|
173
- puts JSON.dump($client.conversations_mark(options))
174
- end
175
- end
171
+ g.desc 'Sets the read cursor in a channel.'
172
+ g.long_desc %( Sets the read cursor in a channel. )
173
+ g.command 'mark' do |c|
174
+ c.flag 'channel', desc: 'Channel or conversation to set the read cursor for.'
175
+ c.flag 'ts', desc: 'Unique identifier of message you want marked as most recently seen in this conversation.'
176
+ c.action do |_global_options, options, _args|
177
+ puts JSON.dump(@client.conversations_mark(options))
178
+ end
179
+ end
176
180
 
177
- g.desc 'Retrieve members of a conversation.'
178
- g.long_desc %( Retrieve members of a conversation. )
179
- g.command 'members' do |c|
180
- c.flag 'channel', desc: 'ID of the conversation to retrieve members for.'
181
- 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."
182
- 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."
183
- c.action do |_global_options, options, _args|
184
- puts JSON.dump($client.conversations_members(options))
185
- end
186
- end
181
+ g.desc 'Retrieve members of a conversation.'
182
+ g.long_desc %( Retrieve members of a conversation. )
183
+ g.command 'members' do |c|
184
+ c.flag 'channel', desc: 'ID of the conversation to retrieve members for.'
185
+ 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."
186
+ 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."
187
+ c.action do |_global_options, options, _args|
188
+ puts JSON.dump(@client.conversations_members(options))
189
+ end
190
+ end
187
191
 
188
- g.desc 'Opens or resumes a direct message or multi-person direct message.'
189
- g.long_desc %( Opens or resumes a direct message or multi-person direct message. )
190
- g.command 'open' do |c|
191
- c.flag 'channel', desc: "Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead."
192
- c.flag 'prevent_creation', desc: 'Do not create a direct message or multi-person direct message. This is used to see if there is an existing dm or mpdm.'
193
- c.flag 'return_im', desc: 'Boolean, indicates you want the full IM channel definition in the response.'
194
- c.flag 'users', desc: 'Comma separated lists of users. If only one user is included, this creates a 1:1 DM. The ordering of the users is preserved whenever a multi-person direct message is returned. Supply a channel when not supplying users.'
195
- c.action do |_global_options, options, _args|
196
- puts JSON.dump($client.conversations_open(options))
197
- end
198
- end
192
+ g.desc 'Opens or resumes a direct message or multi-person direct message.'
193
+ g.long_desc %( Opens or resumes a direct message or multi-person direct message. )
194
+ g.command 'open' do |c|
195
+ c.flag 'channel', desc: "Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead."
196
+ c.flag 'prevent_creation', desc: 'Do not create a direct message or multi-person direct message. This is used to see if there is an existing dm or mpdm.'
197
+ c.flag 'return_im', desc: 'Boolean, indicates you want the full IM channel definition in the response.'
198
+ c.flag 'users', desc: 'Comma separated lists of users. If only one user is included, this creates a 1:1 DM. The ordering of the users is preserved whenever a multi-person direct message is returned. Supply a channel when not supplying users.'
199
+ c.action do |_global_options, options, _args|
200
+ puts JSON.dump(@client.conversations_open(options))
201
+ end
202
+ end
199
203
 
200
- g.desc 'Renames a conversation.'
201
- g.long_desc %( Renames a conversation. )
202
- g.command 'rename' do |c|
203
- c.flag 'channel', desc: 'ID of conversation to rename.'
204
- c.flag 'name', desc: 'New name for conversation.'
205
- c.action do |_global_options, options, _args|
206
- puts JSON.dump($client.conversations_rename(options))
207
- end
208
- end
204
+ g.desc 'Renames a conversation.'
205
+ g.long_desc %( Renames a conversation. )
206
+ g.command 'rename' do |c|
207
+ c.flag 'channel', desc: 'ID of conversation to rename.'
208
+ c.flag 'name', desc: 'New name for conversation.'
209
+ c.action do |_global_options, options, _args|
210
+ puts JSON.dump(@client.conversations_rename(options))
211
+ end
212
+ end
209
213
 
210
- g.desc 'Retrieve a thread of messages posted to a conversation'
211
- g.long_desc %( Retrieve a thread of messages posted to a conversation )
212
- g.command 'replies' do |c|
213
- c.flag 'channel', desc: 'Conversation ID to fetch thread from.'
214
- 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."
215
- 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."
216
- c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results only when either timestamp is specified.'
217
- c.flag 'latest', desc: 'End of time range of messages to include in results.'
218
- 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."
219
- c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
220
- c.action do |_global_options, options, _args|
221
- puts JSON.dump($client.conversations_replies(options))
222
- end
223
- end
214
+ g.desc 'Retrieve a thread of messages posted to a conversation'
215
+ g.long_desc %( Retrieve a thread of messages posted to a conversation )
216
+ g.command 'replies' do |c|
217
+ c.flag 'channel', desc: 'Conversation ID to fetch thread from.'
218
+ 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."
219
+ 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."
220
+ c.flag 'include_all_metadata', desc: 'Return all metadata associated with this message.'
221
+ c.flag 'inclusive', desc: 'Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified.'
222
+ c.flag 'latest', desc: 'Only messages before this Unix timestamp will be included in results.'
223
+ 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."
224
+ c.flag 'oldest', desc: 'Only messages after this Unix timestamp will be included in results.'
225
+ c.action do |_global_options, options, _args|
226
+ puts JSON.dump(@client.conversations_replies(options))
227
+ end
228
+ end
224
229
 
225
- g.desc 'Sets the purpose for a conversation.'
226
- g.long_desc %( Sets the purpose for a conversation. )
227
- g.command 'setPurpose' do |c|
228
- c.flag 'channel', desc: 'Conversation to set the purpose of.'
229
- c.flag 'purpose', desc: 'A new, specialer purpose.'
230
- c.action do |_global_options, options, _args|
231
- puts JSON.dump($client.conversations_setPurpose(options))
232
- end
233
- end
230
+ g.desc 'Sets the purpose for a conversation.'
231
+ g.long_desc %( Sets the purpose for a conversation. )
232
+ g.command 'setPurpose' do |c|
233
+ c.flag 'channel', desc: 'Conversation to set the purpose of.'
234
+ c.flag 'purpose', desc: 'A new, specialer purpose.'
235
+ c.action do |_global_options, options, _args|
236
+ puts JSON.dump(@client.conversations_setPurpose(options))
237
+ end
238
+ end
234
239
 
235
- g.desc 'Sets the topic for a conversation.'
236
- g.long_desc %( Sets the topic for a conversation. )
237
- g.command 'setTopic' do |c|
238
- c.flag 'channel', desc: 'Conversation to set the topic of.'
239
- c.flag 'topic', desc: 'The new topic string. Does not support formatting or linkification.'
240
- c.action do |_global_options, options, _args|
241
- puts JSON.dump($client.conversations_setTopic(options))
242
- end
243
- end
240
+ g.desc 'Sets the topic for a conversation.'
241
+ g.long_desc %( Sets the topic for a conversation. )
242
+ g.command 'setTopic' do |c|
243
+ c.flag 'channel', desc: 'Conversation to set the topic of.'
244
+ c.flag 'topic', desc: 'The new topic string. Does not support formatting or linkification.'
245
+ c.action do |_global_options, options, _args|
246
+ puts JSON.dump(@client.conversations_setTopic(options))
247
+ end
248
+ end
244
249
 
245
- g.desc 'Reverses conversation archival.'
246
- g.long_desc %( Reverses conversation archival. )
247
- g.command 'unarchive' do |c|
248
- c.flag 'channel', desc: 'ID of conversation to unarchive.'
249
- c.action do |_global_options, options, _args|
250
- puts JSON.dump($client.conversations_unarchive(options))
250
+ g.desc 'Reverses conversation archival.'
251
+ g.long_desc %( Reverses conversation archival. )
252
+ g.command 'unarchive' do |c|
253
+ c.flag 'channel', desc: 'ID of conversation to unarchive.'
254
+ c.action do |_global_options, options, _args|
255
+ puts JSON.dump(@client.conversations_unarchive(options))
256
+ end
257
+ end
258
+ end
251
259
  end
252
260
  end
253
261
  end
@@ -1,15 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'Dialog methods.'
5
- command 'dialog' do |g|
6
- g.desc 'Open a dialog with a user'
7
- g.long_desc %( Open a dialog with a user )
8
- g.command 'open' do |c|
9
- c.flag 'dialog', desc: 'The dialog definition. This must be a JSON-encoded string.'
10
- c.flag 'trigger_id', desc: 'Exchange a trigger to post to the user.'
11
- c.action do |_global_options, options, _args|
12
- puts JSON.dump($client.dialog_open(options))
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'Dialog methods.'
8
+ command 'dialog' do |g|
9
+ g.desc 'Open a dialog with a user'
10
+ g.long_desc %( Open a dialog with a user )
11
+ g.command 'open' do |c|
12
+ c.flag 'dialog', desc: 'The dialog definition. This must be a JSON-encoded string.'
13
+ c.flag 'trigger_id', desc: 'Exchange a trigger to post to the user.'
14
+ c.action do |_global_options, options, _args|
15
+ puts JSON.dump(@client.dialog_open(options))
16
+ end
17
+ end
18
+ end
13
19
  end
14
20
  end
15
21
  end