slack-ruby-client 0.17.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -0
  3. data/.rubocop_todo.yml +65 -31
  4. data/.travis.yml +1 -0
  5. data/CHANGELOG.md +10 -0
  6. data/CONTRIBUTING.md +3 -3
  7. data/README.md +5 -5
  8. data/RELEASING.md +1 -1
  9. data/UPGRADING.md +42 -0
  10. data/bin/commands/admin_apps.rb +11 -0
  11. data/bin/commands/admin_apps_requests.rb +1 -0
  12. data/bin/commands/admin_auth_policy.rb +39 -0
  13. data/bin/commands/admin_conversations.rb +10 -0
  14. data/bin/commands/admin_conversations_restrictAccess.rb +1 -1
  15. data/bin/commands/admin_users.rb +1 -0
  16. data/bin/commands/admin_users_session.rb +40 -0
  17. data/bin/commands/apps_manifest.rb +51 -0
  18. data/bin/commands/chat.rb +9 -6
  19. data/bin/commands/conversations.rb +59 -2
  20. data/bin/commands/dnd.rb +1 -1
  21. data/bin/commands/files.rb +2 -1
  22. data/bin/commands/oauth.rb +0 -13
  23. data/bin/commands/oauth_v2.rb +13 -1
  24. data/bin/commands/openid_connect.rb +27 -0
  25. data/bin/commands/pins.rb +2 -2
  26. data/bin/commands/reminders.rb +6 -0
  27. data/bin/commands/rtm.rb +2 -2
  28. data/bin/commands/search.rb +2 -1
  29. data/bin/commands/stars.rb +7 -6
  30. data/bin/commands/team_billing.rb +13 -0
  31. data/bin/commands/team_preferences.rb +13 -0
  32. data/bin/commands/tooling_tokens.rb +14 -0
  33. data/bin/commands/usergroups.rb +1 -1
  34. data/bin/commands/users.rb +1 -1
  35. data/bin/commands/views.rb +1 -1
  36. data/bin/commands.rb +6 -8
  37. data/lib/slack/config.rb +1 -2
  38. data/lib/slack/events/request.rb +3 -1
  39. data/lib/slack/real_time/client.rb +4 -5
  40. data/lib/slack/real_time/concurrency/async.rb +6 -8
  41. data/lib/slack/real_time/socket.rb +1 -2
  42. data/lib/slack/real_time/stores/base.rb +1 -6
  43. data/lib/slack/real_time/stores/starter.rb +6 -3
  44. data/lib/slack/real_time/stores/store.rb +5 -0
  45. data/lib/slack/version.rb +1 -1
  46. data/lib/slack/web/api/endpoints/admin_analytics.rb +3 -3
  47. data/lib/slack/web/api/endpoints/admin_apps.rb +21 -5
  48. data/lib/slack/web/api/endpoints/admin_apps_approved.rb +2 -2
  49. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +4 -2
  50. data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +2 -2
  51. data/lib/slack/web/api/endpoints/admin_auth_policy.rb +72 -0
  52. data/lib/slack/web/api/endpoints/admin_barriers.rb +6 -6
  53. data/lib/slack/web/api/endpoints/admin_conversations.rb +38 -24
  54. data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +4 -4
  55. data/lib/slack/web/api/endpoints/admin_emoji.rb +9 -9
  56. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +7 -7
  57. data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +3 -3
  58. data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +2 -2
  59. data/lib/slack/web/api/endpoints/admin_teams.rb +6 -6
  60. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +2 -2
  61. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +2 -2
  62. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +5 -5
  63. data/lib/slack/web/api/endpoints/admin_usergroups.rb +10 -10
  64. data/lib/slack/web/api/endpoints/admin_users.rb +20 -18
  65. data/lib/slack/web/api/endpoints/admin_users_session.rb +65 -9
  66. data/lib/slack/web/api/endpoints/api.rb +1 -1
  67. data/lib/slack/web/api/endpoints/apps.rb +2 -2
  68. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +3 -3
  69. data/lib/slack/web/api/endpoints/apps_manifest.rb +75 -0
  70. data/lib/slack/web/api/endpoints/auth.rb +1 -1
  71. data/lib/slack/web/api/endpoints/auth_teams.rb +3 -3
  72. data/lib/slack/web/api/endpoints/bots.rb +2 -2
  73. data/lib/slack/web/api/endpoints/calls.rb +15 -15
  74. data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
  75. data/lib/slack/web/api/endpoints/chat.rb +60 -54
  76. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +3 -3
  77. data/lib/slack/web/api/endpoints/conversations.rb +115 -25
  78. data/lib/slack/web/api/endpoints/dialog.rb +2 -2
  79. data/lib/slack/web/api/endpoints/dnd.rb +4 -5
  80. data/lib/slack/web/api/endpoints/files.rb +16 -14
  81. data/lib/slack/web/api/endpoints/files_comments.rb +1 -1
  82. data/lib/slack/web/api/endpoints/files_remote.rb +20 -20
  83. data/lib/slack/web/api/endpoints/migration.rb +3 -3
  84. data/lib/slack/web/api/endpoints/oauth.rb +5 -27
  85. data/lib/slack/web/api/endpoints/oauth_v2.rb +24 -6
  86. data/lib/slack/web/api/endpoints/openid_connect.rb +42 -0
  87. data/lib/slack/web/api/endpoints/pins.rb +4 -4
  88. data/lib/slack/web/api/endpoints/reactions.rb +12 -12
  89. data/lib/slack/web/api/endpoints/reminders.rb +17 -5
  90. data/lib/slack/web/api/endpoints/rtm.rb +10 -10
  91. data/lib/slack/web/api/endpoints/search.rb +24 -16
  92. data/lib/slack/web/api/endpoints/stars.rb +11 -9
  93. data/lib/slack/web/api/endpoints/team.rb +8 -8
  94. data/lib/slack/web/api/endpoints/team_billing.rb +21 -0
  95. data/lib/slack/web/api/endpoints/team_preferences.rb +21 -0
  96. data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
  97. data/lib/slack/web/api/endpoints/tooling_tokens.rb +24 -0
  98. data/lib/slack/web/api/endpoints/usergroups.rb +19 -19
  99. data/lib/slack/web/api/endpoints/usergroups_users.rb +7 -7
  100. data/lib/slack/web/api/endpoints/users.rb +16 -16
  101. data/lib/slack/web/api/endpoints/users_profile.rb +4 -4
  102. data/lib/slack/web/api/endpoints/views.rb +12 -12
  103. data/lib/slack/web/api/endpoints/workflows.rb +9 -9
  104. data/lib/slack/web/api/endpoints.rb +12 -18
  105. data/lib/slack/web/api/errors/server_error.rb +37 -0
  106. data/lib/slack/web/api/errors/too_many_requests_error.rb +1 -4
  107. data/lib/slack/web/api/errors.rb +200 -8
  108. data/lib/slack/web/api/mixins.rb +0 -2
  109. data/lib/slack/web/api/patches/chat.1.patch +1 -2
  110. data/lib/slack/web/api/templates/endpoints.erb +0 -2
  111. data/lib/slack/web/faraday/request.rb +2 -1
  112. data/lib/slack/web/faraday/response/raise_error.rb +1 -1
  113. data/lib/slack/web/faraday/response/wrap_error.rb +2 -2
  114. data/lib/slack/web/pagination/cursor.rb +1 -5
  115. data/lib/slack-ruby-client.rb +1 -1
  116. data/slack-ruby-client.gemspec +2 -3
  117. data/spec/fixtures/slack/web/429_error.yml +50 -54
  118. data/spec/fixtures/slack/web/auth_test_error.yml +51 -18
  119. data/spec/fixtures/slack/web/auth_test_success.yml +50 -26
  120. data/spec/fixtures/slack/web/conversations_info.yml +133 -9
  121. data/spec/fixtures/slack/web/conversations_setTopic.yml +42 -27
  122. data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +89 -59
  123. data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +131 -86
  124. data/spec/fixtures/slack/web/paginated_users_list.yml +501 -69
  125. data/spec/fixtures/slack/web/rtm_connect.yml +267 -30
  126. data/spec/fixtures/slack/web/rtm_start.yml +771 -60
  127. data/spec/fixtures/slack/web/users_info.yml +153 -69
  128. data/spec/fixtures/slack/web/users_list.yml +102 -41
  129. data/spec/fixtures/slack/web/views_open_error.yml +49 -42
  130. data/spec/slack/real_time/client_spec.rb +17 -21
  131. data/spec/slack/real_time/event_handlers/bot_spec.rb +1 -1
  132. data/spec/slack/real_time/event_handlers/channel_spec.rb +1 -1
  133. data/spec/slack/real_time/event_handlers/im_spec.rb +5 -5
  134. data/spec/slack/real_time/event_handlers/user_spec.rb +2 -2
  135. data/spec/slack/slack_spec.rb +3 -1
  136. data/spec/slack/web/api/endpoints/admin_apps_spec.rb +5 -0
  137. data/spec/slack/web/api/endpoints/admin_auth_policy_spec.rb +35 -0
  138. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +14 -9
  139. data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +1 -1
  140. data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +6 -6
  141. data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +22 -2
  142. data/spec/slack/web/api/endpoints/admin_users_spec.rb +8 -8
  143. data/spec/slack/web/api/endpoints/apps_manifest_spec.rb +36 -0
  144. data/spec/slack/web/api/endpoints/apps_spec.rb +2 -2
  145. data/spec/slack/web/api/endpoints/calls_participants_spec.rb +4 -4
  146. data/spec/slack/web/api/endpoints/calls_spec.rb +2 -2
  147. data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +4 -6
  148. data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +1 -1
  149. data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +2 -2
  150. data/spec/slack/web/api/endpoints/dnd_spec.rb +0 -5
  151. data/spec/slack/web/api/endpoints/files_comments_spec.rb +2 -2
  152. data/spec/slack/web/api/endpoints/files_remote_spec.rb +3 -3
  153. data/spec/slack/web/api/endpoints/oauth_spec.rb +0 -11
  154. data/spec/slack/web/api/endpoints/oauth_v2_spec.rb +6 -3
  155. data/spec/slack/web/api/endpoints/{im_spec.rb → openid_connect_spec.rb} +1 -1
  156. data/spec/slack/web/api/endpoints/reactions_spec.rb +3 -3
  157. data/spec/slack/web/api/endpoints/reminders_spec.rb +2 -2
  158. data/spec/slack/web/api/endpoints/{mpim_spec.rb → team_billing_spec.rb} +1 -1
  159. data/spec/slack/web/api/endpoints/{apps_permissions_scopes_spec.rb → team_preferences_spec.rb} +1 -1
  160. data/spec/slack/web/api/endpoints/tooling_tokens_spec.rb +13 -0
  161. data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +2 -2
  162. data/spec/slack/web/api/error_spec.rb +5 -7
  163. data/spec/slack/web/api/errors/slack_error_spec.rb +21 -26
  164. data/spec/slack/web/api/mixins/conversations_list_spec.rb +1 -1
  165. data/spec/slack/web/api/pagination/cursor_spec.rb +1 -3
  166. data/spec/slack/web/client_spec.rb +7 -6
  167. data/spec/slack/web/faraday/request_spec.rb +80 -0
  168. data/spec/slack/web/faraday/response/raise_error_spec.rb +1 -0
  169. data/spec/spec_helper.rb +1 -1
  170. data/spec/support/real_time/connected_client.rb +1 -7
  171. data/spec/support/vcr.rb +33 -2
  172. metadata +28 -144
  173. data/lib/slack/web/api/errors/internal_error.rb +0 -14
  174. data/lib/slack/web/api/mixins/channels.id.json +0 -20
  175. data/lib/slack/web/api/mixins/channels.id.rb +0 -25
  176. data/lib/slack/web/api/mixins/groups.id.json +0 -20
  177. data/lib/slack/web/api/mixins/groups.id.rb +0 -25
  178. data/spec/fixtures/slack/web/503_error.yml +0 -14
  179. data/spec/fixtures/slack/web/channels_info.yml +0 -139
  180. data/spec/slack/web/api/endpoints/apps_permissions_resources_spec.rb +0 -8
  181. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +0 -16
  182. data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +0 -19
  183. data/spec/slack/web/api/endpoints/conversations_spec.rb +0 -109
  184. data/spec/slack/web/api/mixins/channels_spec.rb +0 -43
  185. data/spec/slack/web/api/mixins/groups_spec.rb +0 -43
@@ -31,7 +31,7 @@ module Slack
31
31
  # Channel containing the message to be deleted.
32
32
  # @option options [timestamp] :ts
33
33
  # Timestamp of the message to be deleted.
34
- # @option options [Object] :as_user
34
+ # @option options [boolean] :as_user
35
35
  # Pass true to delete the message as the authed user with chat:write:user scope. Bot users in this context are considered authed users. If unused or false, the message will be deleted with chat:write:bot scope.
36
36
  # @see https://api.slack.com/methods/chat.delete
37
37
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.delete.json
@@ -47,9 +47,9 @@ module Slack
47
47
  #
48
48
  # @option options [channel] :channel
49
49
  # The channel the scheduled_message is posting to.
50
- # @option options [Object] :scheduled_message_id
50
+ # @option options [string] :scheduled_message_id
51
51
  # scheduled_message_id returned from call to chat.scheduleMessage.
52
- # @option options [Object] :as_user
52
+ # @option options [boolean] :as_user
53
53
  # Pass true to delete the message as the authed user with chat:write:user scope. Bot users in this context are considered authed users. If unused or false, the message will be deleted with chat:write:bot scope.
54
54
  # @see https://api.slack.com/methods/chat.deleteScheduledMessage
55
55
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.deleteScheduledMessage.json
@@ -65,7 +65,7 @@ module Slack
65
65
  #
66
66
  # @option options [channel] :channel
67
67
  # The ID of the conversation or channel containing the message.
68
- # @option options [Object] :message_ts
68
+ # @option options [string] :message_ts
69
69
  # A message's ts value, uniquely identifying it within a channel.
70
70
  # @see https://api.slack.com/methods/chat.getPermalink
71
71
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.getPermalink.json
@@ -81,7 +81,7 @@ module Slack
81
81
  #
82
82
  # @option options [channel] :channel
83
83
  # Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.
84
- # @option options [Object] :text
84
+ # @option options [string] :text
85
85
  # Text of the message to send.
86
86
  # @see https://api.slack.com/methods/chat.meMessage
87
87
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.meMessage.json
@@ -94,29 +94,29 @@ module Slack
94
94
  #
95
95
  # Sends an ephemeral message to a user in a channel.
96
96
  #
97
- # @option options [Object] :attachments
98
- # A JSON-based array of structured attachments, presented as a URL-encoded string.
99
97
  # @option options [channel] :channel
100
98
  # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
101
- # @option options [Object] :text
99
+ # @option options [string] :text
102
100
  # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
103
101
  # @option options [user] :user
104
102
  # id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.
105
- # @option options [Object] :as_user
103
+ # @option options [boolean] :as_user
106
104
  # 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.
107
- # @option options [Object] :blocks
105
+ # @option options [string] :attachments
106
+ # A JSON-based array of structured attachments, presented as a URL-encoded string.
107
+ # @option options [blocks[] as string] :blocks
108
108
  # A JSON-based array of structured blocks, presented as a URL-encoded string.
109
- # @option options [Object] :icon_emoji
109
+ # @option options [string] :icon_emoji
110
110
  # 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.
111
- # @option options [Object] :icon_url
111
+ # @option options [string] :icon_url
112
112
  # 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.
113
- # @option options [Object] :link_names
113
+ # @option options [boolean] :link_names
114
114
  # Find and link channel names and usernames.
115
- # @option options [Object] :parse
115
+ # @option options [string] :parse
116
116
  # Change how messages are treated. Defaults to none. See below.
117
- # @option options [Object] :thread_ts
117
+ # @option options [string] :thread_ts
118
118
  # Provide another message's ts value to post this message in a thread. Avoid using a reply's ts value; use its parent's value instead. Ephemeral messages in threads are only shown if there is already an active thread.
119
- # @option options [Object] :username
119
+ # @option options [string] :username
120
120
  # Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
121
121
  # @see https://api.slack.com/methods/chat.postEphemeral
122
122
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
@@ -145,35 +145,33 @@ module Slack
145
145
  #
146
146
  # @option options [channel] :channel
147
147
  # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
148
- # @option options [Object] :as_user
149
- # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
150
- # @option options [Object] :attachments
148
+ # @option options [string] :attachments
151
149
  # A JSON-based array of structured attachments, presented as a URL-encoded string.
152
- # @option options [Object] :blocks
150
+ # @option options [blocks[] as string] :blocks
153
151
  # A JSON-based array of structured blocks, presented as a URL-encoded string.
154
- # @option options [Object] :draft_id
155
- # The id of the draft associated with the message.
156
- # @option options [Object] :icon_emoji
152
+ # @option options [string] :text
153
+ # The formatted text of the message to be published. If blocks are included, this will become the fallback text used in notifications.
154
+ # @option options [boolean] :as_user
155
+ # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
156
+ # @option options [string] :icon_emoji
157
157
  # 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.
158
- # @option options [Object] :icon_url
158
+ # @option options [string] :icon_url
159
159
  # 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.
160
- # @option options [Object] :link_names
160
+ # @option options [boolean] :link_names
161
161
  # Find and link channel names and usernames.
162
- # @option options [Object] :mrkdwn
162
+ # @option options [boolean] :mrkdwn
163
163
  # Disable Slack markup parsing by setting to false. Enabled by default.
164
- # @option options [Object] :parse
164
+ # @option options [string] :parse
165
165
  # Change how messages are treated. Defaults to none. See below.
166
- # @option options [Object] :reply_broadcast
166
+ # @option options [boolean] :reply_broadcast
167
167
  # Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
168
- # @option options [Object] :text
169
- # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
170
- # @option options [Object] :thread_ts
168
+ # @option options [string] :thread_ts
171
169
  # Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
172
- # @option options [Object] :unfurl_links
170
+ # @option options [boolean] :unfurl_links
173
171
  # Pass true to enable unfurling of primarily text-based content.
174
- # @option options [Object] :unfurl_media
172
+ # @option options [boolean] :unfurl_media
175
173
  # Pass false to disable unfurling of media content.
176
- # @option options [Object] :username
174
+ # @option options [string] :username
177
175
  # Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
178
176
  # @see https://api.slack.com/methods/chat.postMessage
179
177
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postMessage.json
@@ -200,27 +198,27 @@ module Slack
200
198
  #
201
199
  # @option options [channel] :channel
202
200
  # Channel, private group, or DM channel to send message to. Can be an encoded ID, or a name. See below for more details.
203
- # @option options [Object] :post_at
201
+ # @option options [integer] :post_at
204
202
  # Unix EPOCH timestamp of time in future to send the message.
205
- # @option options [Object] :text
203
+ # @option options [string] :text
206
204
  # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
207
- # @option options [Object] :as_user
205
+ # @option options [boolean] :as_user
208
206
  # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See chat.postMessage.
209
- # @option options [Object] :attachments
207
+ # @option options [string] :attachments
210
208
  # A JSON-based array of structured attachments, presented as a URL-encoded string.
211
- # @option options [Object] :blocks
209
+ # @option options [blocks[] as string] :blocks
212
210
  # A JSON-based array of structured blocks, presented as a URL-encoded string.
213
- # @option options [Object] :link_names
211
+ # @option options [boolean] :link_names
214
212
  # Find and link channel names and usernames.
215
- # @option options [Object] :parse
213
+ # @option options [string] :parse
216
214
  # Change how messages are treated. Defaults to none. See chat.postMessage.
217
- # @option options [Object] :reply_broadcast
215
+ # @option options [boolean] :reply_broadcast
218
216
  # Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
219
- # @option options [Object] :thread_ts
217
+ # @option options [string] :thread_ts
220
218
  # Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
221
- # @option options [Object] :unfurl_links
219
+ # @option options [boolean] :unfurl_links
222
220
  # Pass true to enable unfurling of primarily text-based content.
223
- # @option options [Object] :unfurl_media
221
+ # @option options [boolean] :unfurl_media
224
222
  # Pass false to disable unfurling of media content.
225
223
  # @see https://api.slack.com/methods/chat.scheduleMessage
226
224
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.scheduleMessage.json
@@ -235,16 +233,20 @@ module Slack
235
233
  # Provide custom unfurl behavior for user-posted URLs
236
234
  #
237
235
  # @option options [channel] :channel
238
- # Channel ID of the message.
236
+ # Channel ID of the message. Both channel and ts must be provided together, or unfurl_id and source must be provided together.
239
237
  # @option options [timestamp] :ts
240
238
  # Timestamp of the message to add unfurl behavior to.
241
- # @option options [Object] :unfurls
239
+ # @option options [string] :unfurls
242
240
  # URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments.
241
+ # @option options [string] :source
242
+ # The source of the link to unfurl. The source may either be composer, when the link is inside the message composer, or conversations_history, when the link has been posted to a conversation.
243
+ # @option options [string] :unfurl_id
244
+ # The ID of the link to unfurl. Both unfurl_id and source must be provided together, or channel and ts must be provided together.
243
245
  # @option options [Object] :user_auth_blocks
244
246
  # 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.
245
247
  # @option options [Object] :user_auth_message
246
248
  # 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.
247
- # @option options [Object] :user_auth_required
249
+ # @option options [boolean] :user_auth_required
248
250
  # Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain.
249
251
  # @option options [Object] :user_auth_url
250
252
  # Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.
@@ -265,17 +267,21 @@ module Slack
265
267
  # Channel containing the message to be updated.
266
268
  # @option options [timestamp] :ts
267
269
  # Timestamp of the message to be updated.
268
- # @option options [Object] :as_user
270
+ # @option options [boolean] :as_user
269
271
  # Pass true to update the message as the authed user. Bot users in this context are considered authed users.
270
- # @option options [Object] :attachments
272
+ # @option options [string] :attachments
271
273
  # 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.
272
- # @option options [Object] :blocks
274
+ # @option options [blocks[] as string] :blocks
273
275
  # 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.
274
- # @option options [Object] :link_names
276
+ # @option options [array] :file_ids
277
+ # Array of new file ids that will be sent with this message.
278
+ # @option options [boolean] :link_names
275
279
  # 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.
276
- # @option options [Object] :parse
280
+ # @option options [string] :parse
277
281
  # 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.
278
- # @option options [Object] :text
282
+ # @option options [boolean] :reply_broadcast
283
+ # Broadcast an existing thread reply to make it visible to everyone in the channel or conversation.
284
+ # @option options [string] :text
279
285
  # New text for the message, using the default formatting rules. It's not required when presenting blocks or attachments.
280
286
  # @see https://api.slack.com/methods/chat.update
281
287
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.update.json
@@ -11,15 +11,15 @@ module Slack
11
11
  #
12
12
  # @option options [channel] :channel
13
13
  # The channel of the scheduled messages.
14
- # @option options [Object] :cursor
14
+ # @option options [string] :cursor
15
15
  # For pagination purposes, this is the cursor value returned from a previous call to chat.scheduledmessages.list indicating where you want to start this call from.
16
16
  # @option options [timestamp] :latest
17
17
  # A UNIX timestamp of the latest value in the time range.
18
- # @option options [Object] :limit
18
+ # @option options [integer] :limit
19
19
  # Maximum number of original entries to return.
20
20
  # @option options [timestamp] :oldest
21
21
  # A UNIX timestamp of the oldest value in the time range.
22
- # @option options [Object] :team_id
22
+ # @option options [string] :team_id
23
23
  # encoded team id to list channels in, required if org token is used.
24
24
  # @see https://api.slack.com/methods/chat.scheduledMessages.list
25
25
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat.scheduledMessages/chat.scheduledMessages.list.json
@@ -6,6 +6,42 @@ module Slack
6
6
  module Api
7
7
  module Endpoints
8
8
  module Conversations
9
+ #
10
+ # Accepts an invitation to a Slack Connect channel.
11
+ #
12
+ # @option options [string] :channel_name
13
+ # Name of the channel. If the channel does not exist already in your workspace, this name is the one that the channel will take.
14
+ # @option options [Object] :channel_id
15
+ # ID of the channel that you'd like to accept. Must provide either invite_id or channel_id.
16
+ # @option options [boolean] :free_trial_accepted
17
+ # Whether you'd like to use your workspace's free trial to begin using Slack Connect.
18
+ # @option options [Object] :invite_id
19
+ # See the shared_channel_invite_received event payload for more details on how to retrieve the ID of the invitation.
20
+ # @option options [boolean] :is_private
21
+ # Whether the channel should be private.
22
+ # @option options [string] :team_id
23
+ # 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.
24
+ # @see https://api.slack.com/methods/conversations.acceptSharedInvite
25
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.acceptSharedInvite.json
26
+ def conversations_acceptSharedInvite(options = {})
27
+ throw ArgumentError.new('Required arguments :channel_name missing') if options[:channel_name].nil?
28
+ post('conversations.acceptSharedInvite', options)
29
+ end
30
+
31
+ #
32
+ # Approves an invitation to a Slack Connect channel
33
+ #
34
+ # @option options [Object] :invite_id
35
+ # ID of the shared channel invite to approve.
36
+ # @option options [Object] :target_team
37
+ # The team or enterprise id of the other party involved in the invitation you are approving.
38
+ # @see https://api.slack.com/methods/conversations.approveSharedInvite
39
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.approveSharedInvite.json
40
+ def conversations_approveSharedInvite(options = {})
41
+ throw ArgumentError.new('Required arguments :invite_id missing') if options[:invite_id].nil?
42
+ post('conversations.approveSharedInvite', options)
43
+ end
44
+
9
45
  #
10
46
  # Archives a conversation.
11
47
  #
@@ -35,11 +71,11 @@ module Slack
35
71
  #
36
72
  # Initiates a public or private channel-based conversation
37
73
  #
38
- # @option options [Object] :name
74
+ # @option options [string] :name
39
75
  # Name of the public or private channel to create.
40
- # @option options [Object] :is_private
76
+ # @option options [boolean] :is_private
41
77
  # Create a private channel instead of a public one.
42
- # @option options [Object] :team_id
78
+ # @option options [string] :team_id
43
79
  # encoded team id to create the channel in, required if org token is used.
44
80
  # @see https://api.slack.com/methods/conversations.create
45
81
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.create.json
@@ -48,18 +84,32 @@ module Slack
48
84
  post('conversations.create', options)
49
85
  end
50
86
 
87
+ #
88
+ # Declines a Slack Connect channel invite.
89
+ #
90
+ # @option options [Object] :invite_id
91
+ # 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.
92
+ # @option options [Object] :target_team
93
+ # The team or enterprise id of the other party involved in the invitation you are declining.
94
+ # @see https://api.slack.com/methods/conversations.declineSharedInvite
95
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.declineSharedInvite.json
96
+ def conversations_declineSharedInvite(options = {})
97
+ throw ArgumentError.new('Required arguments :invite_id missing') if options[:invite_id].nil?
98
+ post('conversations.declineSharedInvite', options)
99
+ end
100
+
51
101
  #
52
102
  # Fetches a conversation's history of messages and events.
53
103
  #
54
104
  # @option options [channel] :channel
55
105
  # Conversation ID to fetch history for.
56
- # @option options [Object] :cursor
106
+ # @option options [string] :cursor
57
107
  # 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.
58
- # @option options [Object] :inclusive
108
+ # @option options [boolean] :inclusive
59
109
  # Include messages with latest or oldest timestamp in results only when either timestamp is specified.
60
110
  # @option options [timestamp] :latest
61
- # End of time range of messages to include in results.
62
- # @option options [Object] :limit
111
+ # End of time range of messages to include in results. Default is the current time.
112
+ # @option options [number] :limit
63
113
  # 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.
64
114
  # @option options [timestamp] :oldest
65
115
  # Start of time range of messages to include in results.
@@ -82,9 +132,9 @@ module Slack
82
132
  #
83
133
  # @option options [channel] :channel
84
134
  # Conversation ID to learn more about.
85
- # @option options [Object] :include_locale
135
+ # @option options [boolean] :include_locale
86
136
  # Set this to true to receive the locale for this conversation. Defaults to false.
87
- # @option options [Object] :include_num_members
137
+ # @option options [boolean] :include_num_members
88
138
  # Set to true to include the member count for the specified conversation. Defaults to false.
89
139
  # @see https://api.slack.com/methods/conversations.info
90
140
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.info.json
@@ -99,7 +149,7 @@ module Slack
99
149
  #
100
150
  # @option options [channel] :channel
101
151
  # The ID of the public or private channel to invite user(s) to.
102
- # @option options [Object] :users
152
+ # @option options [string] :users
103
153
  # A comma separated list of user IDs. Up to 1000 users may be listed.
104
154
  # @see https://api.slack.com/methods/conversations.invite
105
155
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.invite.json
@@ -110,6 +160,25 @@ module Slack
110
160
  post('conversations.invite', options)
111
161
  end
112
162
 
163
+ #
164
+ # Sends an invitation to a Slack Connect channel
165
+ #
166
+ # @option options [channel] :channel
167
+ # ID of the channel on your team that you'd like to share.
168
+ # @option options [array] :emails
169
+ # Optional email to receive this invite. Either emails or user_ids must be provided.
170
+ # @option options [boolean] :external_limited
171
+ # Optional boolean on whether invite is to a external limited member. Defaults to true.
172
+ # @option options [array] :user_ids
173
+ # Optional user_id to receive this invite. Either emails or user_ids must be provided.
174
+ # @see https://api.slack.com/methods/conversations.inviteShared
175
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.inviteShared.json
176
+ def conversations_inviteShared(options = {})
177
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
178
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
179
+ post('conversations.inviteShared', options)
180
+ end
181
+
113
182
  #
114
183
  # Joins an existing conversation.
115
184
  #
@@ -156,15 +225,15 @@ module Slack
156
225
  #
157
226
  # Lists all channels in a Slack team.
158
227
  #
159
- # @option options [Object] :cursor
228
+ # @option options [string] :cursor
160
229
  # 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.
161
- # @option options [Object] :exclude_archived
230
+ # @option options [boolean] :exclude_archived
162
231
  # Set to true to exclude archived channels from the list.
163
- # @option options [Object] :limit
232
+ # @option options [number] :limit
164
233
  # 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.
165
- # @option options [Object] :team_id
234
+ # @option options [string] :team_id
166
235
  # encoded team id to list channels in, required if token belongs to org-wide app.
167
- # @option options [Object] :types
236
+ # @option options [string] :types
168
237
  # Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.
169
238
  # @see https://api.slack.com/methods/conversations.list
170
239
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.list.json
@@ -178,6 +247,25 @@ module Slack
178
247
  end
179
248
  end
180
249
 
250
+ #
251
+ # Lists shared channel invites that have been generated or received but have not been approved by all parties
252
+ #
253
+ # @option options [string] :cursor
254
+ # Set to next_cursor returned by previous call to list items in subsequent page.
255
+ # @option options [string] :team_id
256
+ # Encoded team id for the workspace to retrieve invites for, required if org token is used.
257
+ # @see https://api.slack.com/methods/conversations.listConnectInvites
258
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.listConnectInvites.json
259
+ def conversations_listConnectInvites(options = {})
260
+ if block_given?
261
+ Pagination::Cursor.new(self, :conversations_listConnectInvites, options).each do |page|
262
+ yield page
263
+ end
264
+ else
265
+ post('conversations.listConnectInvites', options)
266
+ end
267
+ end
268
+
181
269
  #
182
270
  # Sets the read cursor in a channel.
183
271
  #
@@ -199,9 +287,9 @@ module Slack
199
287
  #
200
288
  # @option options [channel] :channel
201
289
  # ID of the conversation to retrieve members for.
202
- # @option options [Object] :cursor
290
+ # @option options [string] :cursor
203
291
  # 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.
204
- # @option options [Object] :limit
292
+ # @option options [number] :limit
205
293
  # 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.
206
294
  # @see https://api.slack.com/methods/conversations.members
207
295
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.members.json
@@ -222,9 +310,11 @@ module Slack
222
310
  #
223
311
  # @option options [channel] :channel
224
312
  # Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead.
225
- # @option options [Object] :return_im
313
+ # @option options [boolean] :prevent_creation
314
+ # Do not create a direct message or multi-person direct message. This is used to see if there is an existing dm or mpdm.
315
+ # @option options [boolean] :return_im
226
316
  # Boolean, indicates you want the full IM channel definition in the response.
227
- # @option options [Object] :users
317
+ # @option options [string] :users
228
318
  # 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.
229
319
  # @see https://api.slack.com/methods/conversations.open
230
320
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.open.json
@@ -238,7 +328,7 @@ module Slack
238
328
  #
239
329
  # @option options [channel] :channel
240
330
  # ID of conversation to rename.
241
- # @option options [Object] :name
331
+ # @option options [string] :name
242
332
  # New name for conversation.
243
333
  # @see https://api.slack.com/methods/conversations.rename
244
334
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.rename.json
@@ -256,13 +346,13 @@ module Slack
256
346
  # Conversation ID to fetch thread from.
257
347
  # @option options [timestamp] :ts
258
348
  # 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.
259
- # @option options [Object] :cursor
349
+ # @option options [string] :cursor
260
350
  # 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.
261
- # @option options [Object] :inclusive
351
+ # @option options [boolean] :inclusive
262
352
  # Include messages with latest or oldest timestamp in results only when either timestamp is specified.
263
353
  # @option options [timestamp] :latest
264
354
  # End of time range of messages to include in results.
265
- # @option options [Object] :limit
355
+ # @option options [number] :limit
266
356
  # 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.
267
357
  # @option options [timestamp] :oldest
268
358
  # Start of time range of messages to include in results.
@@ -286,7 +376,7 @@ module Slack
286
376
  #
287
377
  # @option options [channel] :channel
288
378
  # Conversation to set the purpose of.
289
- # @option options [Object] :purpose
379
+ # @option options [string] :purpose
290
380
  # A new, specialer purpose.
291
381
  # @see https://api.slack.com/methods/conversations.setPurpose
292
382
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.setPurpose.json
@@ -302,7 +392,7 @@ module Slack
302
392
  #
303
393
  # @option options [channel] :channel
304
394
  # Conversation to set the topic of.
305
- # @option options [Object] :topic
395
+ # @option options [string] :topic
306
396
  # The new topic string. Does not support formatting or linkification.
307
397
  # @see https://api.slack.com/methods/conversations.setTopic
308
398
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.setTopic.json
@@ -9,9 +9,9 @@ module Slack
9
9
  #
10
10
  # Open a dialog with a user
11
11
  #
12
- # @option options [Object] :dialog
12
+ # @option options [string] :dialog
13
13
  # The dialog definition. This must be a JSON-encoded string.
14
- # @option options [Object] :trigger_id
14
+ # @option options [string] :trigger_id
15
15
  # Exchange a trigger to post to the user.
16
16
  # @see https://api.slack.com/methods/dialog.open
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dialog/dialog.open.json
@@ -27,7 +27,7 @@ module Slack
27
27
  #
28
28
  # Retrieves a user's current Do Not Disturb status.
29
29
  #
30
- # @option options [Object] :team_id
30
+ # @option options [string] :team_id
31
31
  # Encoded team id where passed in user param belongs, required if org token is used. If no user param is passed, then a team which has access to the app should be passed.
32
32
  # @option options [user] :user
33
33
  # User to fetch status for (defaults to current user).
@@ -41,21 +41,20 @@ module Slack
41
41
  #
42
42
  # Turns on Do Not Disturb mode for the current user, or changes its duration.
43
43
  #
44
- # @option options [Object] :num_minutes
44
+ # @option options [string] :num_minutes
45
45
  # Number of minutes, from now, to snooze until.
46
46
  # @see https://api.slack.com/methods/dnd.setSnooze
47
47
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.setSnooze.json
48
48
  def dnd_setSnooze(options = {})
49
- throw ArgumentError.new('Required arguments :num_minutes missing') if options[:num_minutes].nil?
50
49
  post('dnd.setSnooze', options)
51
50
  end
52
51
 
53
52
  #
54
53
  # Retrieves the Do Not Disturb status for up to 50 users on a team.
55
54
  #
56
- # @option options [Object] :users
55
+ # @option options [string] :users
57
56
  # Comma-separated list of users to fetch Do Not Disturb status for.
58
- # @option options [Object] :team_id
57
+ # @option options [string] :team_id
59
58
  # Encoded team id where passed in users belong, required if org token is used.
60
59
  # @see https://api.slack.com/methods/dnd.teamInfo
61
60
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.teamInfo.json
@@ -40,9 +40,9 @@ module Slack
40
40
  #
41
41
  # @option options [file] :file
42
42
  # Specify a file by providing its ID.
43
- # @option options [Object] :cursor
43
+ # @option options [string] :cursor
44
44
  # Parameter for pagination. File comments are paginated for a single file. Set cursor equal to the next_cursor attribute returned by the previous request's response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first "page" of the collection of comments. See pagination for more details.
45
- # @option options [Object] :limit
45
+ # @option options [integer] :limit
46
46
  # 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.
47
47
  # @see https://api.slack.com/methods/files.info
48
48
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.info.json
@@ -62,15 +62,17 @@ module Slack
62
62
  #
63
63
  # @option options [channel] :channel
64
64
  # Filter files appearing in a specific channel, indicated by its ID.
65
- # @option options [Object] :show_files_hidden_by_limit
65
+ # @option options [string] :files
66
+ # .
67
+ # @option options [boolean] :show_files_hidden_by_limit
66
68
  # Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit.
67
- # @option options [Object] :team_id
69
+ # @option options [string] :team_id
68
70
  # encoded team id to list files in, required if org token is used.
69
- # @option options [Object] :ts_from
71
+ # @option options [string] :ts_from
70
72
  # Filter files created after this timestamp (inclusive).
71
- # @option options [Object] :ts_to
73
+ # @option options [string] :ts_to
72
74
  # Filter files created before this timestamp (inclusive).
73
- # @option options [Object] :types
75
+ # @option options [string] :types
74
76
  # Filter files by type (see below). You can pass multiple values in the types argument, like types=spaces,snippets.The default value is all, which does not filter the list.
75
77
  # @option options [user] :user
76
78
  # Filter files created by a single user.
@@ -125,21 +127,21 @@ module Slack
125
127
  #
126
128
  # Uploads or creates a file.
127
129
  #
128
- # @option options [Object] :channels
130
+ # @option options [string] :channels
129
131
  # Comma-separated list of channel names or IDs where the file will be shared.
130
- # @option options [Object] :content
132
+ # @option options [string] :content
131
133
  # File contents via a POST variable. If omitting this parameter, you must provide a file.
132
134
  # @option options [file] :file
133
135
  # File contents via multipart/form-data. If omitting this parameter, you must submit content.
134
- # @option options [Object] :filename
136
+ # @option options [string] :filename
135
137
  # Filename of file.
136
- # @option options [Object] :filetype
138
+ # @option options [string] :filetype
137
139
  # A file type identifier.
138
- # @option options [Object] :initial_comment
140
+ # @option options [string] :initial_comment
139
141
  # The message text introducing the file in specified channels.
140
- # @option options [Object] :thread_ts
142
+ # @option options [string] :thread_ts
141
143
  # Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.
142
- # @option options [Object] :title
144
+ # @option options [string] :title
143
145
  # Title of file.
144
146
  # @see https://api.slack.com/methods/files.upload
145
147
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.upload.json
@@ -11,7 +11,7 @@ module Slack
11
11
  #
12
12
  # @option options [file] :file
13
13
  # File to delete a comment from.
14
- # @option options [Object] :id
14
+ # @option options [string] :id
15
15
  # The comment to delete.
16
16
  # @see https://api.slack.com/methods/files.comments.delete
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.comments/files.comments.delete.json