slack-ruby-client 0.14.5 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop.yml +11 -3
  4. data/.rubocop_todo.yml +61 -23
  5. data/.travis.yml +1 -5
  6. data/CHANGELOG.md +43 -4
  7. data/CONTRIBUTING.md +17 -6
  8. data/Dangerfile +1 -1
  9. data/Gemfile +1 -2
  10. data/LICENSE.md +1 -1
  11. data/README.md +86 -52
  12. data/UPGRADING.md +20 -2
  13. data/bin/commands.rb +23 -0
  14. data/bin/commands/admin_analytics.rb +16 -0
  15. data/bin/commands/admin_apps.rb +15 -2
  16. data/bin/commands/admin_apps_approved.rb +17 -0
  17. data/bin/commands/admin_apps_restricted.rb +17 -0
  18. data/bin/commands/admin_barriers.rb +47 -0
  19. data/bin/commands/admin_conversations.rb +159 -0
  20. data/bin/commands/admin_conversations_ekm.rb +17 -0
  21. data/bin/commands/admin_conversations_restrictAccess.rb +37 -0
  22. data/bin/commands/admin_conversations_whitelist.rb +37 -0
  23. data/bin/commands/admin_emoji.rb +54 -0
  24. data/bin/commands/admin_inviteRequests.rb +36 -0
  25. data/bin/commands/admin_inviteRequests_approved.rb +16 -0
  26. data/bin/commands/admin_inviteRequests_denied.rb +16 -0
  27. data/bin/commands/admin_teams.rb +27 -0
  28. data/bin/commands/admin_teams_admins.rb +16 -0
  29. data/bin/commands/admin_teams_owners.rb +16 -0
  30. data/bin/commands/admin_teams_settings.rb +64 -0
  31. data/bin/commands/admin_usergroups.rb +48 -0
  32. data/bin/commands/admin_users.rb +97 -0
  33. data/bin/commands/admin_users_session.rb +22 -0
  34. data/bin/commands/api.rb +0 -1
  35. data/bin/commands/apps_connections.rb +13 -0
  36. data/bin/commands/apps_event_authorizations.rb +16 -0
  37. data/bin/commands/auth_teams.rb +16 -0
  38. data/bin/commands/bots.rb +1 -0
  39. data/bin/commands/calls.rb +52 -0
  40. data/bin/commands/calls_participants.rb +25 -0
  41. data/bin/commands/channels.rb +1 -155
  42. data/bin/commands/chat.rb +14 -12
  43. data/bin/commands/chat_scheduledMessages.rb +1 -0
  44. data/bin/commands/conversations.rb +15 -4
  45. data/bin/commands/dnd.rb +3 -1
  46. data/bin/commands/files.rb +7 -5
  47. data/bin/commands/files_remote.rb +3 -3
  48. data/bin/commands/groups.rb +1 -162
  49. data/bin/commands/im.rb +1 -63
  50. data/bin/commands/migration.rb +1 -0
  51. data/bin/commands/mpim.rb +1 -61
  52. data/bin/commands/oauth.rb +1 -1
  53. data/bin/commands/pins.rb +0 -2
  54. data/bin/commands/reactions.rb +1 -0
  55. data/bin/commands/search.rb +4 -1
  56. data/bin/commands/team.rb +3 -0
  57. data/bin/commands/usergroups.rb +6 -1
  58. data/bin/commands/usergroups_users.rb +2 -0
  59. data/bin/commands/users.rb +5 -3
  60. data/bin/commands/users_profile.rb +5 -5
  61. data/bin/commands/views.rb +1 -1
  62. data/bin/commands/workflows.rb +38 -0
  63. data/lib/slack-ruby-client.rb +5 -4
  64. data/lib/slack/events/request.rb +7 -3
  65. data/lib/slack/messages/message.rb +0 -4
  66. data/lib/slack/real_time/client.rb +2 -1
  67. data/lib/slack/real_time/concurrency.rb +0 -2
  68. data/lib/slack/real_time/concurrency/async.rb +1 -3
  69. data/lib/slack/real_time/config.rb +5 -14
  70. data/lib/slack/real_time/models/base.rb +0 -4
  71. data/lib/slack/real_time/socket.rb +2 -2
  72. data/lib/slack/real_time/stores/base.rb +3 -1
  73. data/lib/slack/version.rb +1 -1
  74. data/lib/slack/web/api/endpoints.rb +47 -0
  75. data/lib/slack/web/api/endpoints/admin_analytics.rb +28 -0
  76. data/lib/slack/web/api/endpoints/admin_apps.rb +22 -2
  77. data/lib/slack/web/api/endpoints/admin_apps_approved.rb +35 -0
  78. data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +35 -0
  79. data/lib/slack/web/api/endpoints/admin_barriers.rb +82 -0
  80. data/lib/slack/web/api/endpoints/admin_conversations.rb +246 -0
  81. data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +35 -0
  82. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +61 -0
  83. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +64 -0
  84. data/lib/slack/web/api/endpoints/admin_emoji.rb +88 -0
  85. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +61 -0
  86. data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +33 -0
  87. data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +33 -0
  88. data/lib/slack/web/api/endpoints/admin_teams.rb +50 -0
  89. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +34 -0
  90. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +34 -0
  91. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +99 -0
  92. data/lib/slack/web/api/endpoints/admin_usergroups.rb +77 -0
  93. data/lib/slack/web/api/endpoints/admin_users.rb +161 -0
  94. data/lib/slack/web/api/endpoints/admin_users_session.rb +38 -0
  95. data/lib/slack/web/api/endpoints/api.rb +0 -2
  96. data/lib/slack/web/api/endpoints/apps_connections.rb +21 -0
  97. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +34 -0
  98. data/lib/slack/web/api/endpoints/auth_teams.rb +33 -0
  99. data/lib/slack/web/api/endpoints/bots.rb +2 -0
  100. data/lib/slack/web/api/endpoints/calls.rb +83 -0
  101. data/lib/slack/web/api/endpoints/calls_participants.rb +42 -0
  102. data/lib/slack/web/api/endpoints/channels.rb +1 -245
  103. data/lib/slack/web/api/endpoints/chat.rb +23 -19
  104. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +3 -1
  105. data/lib/slack/web/api/endpoints/conversations.rb +37 -19
  106. data/lib/slack/web/api/endpoints/dnd.rb +4 -0
  107. data/lib/slack/web/api/endpoints/files.rb +8 -4
  108. data/lib/slack/web/api/endpoints/files_remote.rb +4 -4
  109. data/lib/slack/web/api/endpoints/groups.rb +0 -253
  110. data/lib/slack/web/api/endpoints/im.rb +0 -101
  111. data/lib/slack/web/api/endpoints/migration.rb +2 -0
  112. data/lib/slack/web/api/endpoints/mpim.rb +0 -96
  113. data/lib/slack/web/api/endpoints/oauth.rb +1 -4
  114. data/lib/slack/web/api/endpoints/pins.rb +3 -8
  115. data/lib/slack/web/api/endpoints/reactions.rb +5 -3
  116. data/lib/slack/web/api/endpoints/search.rb +6 -0
  117. data/lib/slack/web/api/endpoints/stars.rb +2 -2
  118. data/lib/slack/web/api/endpoints/team.rb +6 -0
  119. data/lib/slack/web/api/endpoints/usergroups.rb +10 -0
  120. data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -0
  121. data/lib/slack/web/api/endpoints/users.rb +7 -5
  122. data/lib/slack/web/api/endpoints/users_profile.rb +3 -3
  123. data/lib/slack/web/api/endpoints/views.rb +1 -1
  124. data/lib/slack/web/api/endpoints/workflows.rb +61 -0
  125. data/lib/slack/web/api/errors.rb +848 -0
  126. data/lib/slack/web/api/errors/internal_error.rb +14 -0
  127. data/lib/slack/web/api/errors/slack_error.rb +12 -0
  128. data/lib/slack/web/api/mixins.rb +1 -0
  129. data/lib/slack/web/api/mixins/channels.id.rb +1 -3
  130. data/lib/slack/web/api/mixins/conversations.id.rb +25 -0
  131. data/lib/slack/web/api/mixins/groups.id.rb +1 -3
  132. data/lib/slack/web/api/mixins/ids.id.rb +3 -5
  133. data/lib/slack/web/api/mixins/users.id.rb +1 -3
  134. data/lib/slack/web/api/patches/{chat.6.block-kit-support.patch → chat.1.patch} +26 -24
  135. data/lib/slack/web/api/templates/endpoints.erb +1 -0
  136. data/lib/slack/web/api/templates/errors.erb +20 -0
  137. data/lib/slack/web/api/templates/method.erb +4 -1
  138. data/lib/slack/web/api/templates/method_spec.erb +1 -1
  139. data/lib/slack/web/client.rb +1 -1
  140. data/lib/slack/web/config.rb +2 -0
  141. data/lib/slack/web/faraday/connection.rb +23 -20
  142. data/lib/slack/web/faraday/response/raise_error.rb +16 -2
  143. data/lib/slack/web/faraday/response/wrap_error.rb +24 -0
  144. data/lib/slack/web/pagination/cursor.rb +2 -2
  145. data/lib/tasks/real_time.rake +1 -1
  146. data/lib/tasks/web.rake +21 -4
  147. data/slack-ruby-client.gemspec +5 -5
  148. data/spec/fixtures/slack/web/channels_info.yml +108 -15
  149. data/spec/fixtures/slack/web/{groups_info.yml → conversations_info.yml} +4 -4
  150. data/spec/fixtures/slack/web/conversations_setTopic.yml +69 -0
  151. data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +142 -0
  152. data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +208 -0
  153. data/spec/fixtures/slack/web/views_open_error.yml +76 -0
  154. data/spec/slack/events/request_spec.rb +13 -8
  155. data/spec/slack/real_time/client_spec.rb +18 -1
  156. data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +10 -0
  157. data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +10 -0
  158. data/spec/slack/real_time/rtm_connect_spec.rb +1 -1
  159. data/spec/slack/real_time/rtm_start_spec.rb +1 -1
  160. data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +13 -0
  161. data/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb +8 -0
  162. data/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb +8 -0
  163. data/spec/slack/web/api/endpoints/admin_apps_spec.rb +5 -0
  164. data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +38 -0
  165. data/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb +8 -0
  166. data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +32 -0
  167. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +93 -0
  168. data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +37 -0
  169. data/spec/slack/web/api/endpoints/admin_inviteRequests_approved_spec.rb +8 -0
  170. data/spec/slack/web/api/endpoints/admin_inviteRequests_denied_spec.rb +8 -0
  171. data/spec/slack/web/api/endpoints/admin_inviteRequests_spec.rb +18 -0
  172. data/spec/slack/web/api/endpoints/admin_teams_admins_spec.rb +13 -0
  173. data/spec/slack/web/api/endpoints/admin_teams_owners_spec.rb +13 -0
  174. data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +53 -0
  175. data/spec/slack/web/api/endpoints/admin_teams_spec.rb +16 -0
  176. data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +37 -0
  177. data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +8 -0
  178. data/spec/slack/web/api/endpoints/admin_users_spec.rb +67 -0
  179. data/spec/slack/web/api/endpoints/apps_connections_spec.rb +8 -0
  180. data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +13 -0
  181. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +2 -2
  182. data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +3 -3
  183. data/spec/slack/web/api/endpoints/apps_spec.rb +2 -2
  184. data/spec/slack/web/api/endpoints/auth_teams_spec.rb +8 -0
  185. data/spec/slack/web/api/endpoints/calls_participants_spec.rb +24 -0
  186. data/spec/slack/web/api/endpoints/calls_spec.rb +31 -0
  187. data/spec/slack/web/api/endpoints/conversations_spec.rb +20 -12
  188. data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
  189. data/spec/slack/web/api/endpoints/files_comments_spec.rb +2 -2
  190. data/spec/slack/web/api/endpoints/files_remote_spec.rb +3 -3
  191. data/spec/slack/web/api/endpoints/files_spec.rb +4 -4
  192. data/spec/slack/web/api/endpoints/im_spec.rb +0 -31
  193. data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -31
  194. data/spec/slack/web/api/endpoints/oauth_spec.rb +3 -14
  195. data/spec/slack/web/api/endpoints/pins_spec.rb +1 -4
  196. data/spec/slack/web/api/endpoints/reactions_spec.rb +3 -3
  197. data/spec/slack/web/api/endpoints/reminders_spec.rb +2 -2
  198. data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +2 -2
  199. data/spec/slack/web/api/endpoints/workflows_spec.rb +26 -0
  200. data/spec/slack/web/api/errors/slack_error_spec.rb +22 -0
  201. data/spec/slack/web/api/mixins/channels_spec.rb +1 -1
  202. data/spec/slack/web/api/mixins/conversations_list_spec.rb +21 -0
  203. data/spec/slack/web/api/mixins/conversations_spec.rb +43 -0
  204. data/spec/slack/web/api/mixins/groups_spec.rb +1 -1
  205. data/spec/slack/web/api/mixins/users_spec.rb +1 -1
  206. data/spec/slack/web/client_spec.rb +121 -0
  207. data/spec/slack/web/faraday/response/raise_error_spec.rb +33 -9
  208. data/spec/support/vcr.rb +4 -0
  209. metadata +145 -55
  210. data/examples/hi_real_time/Gemfile +0 -6
  211. data/examples/hi_real_time/hi.gif +0 -0
  212. data/examples/hi_real_time/hi.rb +0 -41
  213. data/examples/hi_real_time_async_celluloid/Gemfile +0 -7
  214. data/examples/hi_real_time_async_celluloid/Procfile +0 -2
  215. data/examples/hi_real_time_async_celluloid/hi.rb +0 -39
  216. data/examples/hi_real_time_async_eventmachine/Gemfile +0 -7
  217. data/examples/hi_real_time_async_eventmachine/Procfile +0 -2
  218. data/examples/hi_real_time_async_eventmachine/hi.rb +0 -39
  219. data/lib/slack/real_time/concurrency/celluloid.rb +0 -142
  220. data/lib/slack/real_time/concurrency/eventmachine.rb +0 -85
  221. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +0 -13
  222. data/lib/slack/web/api/patches/chat.2.attachments-json.patch +0 -17
  223. data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +0 -21
  224. data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +0 -17
  225. data/lib/slack/web/api/patches/chat.5.postEphemeral-text-or-attachments.patch +0 -15
  226. data/spec/slack/real_time/concurrency/celluloid_spec.rb +0 -116
  227. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +0 -57
  228. data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +0 -13
  229. data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +0 -13
  230. data/spec/slack/web/api/endpoints/views_spec.rb +0 -29
  231. data/spec/slack/web/api/errors/service_unavailable_spec.rb +0 -17
@@ -19,7 +19,7 @@ module Slack
19
19
  def chat_command(options = {})
20
20
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
21
21
  throw ArgumentError.new('Required arguments :command missing') if options[:command].nil?
22
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
22
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
23
23
  logger.warn('The chat.command method is undocumented.')
24
24
  post('chat.command', options)
25
25
  end
@@ -38,7 +38,7 @@ module Slack
38
38
  def chat_delete(options = {})
39
39
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
40
40
  throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
41
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
41
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
42
42
  post('chat.delete', options)
43
43
  end
44
44
 
@@ -56,7 +56,7 @@ module Slack
56
56
  def chat_deleteScheduledMessage(options = {})
57
57
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
58
58
  throw ArgumentError.new('Required arguments :scheduled_message_id missing') if options[:scheduled_message_id].nil?
59
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
59
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
60
60
  post('chat.deleteScheduledMessage', options)
61
61
  end
62
62
 
@@ -72,7 +72,7 @@ module Slack
72
72
  def chat_getPermalink(options = {})
73
73
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
74
74
  throw ArgumentError.new('Required arguments :message_ts missing') if options[:message_ts].nil?
75
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
75
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
76
76
  post('chat.getPermalink', options)
77
77
  end
78
78
 
@@ -99,7 +99,7 @@ module Slack
99
99
  # @option options [channel] :channel
100
100
  # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
101
101
  # @option options [Object] :text
102
- # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead.
102
+ # 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
103
  # @option options [user] :user
104
104
  # id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.
105
105
  # @option options [Object] :as_user
@@ -145,14 +145,14 @@ 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] :text
149
- # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation.
150
148
  # @option options [Object] :as_user
151
149
  # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
152
150
  # @option options [Object] :attachments
153
151
  # A JSON-based array of structured attachments, presented as a URL-encoded string.
154
152
  # @option options [Object] :blocks
155
153
  # 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
156
  # @option options [Object] :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
158
  # @option options [Object] :icon_url
@@ -165,6 +165,8 @@ module Slack
165
165
  # Change how messages are treated. Defaults to none. See below.
166
166
  # @option options [Object] :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.
168
170
  # @option options [Object] :thread_ts
169
171
  # Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
170
172
  # @option options [Object] :unfurl_links
@@ -201,9 +203,9 @@ module Slack
201
203
  # @option options [Object] :post_at
202
204
  # Unix EPOCH timestamp of time in future to send the message.
203
205
  # @option options [Object] :text
204
- # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation.
206
+ # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
205
207
  # @option options [Object] :as_user
206
- # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
208
+ # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See chat.postMessage.
207
209
  # @option options [Object] :attachments
208
210
  # A JSON-based array of structured attachments, presented as a URL-encoded string.
209
211
  # @option options [Object] :blocks
@@ -211,7 +213,7 @@ module Slack
211
213
  # @option options [Object] :link_names
212
214
  # Find and link channel names and usernames.
213
215
  # @option options [Object] :parse
214
- # Change how messages are treated. Defaults to none. See below.
216
+ # Change how messages are treated. Defaults to none. See chat.postMessage.
215
217
  # @option options [Object] :reply_broadcast
216
218
  # Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
217
219
  # @option options [Object] :thread_ts
@@ -238,8 +240,10 @@ module Slack
238
240
  # Timestamp of the message to add unfurl behavior to.
239
241
  # @option options [Object] :unfurls
240
242
  # URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments.
243
+ # @option options [Object] :user_auth_blocks
244
+ # 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.
241
245
  # @option options [Object] :user_auth_message
242
- # Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior.
246
+ # 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.
243
247
  # @option options [Object] :user_auth_required
244
248
  # Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain.
245
249
  # @option options [Object] :user_auth_url
@@ -250,7 +254,7 @@ module Slack
250
254
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
251
255
  throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
252
256
  throw ArgumentError.new('Required arguments :unfurls missing') if options[:unfurls].nil?
253
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
257
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
254
258
  post('chat.unfurl', options)
255
259
  end
256
260
 
@@ -259,27 +263,27 @@ module Slack
259
263
  #
260
264
  # @option options [channel] :channel
261
265
  # Channel containing the message to be updated.
262
- # @option options [Object] :text
263
- # New text for the message, using the default formatting rules. It's not required when presenting attachments.
264
266
  # @option options [timestamp] :ts
265
267
  # Timestamp of the message to be updated.
266
268
  # @option options [Object] :as_user
267
269
  # Pass true to update the message as the authed user. Bot users in this context are considered authed users.
268
270
  # @option options [Object] :attachments
269
- # A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting text.
271
+ # 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.
270
272
  # @option options [Object] :blocks
271
- # A JSON-based array of structured blocks, presented as a URL-encoded string.
273
+ # 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.
272
274
  # @option options [Object] :link_names
273
- # Find and link channel names and usernames. Defaults to none. See below.
275
+ # 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.
274
276
  # @option options [Object] :parse
275
- # Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.
277
+ # 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
279
+ # New text for the message, using the default formatting rules. It's not required when presenting blocks or attachments.
276
280
  # @see https://api.slack.com/methods/chat.update
277
281
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.update.json
278
282
  def chat_update(options = {})
279
283
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
280
284
  throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
281
285
  throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
282
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
286
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
283
287
  # attachments must be passed as an encoded JSON string
284
288
  if options.key?(:attachments)
285
289
  attachments = options[:attachments]
@@ -19,10 +19,12 @@ module Slack
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
23
+ # encoded team id to list channels in, required if org token is used.
22
24
  # @see https://api.slack.com/methods/chat.scheduledMessages.list
23
25
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat.scheduledMessages/chat.scheduledMessages.list.json
24
26
  def chat_scheduledMessages_list(options = {})
25
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
27
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
26
28
  if block_given?
27
29
  Pagination::Cursor.new(self, :chat_scheduledMessages_list, options).each do |page|
28
30
  yield page
@@ -15,7 +15,7 @@ module Slack
15
15
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.archive.json
16
16
  def conversations_archive(options = {})
17
17
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
18
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
18
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
19
19
  post('conversations.archive', options)
20
20
  end
21
21
 
@@ -28,7 +28,7 @@ module Slack
28
28
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.close.json
29
29
  def conversations_close(options = {})
30
30
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
31
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
31
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
32
32
  post('conversations.close', options)
33
33
  end
34
34
 
@@ -39,8 +39,8 @@ module Slack
39
39
  # Name of the public or private channel to create.
40
40
  # @option options [Object] :is_private
41
41
  # Create a private channel instead of a public one.
42
- # @option options [Object] :user_ids
43
- # Required for workspace apps. A list of between 1 and 30 human users that will be added to the newly-created conversation. This argument has no effect when used by classic Slack apps.
42
+ # @option options [Object] :team_id
43
+ # encoded team id to create the channel in, required if org token is used.
44
44
  # @see https://api.slack.com/methods/conversations.create
45
45
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.create.json
46
46
  def conversations_create(options = {})
@@ -67,7 +67,7 @@ module Slack
67
67
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.history.json
68
68
  def conversations_history(options = {})
69
69
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
70
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
70
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
71
71
  if block_given?
72
72
  Pagination::Cursor.new(self, :conversations_history, options).each do |page|
73
73
  yield page
@@ -90,7 +90,7 @@ module Slack
90
90
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.info.json
91
91
  def conversations_info(options = {})
92
92
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
93
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
93
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
94
94
  post('conversations.info', options)
95
95
  end
96
96
 
@@ -100,13 +100,13 @@ module Slack
100
100
  # @option options [channel] :channel
101
101
  # The ID of the public or private channel to invite user(s) to.
102
102
  # @option options [Object] :users
103
- # A comma separated list of user IDs. Up to 30 users may be listed.
103
+ # A comma separated list of user IDs. Up to 1000 users may be listed.
104
104
  # @see https://api.slack.com/methods/conversations.invite
105
105
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.invite.json
106
106
  def conversations_invite(options = {})
107
107
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
108
108
  throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
109
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
109
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
110
110
  post('conversations.invite', options)
111
111
  end
112
112
 
@@ -119,7 +119,7 @@ module Slack
119
119
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.join.json
120
120
  def conversations_join(options = {})
121
121
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
122
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
122
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
123
123
  post('conversations.join', options)
124
124
  end
125
125
 
@@ -135,7 +135,7 @@ module Slack
135
135
  def conversations_kick(options = {})
136
136
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
137
137
  throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
138
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
138
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
139
139
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
140
140
  post('conversations.kick', options)
141
141
  end
@@ -149,7 +149,7 @@ module Slack
149
149
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.leave.json
150
150
  def conversations_leave(options = {})
151
151
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
152
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
152
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
153
153
  post('conversations.leave', options)
154
154
  end
155
155
 
@@ -162,6 +162,8 @@ module Slack
162
162
  # Set to true to exclude archived channels from the list.
163
163
  # @option options [Object] :limit
164
164
  # 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
166
+ # encoded team id to list channels in, required if token belongs to org-wide app.
165
167
  # @option options [Object] :types
166
168
  # Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.
167
169
  # @see https://api.slack.com/methods/conversations.list
@@ -176,6 +178,22 @@ module Slack
176
178
  end
177
179
  end
178
180
 
181
+ #
182
+ # Sets the read cursor in a channel.
183
+ #
184
+ # @option options [channel] :channel
185
+ # Channel or conversation to set the read cursor for.
186
+ # @option options [timestamp] :ts
187
+ # Unique identifier of message you want marked as most recently seen in this conversation.
188
+ # @see https://api.slack.com/methods/conversations.mark
189
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.mark.json
190
+ def conversations_mark(options = {})
191
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
192
+ throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
193
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
194
+ post('conversations.mark', options)
195
+ end
196
+
179
197
  #
180
198
  # Retrieve members of a conversation.
181
199
  #
@@ -189,7 +207,7 @@ module Slack
189
207
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.members.json
190
208
  def conversations_members(options = {})
191
209
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
192
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
210
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
193
211
  if block_given?
194
212
  Pagination::Cursor.new(self, :conversations_members, options).each do |page|
195
213
  yield page
@@ -211,7 +229,7 @@ module Slack
211
229
  # @see https://api.slack.com/methods/conversations.open
212
230
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.open.json
213
231
  def conversations_open(options = {})
214
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
232
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
215
233
  post('conversations.open', options)
216
234
  end
217
235
 
@@ -227,7 +245,7 @@ module Slack
227
245
  def conversations_rename(options = {})
228
246
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
229
247
  throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
230
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
248
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
231
249
  post('conversations.rename', options)
232
250
  end
233
251
 
@@ -237,7 +255,7 @@ module Slack
237
255
  # @option options [channel] :channel
238
256
  # Conversation ID to fetch thread from.
239
257
  # @option options [timestamp] :ts
240
- # Unique identifier of a thread's parent message.
258
+ # 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.
241
259
  # @option options [Object] :cursor
242
260
  # 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.
243
261
  # @option options [Object] :inclusive
@@ -253,7 +271,7 @@ module Slack
253
271
  def conversations_replies(options = {})
254
272
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
255
273
  throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
256
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
274
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
257
275
  if block_given?
258
276
  Pagination::Cursor.new(self, :conversations_replies, options).each do |page|
259
277
  yield page
@@ -275,7 +293,7 @@ module Slack
275
293
  def conversations_setPurpose(options = {})
276
294
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
277
295
  throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
278
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
296
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
279
297
  post('conversations.setPurpose', options)
280
298
  end
281
299
 
@@ -291,7 +309,7 @@ module Slack
291
309
  def conversations_setTopic(options = {})
292
310
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
293
311
  throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
294
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
312
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
295
313
  post('conversations.setTopic', options)
296
314
  end
297
315
 
@@ -304,7 +322,7 @@ module Slack
304
322
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.unarchive.json
305
323
  def conversations_unarchive(options = {})
306
324
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
307
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
325
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
308
326
  post('conversations.unarchive', options)
309
327
  end
310
328
  end
@@ -27,6 +27,8 @@ module Slack
27
27
  #
28
28
  # Retrieves a user's current Do Not Disturb status.
29
29
  #
30
+ # @option options [Object] :team_id
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.
30
32
  # @option options [user] :user
31
33
  # User to fetch status for (defaults to current user).
32
34
  # @see https://api.slack.com/methods/dnd.info
@@ -53,6 +55,8 @@ module Slack
53
55
  #
54
56
  # @option options [Object] :users
55
57
  # Comma-separated list of users to fetch Do Not Disturb status for.
58
+ # @option options [Object] :team_id
59
+ # Encoded team id where passed in users belong, required if org token is used.
56
60
  # @see https://api.slack.com/methods/dnd.teamInfo
57
61
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.teamInfo.json
58
62
  def dnd_teamInfo(options = {})
@@ -36,7 +36,7 @@ module Slack
36
36
  end
37
37
 
38
38
  #
39
- # Gets information about a team file.
39
+ # Gets information about a file.
40
40
  #
41
41
  # @option options [file] :file
42
42
  # Specify a file by providing its ID.
@@ -58,10 +58,14 @@ module Slack
58
58
  end
59
59
 
60
60
  #
61
- # Lists & filters team files.
61
+ # List for a team, in a channel, or from a user with applied filters.
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
66
+ # 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
68
+ # encoded team id to list files in, required if org token is used.
65
69
  # @option options [Object] :ts_from
66
70
  # Filter files created after this timestamp (inclusive).
67
71
  # @option options [Object] :ts_to
@@ -73,7 +77,7 @@ module Slack
73
77
  # @see https://api.slack.com/methods/files.list
74
78
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.list.json
75
79
  def files_list(options = {})
76
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
80
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
77
81
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
78
82
  post('files.list', options)
79
83
  end
@@ -101,7 +105,7 @@ module Slack
101
105
  def files_share(options = {})
102
106
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
103
107
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
104
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
108
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
105
109
  logger.warn('The files.share method is undocumented.')
106
110
  post('files.share', options)
107
111
  end
@@ -18,7 +18,7 @@ module Slack
18
18
  # @option options [Object] :filetype
19
19
  # type of file.
20
20
  # @option options [Object] :indexable_file_contents
21
- # File containing contents that can be used to improve searchability for the remote file.
21
+ # A text file (txt, pdf, doc, etc.) containing textual search terms that are used to improve discovery of the remote file.
22
22
  # @option options [Object] :preview_image
23
23
  # Preview of the document via multipart/form-data.
24
24
  # @see https://api.slack.com/methods/files.remote.add
@@ -59,7 +59,7 @@ module Slack
59
59
  # @see https://api.slack.com/methods/files.remote.list
60
60
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.remote/files.remote.list.json
61
61
  def files_remote_list(options = {})
62
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
62
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
63
63
  if block_given?
64
64
  Pagination::Cursor.new(self, :files_remote_list, options).each do |page|
65
65
  yield page
@@ -88,9 +88,9 @@ module Slack
88
88
  # @option options [Object] :channels
89
89
  # Comma-separated list of channel IDs where the file will be shared.
90
90
  # @option options [Object] :external_id
91
- # Creator defined GUID for the file.
91
+ # The globally unique identifier (GUID) for the file, as set by the app registering the file with Slack. Either this field or file or both are required.
92
92
  # @option options [file] :file
93
- # Specify a file by providing its ID.
93
+ # Specify a file registered with Slack by providing its ID. Either this field or external_id or both are required.
94
94
  # @see https://api.slack.com/methods/files.remote.share
95
95
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.remote/files.remote.share.json
96
96
  def files_remote_share(options = {})
@@ -6,259 +6,6 @@ module Slack
6
6
  module Api
7
7
  module Endpoints
8
8
  module Groups
9
- #
10
- # Archives a private channel.
11
- #
12
- # @option options [group] :channel
13
- # Private channel to archive.
14
- # @see https://api.slack.com/methods/groups.archive
15
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.archive.json
16
- def groups_archive(options = {})
17
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
18
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
19
- post('groups.archive', options)
20
- end
21
-
22
- #
23
- # Creates a private channel.
24
- #
25
- # @option options [Object] :name
26
- # Name of private channel to create.
27
- # @option options [Object] :validate
28
- # Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
29
- # @see https://api.slack.com/methods/groups.create
30
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.create.json
31
- def groups_create(options = {})
32
- throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
33
- post('groups.create', options)
34
- end
35
-
36
- #
37
- # Clones and archives a private channel.
38
- #
39
- # @option options [group] :channel
40
- # Private channel to clone and archive.
41
- # @see https://api.slack.com/methods/groups.createChild
42
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.createChild.json
43
- def groups_createChild(options = {})
44
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
45
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
46
- post('groups.createChild', options)
47
- end
48
-
49
- #
50
- # Fetches history of messages and events from a private channel.
51
- #
52
- # @option options [group] :channel
53
- # Private channel to fetch history for.
54
- # @option options [Object] :inclusive
55
- # Include messages with latest or oldest timestamp in results.
56
- # @option options [timestamp] :latest
57
- # End of time range of messages to include in results.
58
- # @option options [timestamp] :oldest
59
- # Start of time range of messages to include in results.
60
- # @option options [Object] :unreads
61
- # Include unread_count_display in the output?.
62
- # @see https://api.slack.com/methods/groups.history
63
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.history.json
64
- def groups_history(options = {})
65
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
66
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
67
- post('groups.history', options)
68
- end
69
-
70
- #
71
- # Gets information about a private channel.
72
- #
73
- # @option options [group] :channel
74
- # Private channel to get info on.
75
- # @option options [Object] :include_locale
76
- # Set this to true to receive the locale for this group. Defaults to false.
77
- # @see https://api.slack.com/methods/groups.info
78
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.info.json
79
- def groups_info(options = {})
80
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
81
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
82
- post('groups.info', options)
83
- end
84
-
85
- #
86
- # Invites a user to a private channel.
87
- #
88
- # @option options [group] :channel
89
- # Private channel to invite user to.
90
- # @option options [user] :user
91
- # User to invite.
92
- # @see https://api.slack.com/methods/groups.invite
93
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.invite.json
94
- def groups_invite(options = {})
95
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
96
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
97
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
98
- options = options.merge(user: users_id(options)['user']['id']) if options[:user]
99
- post('groups.invite', options)
100
- end
101
-
102
- #
103
- # Removes a user from a private channel.
104
- #
105
- # @option options [group] :channel
106
- # Private channel to remove user from.
107
- # @option options [user] :user
108
- # User to remove from private channel.
109
- # @see https://api.slack.com/methods/groups.kick
110
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.kick.json
111
- def groups_kick(options = {})
112
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
113
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
114
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
115
- options = options.merge(user: users_id(options)['user']['id']) if options[:user]
116
- post('groups.kick', options)
117
- end
118
-
119
- #
120
- # Leaves a private channel.
121
- #
122
- # @option options [group] :channel
123
- # Private channel to leave.
124
- # @see https://api.slack.com/methods/groups.leave
125
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.leave.json
126
- def groups_leave(options = {})
127
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
128
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
129
- post('groups.leave', options)
130
- end
131
-
132
- #
133
- # Lists private channels that the calling user has access to.
134
- #
135
- # @option options [Object] :cursor
136
- # Parameter for pagination. 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. See pagination for more details.
137
- # @option options [Object] :exclude_archived
138
- # Don't return archived private channels.
139
- # @option options [Object] :exclude_members
140
- # Exclude the members from each group.
141
- # @option options [Object] :limit
142
- # 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.
143
- # @see https://api.slack.com/methods/groups.list
144
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.list.json
145
- def groups_list(options = {})
146
- if block_given?
147
- Pagination::Cursor.new(self, :groups_list, options).each do |page|
148
- yield page
149
- end
150
- else
151
- post('groups.list', options)
152
- end
153
- end
154
-
155
- #
156
- # Sets the read cursor in a private channel.
157
- #
158
- # @option options [group] :channel
159
- # Private channel to set reading cursor in.
160
- # @option options [timestamp] :ts
161
- # Timestamp of the most recently seen message.
162
- # @see https://api.slack.com/methods/groups.mark
163
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.mark.json
164
- def groups_mark(options = {})
165
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
166
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
167
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
168
- post('groups.mark', options)
169
- end
170
-
171
- #
172
- # Opens a private channel.
173
- #
174
- # @option options [group] :channel
175
- # Private channel to open.
176
- # @see https://api.slack.com/methods/groups.open
177
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.open.json
178
- def groups_open(options = {})
179
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
180
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
181
- post('groups.open', options)
182
- end
183
-
184
- #
185
- # Renames a private channel.
186
- #
187
- # @option options [group] :channel
188
- # Private channel to rename.
189
- # @option options [Object] :name
190
- # New name for private channel.
191
- # @option options [Object] :validate
192
- # Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
193
- # @see https://api.slack.com/methods/groups.rename
194
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.rename.json
195
- def groups_rename(options = {})
196
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
197
- throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
198
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
199
- post('groups.rename', options)
200
- end
201
-
202
- #
203
- # Retrieve a thread of messages posted to a private channel
204
- #
205
- # @option options [group] :channel
206
- # Private channel to fetch thread from.
207
- # @option options [Object] :thread_ts
208
- # Unique identifier of a thread's parent message.
209
- # @see https://api.slack.com/methods/groups.replies
210
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.replies.json
211
- def groups_replies(options = {})
212
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
213
- throw ArgumentError.new('Required arguments :thread_ts missing') if options[:thread_ts].nil?
214
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
215
- post('groups.replies', options)
216
- end
217
-
218
- #
219
- # Sets the purpose for a private channel.
220
- #
221
- # @option options [group] :channel
222
- # Private channel to set the purpose of.
223
- # @option options [Object] :purpose
224
- # The new purpose.
225
- # @see https://api.slack.com/methods/groups.setPurpose
226
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.setPurpose.json
227
- def groups_setPurpose(options = {})
228
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
229
- throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
230
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
231
- post('groups.setPurpose', options)
232
- end
233
-
234
- #
235
- # Sets the topic for a private channel.
236
- #
237
- # @option options [group] :channel
238
- # Private channel to set the topic of.
239
- # @option options [Object] :topic
240
- # The new topic.
241
- # @see https://api.slack.com/methods/groups.setTopic
242
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.setTopic.json
243
- def groups_setTopic(options = {})
244
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
245
- throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
246
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
247
- post('groups.setTopic', options)
248
- end
249
-
250
- #
251
- # Unarchives a private channel.
252
- #
253
- # @option options [group] :channel
254
- # Private channel to unarchive.
255
- # @see https://api.slack.com/methods/groups.unarchive
256
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.unarchive.json
257
- def groups_unarchive(options = {})
258
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
259
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
260
- post('groups.unarchive', options)
261
- end
262
9
  end
263
10
  end
264
11
  end