slack-ruby-client 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -3
  3. data/LICENSE.md +1 -1
  4. data/README.md +8 -8
  5. data/bin/commands.rb +0 -1
  6. data/bin/commands/admin_analytics.rb +2 -1
  7. data/bin/commands/admin_conversations.rb +0 -10
  8. data/bin/commands/admin_teams.rb +1 -1
  9. data/bin/commands/channels.rb +0 -157
  10. data/bin/commands/chat.rb +8 -6
  11. data/bin/commands/conversations.rb +2 -2
  12. data/bin/commands/dnd.rb +2 -0
  13. data/bin/commands/groups.rb +0 -163
  14. data/bin/commands/im.rb +0 -62
  15. data/bin/commands/mpim.rb +0 -60
  16. data/lib/slack/events/request.rb +2 -2
  17. data/lib/slack/real_time/config.rb +3 -13
  18. data/lib/slack/version.rb +1 -1
  19. data/lib/slack/web/api/endpoints.rb +0 -2
  20. data/lib/slack/web/api/endpoints/admin_analytics.rb +3 -1
  21. data/lib/slack/web/api/endpoints/admin_conversations.rb +0 -14
  22. data/lib/slack/web/api/endpoints/admin_teams.rb +1 -1
  23. data/lib/slack/web/api/endpoints/channels.rb +0 -265
  24. data/lib/slack/web/api/endpoints/chat.rb +11 -7
  25. data/lib/slack/web/api/endpoints/conversations.rb +2 -2
  26. data/lib/slack/web/api/endpoints/dnd.rb +4 -0
  27. data/lib/slack/web/api/endpoints/groups.rb +0 -273
  28. data/lib/slack/web/api/endpoints/im.rb +0 -107
  29. data/lib/slack/web/api/endpoints/mpim.rb +0 -102
  30. data/lib/slack/web/api/errors.rb +14 -16
  31. data/lib/slack/web/api/patches/chat.1.patch +5 -6
  32. data/lib/slack/web/faraday/connection.rb +1 -1
  33. data/lib/slack/web/faraday/response/raise_error.rb +0 -4
  34. data/lib/slack/web/faraday/response/wrap_error.rb +11 -5
  35. data/lib/tasks/web.rake +4 -0
  36. data/spec/fixtures/slack/web/{groups_info.yml → conversations_info.yml} +4 -4
  37. data/spec/slack/events/request_spec.rb +6 -5
  38. data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +10 -0
  39. data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +10 -0
  40. data/spec/slack/real_time/rtm_connect_spec.rb +1 -1
  41. data/spec/slack/real_time/rtm_start_spec.rb +1 -1
  42. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +0 -5
  43. data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
  44. data/spec/slack/web/api/endpoints/im_spec.rb +0 -31
  45. data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -31
  46. data/spec/slack/web/client_spec.rb +15 -20
  47. metadata +10 -12
  48. data/spec/slack/web/api/endpoints/admin_conversations_whitelist_spec.rb +0 -32
  49. data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +0 -13
  50. data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +0 -13
  51. data/spec/slack/web/api/endpoints/views_spec.rb +0 -29
@@ -145,18 +145,18 @@ 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
- # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
150
148
  # @option options [Object] :as_user
151
- # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below. This argument may not be used with newer bot tokens.
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
- # Emoji to use as the icon for this message. Overrides icon_url. See authorship below. Use with bot tokens requires chat:write.customize.
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
159
- # URL to an image to use as the icon for this message. See authorship below. Use with bot tokens requires chat:write.customize.
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
160
  # @option options [Object] :link_names
161
161
  # Find and link channel names and usernames.
162
162
  # @option options [Object] :mrkdwn
@@ -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
@@ -172,7 +174,7 @@ module Slack
172
174
  # @option options [Object] :unfurl_media
173
175
  # Pass false to disable unfurling of media content.
174
176
  # @option options [Object] :username
175
- # Set your bot's user name. See authorship below. Use with bot tokens requires chat:write.customize.
177
+ # Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
176
178
  # @see https://api.slack.com/methods/chat.postMessage
177
179
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postMessage.json
178
180
  def chat_postMessage(options = {})
@@ -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
@@ -163,7 +163,7 @@ module Slack
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
165
  # @option options [Object] :team_id
166
- # encoded team id to list channels in, required if org token is used.
166
+ # encoded team id to list channels in, required if token belongs to org-wide app.
167
167
  # @option options [Object] :types
168
168
  # Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.
169
169
  # @see https://api.slack.com/methods/conversations.list
@@ -255,7 +255,7 @@ module Slack
255
255
  # @option options [channel] :channel
256
256
  # Conversation ID to fetch thread from.
257
257
  # @option options [timestamp] :ts
258
- # Unique identifier of a thread's parent message. 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.
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.
259
259
  # @option options [Object] :cursor
260
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.
261
261
  # @option options [Object] :inclusive
@@ -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 = {})
@@ -6,279 +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
- logger.warn('groups.archive: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.archive.')
20
- post('groups.archive', options)
21
- end
22
-
23
- #
24
- # Creates a private channel.
25
- #
26
- # @option options [Object] :name
27
- # Name of private channel to create.
28
- # @option options [Object] :team_id
29
- # encoded team id to create the channel in, required if org token is used.
30
- # @option options [Object] :validate
31
- # Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
32
- # @see https://api.slack.com/methods/groups.create
33
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.create.json
34
- def groups_create(options = {})
35
- throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
36
- logger.warn('groups.create: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.create.')
37
- post('groups.create', options)
38
- end
39
-
40
- #
41
- # Clones and archives a private channel.
42
- #
43
- # @option options [group] :channel
44
- # Private channel to clone and archive.
45
- # @see https://api.slack.com/methods/groups.createChild
46
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.createChild.json
47
- def groups_createChild(options = {})
48
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
49
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
50
- logger.warn('groups.createChild: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: .')
51
- post('groups.createChild', options)
52
- end
53
-
54
- #
55
- # Fetches history of messages and events from a private channel.
56
- #
57
- # @option options [group] :channel
58
- # Private channel to fetch history for.
59
- # @option options [Object] :inclusive
60
- # Include messages with latest or oldest timestamp in results.
61
- # @option options [timestamp] :latest
62
- # End of time range of messages to include in results.
63
- # @option options [timestamp] :oldest
64
- # Start of time range of messages to include in results.
65
- # @option options [Object] :unreads
66
- # Include unread_count_display in the output?.
67
- # @see https://api.slack.com/methods/groups.history
68
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.history.json
69
- def groups_history(options = {})
70
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
71
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
72
- logger.warn('groups.history: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.history.')
73
- post('groups.history', options)
74
- end
75
-
76
- #
77
- # Gets information about a private channel.
78
- #
79
- # @option options [group] :channel
80
- # Private channel to get info on.
81
- # @option options [Object] :include_locale
82
- # Set this to true to receive the locale for this group. Defaults to false.
83
- # @see https://api.slack.com/methods/groups.info
84
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.info.json
85
- def groups_info(options = {})
86
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
87
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
88
- logger.warn('groups.info: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.info.')
89
- post('groups.info', options)
90
- end
91
-
92
- #
93
- # Invites a user to a private channel.
94
- #
95
- # @option options [group] :channel
96
- # Private channel to invite user to.
97
- # @option options [user] :user
98
- # User to invite.
99
- # @see https://api.slack.com/methods/groups.invite
100
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.invite.json
101
- def groups_invite(options = {})
102
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
103
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
104
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
105
- options = options.merge(user: users_id(options)['user']['id']) if options[:user]
106
- logger.warn('groups.invite: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.invite.')
107
- post('groups.invite', options)
108
- end
109
-
110
- #
111
- # Removes a user from a private channel.
112
- #
113
- # @option options [group] :channel
114
- # Private channel to remove user from.
115
- # @option options [user] :user
116
- # User to remove from private channel.
117
- # @see https://api.slack.com/methods/groups.kick
118
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.kick.json
119
- def groups_kick(options = {})
120
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
121
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
122
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
123
- options = options.merge(user: users_id(options)['user']['id']) if options[:user]
124
- logger.warn('groups.kick: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.kick.')
125
- post('groups.kick', options)
126
- end
127
-
128
- #
129
- # Leaves a private channel.
130
- #
131
- # @option options [group] :channel
132
- # Private channel to leave.
133
- # @see https://api.slack.com/methods/groups.leave
134
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.leave.json
135
- def groups_leave(options = {})
136
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
137
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
138
- logger.warn('groups.leave: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.leave.')
139
- post('groups.leave', options)
140
- end
141
-
142
- #
143
- # Lists private channels that the calling user has access to.
144
- #
145
- # @option options [Object] :cursor
146
- # 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.
147
- # @option options [Object] :exclude_archived
148
- # Don't return archived private channels.
149
- # @option options [Object] :exclude_members
150
- # Exclude the members from each group.
151
- # @option options [Object] :limit
152
- # 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.
153
- # @option options [Object] :team_id
154
- # encoded team id to list channels in, required if org token is used.
155
- # @see https://api.slack.com/methods/groups.list
156
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.list.json
157
- def groups_list(options = {})
158
- logger.warn('groups.list: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.list, users.conversations.')
159
- if block_given?
160
- Pagination::Cursor.new(self, :groups_list, options).each do |page|
161
- yield page
162
- end
163
- else
164
- post('groups.list', options)
165
- end
166
- end
167
-
168
- #
169
- # Sets the read cursor in a private channel.
170
- #
171
- # @option options [group] :channel
172
- # Channel or conversation to set the read cursor for.
173
- # @option options [timestamp] :ts
174
- # Unique identifier of message you want marked as most recently seen in this conversation.
175
- # @see https://api.slack.com/methods/groups.mark
176
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.mark.json
177
- def groups_mark(options = {})
178
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
179
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
180
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
181
- logger.warn('groups.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.mark.')
182
- post('groups.mark', options)
183
- end
184
-
185
- #
186
- # Opens a private channel.
187
- #
188
- # @option options [group] :channel
189
- # Private channel to open.
190
- # @see https://api.slack.com/methods/groups.open
191
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.open.json
192
- def groups_open(options = {})
193
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
194
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
195
- logger.warn('groups.open: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: .')
196
- post('groups.open', options)
197
- end
198
-
199
- #
200
- # Renames a private channel.
201
- #
202
- # @option options [group] :channel
203
- # Private channel to rename.
204
- # @option options [Object] :name
205
- # New name for private channel.
206
- # @option options [Object] :validate
207
- # Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
208
- # @see https://api.slack.com/methods/groups.rename
209
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.rename.json
210
- def groups_rename(options = {})
211
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
212
- throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
213
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
214
- logger.warn('groups.rename: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.rename.')
215
- post('groups.rename', options)
216
- end
217
-
218
- #
219
- # Retrieve a thread of messages posted to a private channel
220
- #
221
- # @option options [group] :channel
222
- # Private channel to fetch thread from.
223
- # @option options [Object] :thread_ts
224
- # Unique identifier of a thread's parent message.
225
- # @see https://api.slack.com/methods/groups.replies
226
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.replies.json
227
- def groups_replies(options = {})
228
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
229
- throw ArgumentError.new('Required arguments :thread_ts missing') if options[:thread_ts].nil?
230
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
231
- logger.warn('groups.replies: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.replies.')
232
- post('groups.replies', options)
233
- end
234
-
235
- #
236
- # Sets the purpose for a private channel.
237
- #
238
- # @option options [group] :channel
239
- # Private channel to set the purpose of.
240
- # @option options [Object] :purpose
241
- # The new purpose.
242
- # @see https://api.slack.com/methods/groups.setPurpose
243
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.setPurpose.json
244
- def groups_setPurpose(options = {})
245
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
246
- throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
247
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
248
- logger.warn('groups.setPurpose: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.setPurpose.')
249
- post('groups.setPurpose', options)
250
- end
251
-
252
- #
253
- # Sets the topic for a private channel.
254
- #
255
- # @option options [group] :channel
256
- # Private channel to set the topic of.
257
- # @option options [Object] :topic
258
- # The new topic.
259
- # @see https://api.slack.com/methods/groups.setTopic
260
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.setTopic.json
261
- def groups_setTopic(options = {})
262
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
263
- throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
264
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
265
- logger.warn('groups.setTopic: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.setTopic.')
266
- post('groups.setTopic', options)
267
- end
268
-
269
- #
270
- # Unarchives a private channel.
271
- #
272
- # @option options [group] :channel
273
- # Private channel to unarchive.
274
- # @see https://api.slack.com/methods/groups.unarchive
275
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.unarchive.json
276
- def groups_unarchive(options = {})
277
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
278
- options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
279
- logger.warn('groups.unarchive: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.unarchive.')
280
- post('groups.unarchive', options)
281
- end
282
9
  end
283
10
  end
284
11
  end
@@ -6,113 +6,6 @@ module Slack
6
6
  module Api
7
7
  module Endpoints
8
8
  module Im
9
- #
10
- # Close a direct message channel.
11
- #
12
- # @option options [im] :channel
13
- # Direct message channel to close.
14
- # @see https://api.slack.com/methods/im.close
15
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.close.json
16
- def im_close(options = {})
17
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
18
- options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
19
- logger.warn('im.close: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.close.')
20
- post('im.close', options)
21
- end
22
-
23
- #
24
- # Fetches history of messages and events from direct message channel.
25
- #
26
- # @option options [im] :channel
27
- # Direct message channel to fetch history for.
28
- # @option options [Object] :inclusive
29
- # Include messages with latest or oldest timestamp in results.
30
- # @option options [timestamp] :latest
31
- # End of time range of messages to include in results.
32
- # @option options [timestamp] :oldest
33
- # Start of time range of messages to include in results.
34
- # @option options [Object] :unreads
35
- # Include unread_count_display in the output?.
36
- # @see https://api.slack.com/methods/im.history
37
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.history.json
38
- def im_history(options = {})
39
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
40
- options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
41
- logger.warn('im.history: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.history.')
42
- post('im.history', options)
43
- end
44
-
45
- #
46
- # Lists direct message channels for the calling user.
47
- #
48
- # @option options [Object] :cursor
49
- # 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.
50
- # @option options [Object] :limit
51
- # 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.
52
- # @see https://api.slack.com/methods/im.list
53
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.list.json
54
- def im_list(options = {})
55
- logger.warn('im.list: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.list, users.conversations.')
56
- if block_given?
57
- Pagination::Cursor.new(self, :im_list, options).each do |page|
58
- yield page
59
- end
60
- else
61
- post('im.list', options)
62
- end
63
- end
64
-
65
- #
66
- # Sets the read cursor in a direct message channel.
67
- #
68
- # @option options [im] :channel
69
- # Direct message channel to set reading cursor in.
70
- # @option options [timestamp] :ts
71
- # Timestamp of the most recently seen message.
72
- # @see https://api.slack.com/methods/im.mark
73
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.mark.json
74
- def im_mark(options = {})
75
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
76
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
77
- options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
78
- logger.warn('im.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.mark.')
79
- post('im.mark', options)
80
- end
81
-
82
- #
83
- # Opens a direct message channel.
84
- #
85
- # @option options [user] :user
86
- # User to open a direct message channel with.
87
- # @option options [Object] :include_locale
88
- # Set this to true to receive the locale for this im. Defaults to false.
89
- # @option options [Object] :return_im
90
- # Boolean, indicates you want the full IM channel definition in the response.
91
- # @see https://api.slack.com/methods/im.open
92
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.open.json
93
- def im_open(options = {})
94
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
95
- options = options.merge(user: users_id(options)['user']['id']) if options[:user]
96
- logger.warn('im.open: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.open.')
97
- post('im.open', options)
98
- end
99
-
100
- #
101
- # Retrieve a thread of messages posted to a direct message conversation
102
- #
103
- # @option options [im] :channel
104
- # Direct message channel to fetch thread from.
105
- # @option options [Object] :thread_ts
106
- # Unique identifier of a thread's parent message.
107
- # @see https://api.slack.com/methods/im.replies
108
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.replies.json
109
- def im_replies(options = {})
110
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
111
- throw ArgumentError.new('Required arguments :thread_ts missing') if options[:thread_ts].nil?
112
- options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
113
- logger.warn('im.replies: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.replies.')
114
- post('im.replies', options)
115
- end
116
9
  end
117
10
  end
118
11
  end