slack-ruby-client 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +40 -39
- data/.travis.yml +1 -9
- data/CHANGELOG.md +24 -0
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +3 -1
- data/README.md +40 -12
- data/Rakefile +1 -1
- data/UPGRADING.md +1 -1
- data/bin/commands/api.rb +2 -2
- data/bin/commands/apps_permissions.rb +22 -0
- data/bin/commands/auth.rb +4 -4
- data/bin/commands/bots.rb +2 -2
- data/bin/commands/channels.rb +52 -40
- data/bin/commands/chat.rb +63 -25
- data/bin/commands/conversations.rb +178 -0
- data/bin/commands/dialog.rb +14 -0
- data/bin/commands/dnd.rb +8 -8
- data/bin/commands/emoji.rb +2 -2
- data/bin/commands/files.rb +38 -17
- data/bin/commands/files_comments.rb +6 -6
- data/bin/commands/groups.rb +44 -51
- data/bin/commands/im.rb +16 -13
- data/bin/commands/migration.rb +14 -0
- data/bin/commands/mpim.rb +11 -11
- data/bin/commands/oauth.rb +15 -2
- data/bin/commands/pins.rb +6 -6
- data/bin/commands/reactions.rb +13 -13
- data/bin/commands/reminders.rb +10 -10
- data/bin/commands/rtm.rb +9 -6
- data/bin/commands/search.rb +9 -9
- data/bin/commands/stars.rb +8 -8
- data/bin/commands/team.rb +10 -10
- data/bin/commands/team_profile.rb +2 -2
- data/bin/commands/usergroups.rb +16 -16
- data/bin/commands/usergroups_users.rb +4 -4
- data/bin/commands/users.rb +40 -36
- data/bin/commands/users_admin.rb +28 -0
- data/bin/commands/users_prefs.rb +12 -0
- data/bin/commands/users_profile.rb +7 -7
- data/bin/commands.rb +7 -1
- data/bin/slack +1 -1
- data/examples/hi_real_time/hi.rb +1 -1
- data/examples/hi_real_time_and_web/hi.rb +1 -1
- data/examples/hi_real_time_async_celluloid/hi.rb +1 -1
- data/examples/hi_real_time_async_eventmachine/hi.rb +1 -1
- data/examples/hi_web/hi.rb +1 -1
- data/examples/new_ticket/new_ticket.rb +1 -1
- data/lib/slack/messages/formatting.rb +4 -4
- data/lib/slack/messages/message.rb +1 -2
- data/lib/slack/real_time/api/templates/event_handler.erb +1 -1
- data/lib/slack/real_time/client.rb +11 -10
- data/lib/slack/real_time/concurrency/celluloid.rb +6 -2
- data/lib/slack/real_time/config.rb +11 -11
- data/lib/slack/real_time/models/base.rb +1 -2
- data/lib/slack/real_time/socket.rb +2 -2
- data/lib/slack/real_time/stores/base.rb +1 -2
- data/lib/slack/real_time/stores/starter.rb +92 -72
- data/lib/slack/real_time/stores/store.rb +120 -90
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/api.rb +2 -2
- data/lib/slack/web/api/endpoints/apps_permissions.rb +35 -0
- data/lib/slack/web/api/endpoints/auth.rb +4 -4
- data/lib/slack/web/api/endpoints/bots.rb +2 -2
- data/lib/slack/web/api/endpoints/channels.rb +57 -34
- data/lib/slack/web/api/endpoints/chat.rb +107 -37
- data/lib/slack/web/api/endpoints/conversations.rb +301 -0
- data/lib/slack/web/api/endpoints/dialog.rb +32 -0
- data/lib/slack/web/api/endpoints/dnd.rb +9 -9
- data/lib/slack/web/api/endpoints/emoji.rb +2 -2
- data/lib/slack/web/api/endpoints/files.rb +53 -23
- data/lib/slack/web/api/endpoints/files_comments.rb +11 -11
- data/lib/slack/web/api/endpoints/groups.rb +38 -50
- data/lib/slack/web/api/endpoints/im.rb +27 -17
- data/lib/slack/web/api/endpoints/migration.rb +25 -0
- data/lib/slack/web/api/endpoints/mpim.rb +13 -15
- data/lib/slack/web/api/endpoints/oauth.rb +24 -3
- data/lib/slack/web/api/endpoints/pins.rb +6 -8
- data/lib/slack/web/api/endpoints/presence.rb +1 -1
- data/lib/slack/web/api/endpoints/reactions.rb +18 -20
- data/lib/slack/web/api/endpoints/reminders.rb +10 -10
- data/lib/slack/web/api/endpoints/rtm.rb +14 -8
- data/lib/slack/web/api/endpoints/search.rb +12 -12
- data/lib/slack/web/api/endpoints/stars.rb +10 -12
- data/lib/slack/web/api/endpoints/team.rb +12 -13
- data/lib/slack/web/api/endpoints/team_profile.rb +2 -2
- data/lib/slack/web/api/endpoints/usergroups.rb +22 -22
- data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -4
- data/lib/slack/web/api/endpoints/users.rb +34 -24
- data/lib/slack/web/api/endpoints/users_admin.rb +46 -0
- data/lib/slack/web/api/endpoints/users_prefs.rb +19 -0
- data/lib/slack/web/api/endpoints/users_profile.rb +10 -10
- data/lib/slack/web/api/endpoints.rb +14 -2
- data/lib/slack/web/api/mixins/ids.id.rb +1 -1
- data/lib/slack/web/api/mixins/users.search.rb +38 -36
- data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +1 -1
- data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +4 -3
- data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +17 -0
- data/lib/slack/web/api/patches/dialog.1.open-json-support.patch +17 -0
- data/lib/slack/web/api/templates/command.erb +4 -3
- data/lib/slack/web/api/templates/commands.erb +1 -1
- data/lib/slack/web/api/templates/endpoints.erb +2 -2
- data/lib/slack/web/api/templates/method.erb +18 -3
- data/lib/slack/web/api/templates/method_spec.erb +1 -1
- data/lib/slack/web/config.rb +16 -12
- data/lib/slack/web/faraday/connection.rb +1 -1
- data/lib/slack/web/faraday/response/raise_error.rb +3 -3
- data/lib/slack/web/pagination/cursor.rb +48 -0
- data/lib/slack-ruby-client.rb +6 -0
- data/lib/tasks/git.rake +1 -1
- data/lib/tasks/real_time.rake +1 -1
- data/lib/tasks/web.rake +4 -1
- data/slack-ruby-client.gemspec +2 -3
- data/spec/fixtures/slack/web/paginated_users_list.yml +181 -0
- data/spec/integration/integration_spec.rb +1 -1
- data/spec/slack/messages/formatting_spec.rb +1 -1
- data/spec/slack/real_time/client_spec.rb +62 -63
- data/spec/slack/real_time/concurrency/celluloid_spec.rb +41 -31
- data/spec/slack/real_time/concurrency/it_behaves_like_a_realtime_socket.rb +1 -1
- data/spec/slack/real_time/event_handlers/bot_spec.rb +4 -2
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
- data/spec/slack/real_time/event_handlers/user_spec.rb +4 -2
- data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +15 -0
- data/spec/slack/web/api/endpoints/conversations_spec.rb +100 -0
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +37 -1
- data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +28 -0
- data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +16 -6
- data/spec/slack/web/api/endpoints/files_comments_spec.rb +8 -8
- data/spec/slack/web/api/endpoints/files_spec.rb +16 -5
- data/spec/slack/web/api/endpoints/migration_spec.rb +12 -0
- data/spec/slack/web/api/endpoints/oauth_spec.rb +11 -0
- data/spec/slack/web/api/endpoints/users_admin_spec.rb +17 -0
- data/spec/slack/web/api/endpoints/users_prefs_spec.rb +7 -0
- data/spec/slack/web/api/error_spec.rb +1 -1
- data/spec/slack/web/api/errors/slack_error_spec.rb +1 -1
- data/spec/slack/web/api/mixins/users_spec.rb +6 -4
- data/spec/slack/web/api/pagination/cursor_spec.rb +70 -0
- data/spec/support/queue_with_timeout.rb +1 -1
- data/spec/support/real_time/concurrency/mock.rb +1 -2
- metadata +47 -30
@@ -0,0 +1,301 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Web
|
5
|
+
module Api
|
6
|
+
module Endpoints
|
7
|
+
module Conversations
|
8
|
+
#
|
9
|
+
# Archives a conversation.
|
10
|
+
#
|
11
|
+
# @option options [channel] :channel
|
12
|
+
# ID of conversation to archive.
|
13
|
+
# @see https://api.slack.com/methods/conversations.archive
|
14
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.archive.json
|
15
|
+
def conversations_archive(options = {})
|
16
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
17
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
18
|
+
post('conversations.archive', options)
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Closes a direct message or multi-person direct message.
|
23
|
+
#
|
24
|
+
# @option options [channel] :channel
|
25
|
+
# Conversation to close.
|
26
|
+
# @see https://api.slack.com/methods/conversations.close
|
27
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.close.json
|
28
|
+
def conversations_close(options = {})
|
29
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
30
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
31
|
+
post('conversations.close', options)
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Initiates a public or private channel-based conversation
|
36
|
+
#
|
37
|
+
# @option options [Object] :name
|
38
|
+
# Name of the public or private channel to create.
|
39
|
+
# @option options [Object] :is_private
|
40
|
+
# Create a private channel instead of a public one.
|
41
|
+
# @see https://api.slack.com/methods/conversations.create
|
42
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.create.json
|
43
|
+
def conversations_create(options = {})
|
44
|
+
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
45
|
+
post('conversations.create', options)
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Fetches a conversation's history of messages and events.
|
50
|
+
#
|
51
|
+
# @option options [channel] :channel
|
52
|
+
# Conversation ID to fetch history for.
|
53
|
+
# @option options [Object] :cursor
|
54
|
+
# 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.
|
55
|
+
# @option options [timestamp] :latest
|
56
|
+
# End of time range of messages to include in results.
|
57
|
+
# @option options [Object] :limit
|
58
|
+
# 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.
|
59
|
+
# @option options [timestamp] :oldest
|
60
|
+
# Start of time range of messages to include in results.
|
61
|
+
# @see https://api.slack.com/methods/conversations.history
|
62
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.history.json
|
63
|
+
def conversations_history(options = {})
|
64
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
65
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
66
|
+
if block_given?
|
67
|
+
Pagination::Cursor.new(self, :conversations_history, options).each do |page|
|
68
|
+
yield page
|
69
|
+
end
|
70
|
+
else
|
71
|
+
post('conversations.history', options)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# Retrieve information about a conversation.
|
77
|
+
#
|
78
|
+
# @option options [channel] :channel
|
79
|
+
# Conversation ID to learn more about.
|
80
|
+
# @option options [Object] :include_locale
|
81
|
+
# Set this to true to receive the locale for this conversation. Defaults to false.
|
82
|
+
# @see https://api.slack.com/methods/conversations.info
|
83
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.info.json
|
84
|
+
def conversations_info(options = {})
|
85
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
86
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
87
|
+
post('conversations.info', options)
|
88
|
+
end
|
89
|
+
|
90
|
+
#
|
91
|
+
# Invites users to a channel.
|
92
|
+
#
|
93
|
+
# @option options [channel] :channel
|
94
|
+
# The ID of the public or private channel to invite user(s) to.
|
95
|
+
# @option options [Object] :users
|
96
|
+
# A comma separated list of user IDs. Up to 30 users may be listed.
|
97
|
+
# @see https://api.slack.com/methods/conversations.invite
|
98
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.invite.json
|
99
|
+
def conversations_invite(options = {})
|
100
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
101
|
+
throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
|
102
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
103
|
+
post('conversations.invite', options)
|
104
|
+
end
|
105
|
+
|
106
|
+
#
|
107
|
+
# Joins an existing conversation.
|
108
|
+
#
|
109
|
+
# @option options [channel] :channel
|
110
|
+
# ID of conversation to join.
|
111
|
+
# @see https://api.slack.com/methods/conversations.join
|
112
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.join.json
|
113
|
+
def conversations_join(options = {})
|
114
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
115
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
116
|
+
post('conversations.join', options)
|
117
|
+
end
|
118
|
+
|
119
|
+
#
|
120
|
+
# Removes a user from a conversation.
|
121
|
+
#
|
122
|
+
# @option options [channel] :channel
|
123
|
+
# ID of conversation to remove user from.
|
124
|
+
# @option options [user] :user
|
125
|
+
# User ID to be removed.
|
126
|
+
# @see https://api.slack.com/methods/conversations.kick
|
127
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.kick.json
|
128
|
+
def conversations_kick(options = {})
|
129
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
130
|
+
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
131
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
132
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
133
|
+
post('conversations.kick', options)
|
134
|
+
end
|
135
|
+
|
136
|
+
#
|
137
|
+
# Leaves a conversation.
|
138
|
+
#
|
139
|
+
# @option options [channel] :channel
|
140
|
+
# Conversation to leave.
|
141
|
+
# @see https://api.slack.com/methods/conversations.leave
|
142
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.leave.json
|
143
|
+
def conversations_leave(options = {})
|
144
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
145
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
146
|
+
post('conversations.leave', options)
|
147
|
+
end
|
148
|
+
|
149
|
+
#
|
150
|
+
# Lists all channels in a Slack team.
|
151
|
+
#
|
152
|
+
# @option options [Object] :cursor
|
153
|
+
# 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.
|
154
|
+
# @option options [Object] :exclude_archived
|
155
|
+
# Set to true to exclude archived channels from the list.
|
156
|
+
# @option options [Object] :limit
|
157
|
+
# 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.
|
158
|
+
# @option options [Object] :types
|
159
|
+
# Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.
|
160
|
+
# @see https://api.slack.com/methods/conversations.list
|
161
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.list.json
|
162
|
+
def conversations_list(options = {})
|
163
|
+
if block_given?
|
164
|
+
Pagination::Cursor.new(self, :conversations_list, options).each do |page|
|
165
|
+
yield page
|
166
|
+
end
|
167
|
+
else
|
168
|
+
post('conversations.list', options)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
#
|
173
|
+
# Retrieve members of a conversation.
|
174
|
+
#
|
175
|
+
# @option options [channel] :channel
|
176
|
+
# ID of the conversation to retrieve members for.
|
177
|
+
# @option options [Object] :cursor
|
178
|
+
# 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.
|
179
|
+
# @option options [Object] :limit
|
180
|
+
# 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.
|
181
|
+
# @see https://api.slack.com/methods/conversations.members
|
182
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.members.json
|
183
|
+
def conversations_members(options = {})
|
184
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
185
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
186
|
+
if block_given?
|
187
|
+
Pagination::Cursor.new(self, :conversations_members, options).each do |page|
|
188
|
+
yield page
|
189
|
+
end
|
190
|
+
else
|
191
|
+
post('conversations.members', options)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
#
|
196
|
+
# Opens or resumes a direct message or multi-person direct message.
|
197
|
+
#
|
198
|
+
# @option options [channel] :channel
|
199
|
+
# Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead.
|
200
|
+
# @option options [Object] :return_im
|
201
|
+
# Boolean, indicates you want the full IM channel definition in the response.
|
202
|
+
# @option options [Object] :users
|
203
|
+
# 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.
|
204
|
+
# @see https://api.slack.com/methods/conversations.open
|
205
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.open.json
|
206
|
+
def conversations_open(options = {})
|
207
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
208
|
+
post('conversations.open', options)
|
209
|
+
end
|
210
|
+
|
211
|
+
#
|
212
|
+
# Renames a conversation.
|
213
|
+
#
|
214
|
+
# @option options [channel] :channel
|
215
|
+
# ID of conversation to rename.
|
216
|
+
# @option options [Object] :name
|
217
|
+
# New name for conversation.
|
218
|
+
# @see https://api.slack.com/methods/conversations.rename
|
219
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.rename.json
|
220
|
+
def conversations_rename(options = {})
|
221
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
222
|
+
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
223
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
224
|
+
post('conversations.rename', options)
|
225
|
+
end
|
226
|
+
|
227
|
+
#
|
228
|
+
# Retrieve a thread of messages posted to a conversation
|
229
|
+
#
|
230
|
+
# @option options [channel] :channel
|
231
|
+
# Conversation ID to fetch thread from.
|
232
|
+
# @option options [timestamp] :ts
|
233
|
+
# Unique identifier of a thread's parent message.
|
234
|
+
# @option options [Object] :cursor
|
235
|
+
# 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.
|
236
|
+
# @option options [Object] :limit
|
237
|
+
# 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.
|
238
|
+
# @see https://api.slack.com/methods/conversations.replies
|
239
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.replies.json
|
240
|
+
def conversations_replies(options = {})
|
241
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
242
|
+
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
243
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
244
|
+
if block_given?
|
245
|
+
Pagination::Cursor.new(self, :conversations_replies, options).each do |page|
|
246
|
+
yield page
|
247
|
+
end
|
248
|
+
else
|
249
|
+
post('conversations.replies', options)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
#
|
254
|
+
# Sets the purpose for a conversation.
|
255
|
+
#
|
256
|
+
# @option options [channel] :channel
|
257
|
+
# Conversation to set the purpose of.
|
258
|
+
# @option options [Object] :purpose
|
259
|
+
# A new, specialer purpose.
|
260
|
+
# @see https://api.slack.com/methods/conversations.setPurpose
|
261
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.setPurpose.json
|
262
|
+
def conversations_setPurpose(options = {})
|
263
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
264
|
+
throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
|
265
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
266
|
+
post('conversations.setPurpose', options)
|
267
|
+
end
|
268
|
+
|
269
|
+
#
|
270
|
+
# Sets the topic for a conversation.
|
271
|
+
#
|
272
|
+
# @option options [channel] :channel
|
273
|
+
# Conversation to set the topic of.
|
274
|
+
# @option options [Object] :topic
|
275
|
+
# The new topic string. Does not support formatting or linkification.
|
276
|
+
# @see https://api.slack.com/methods/conversations.setTopic
|
277
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.setTopic.json
|
278
|
+
def conversations_setTopic(options = {})
|
279
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
280
|
+
throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
|
281
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
282
|
+
post('conversations.setTopic', options)
|
283
|
+
end
|
284
|
+
|
285
|
+
#
|
286
|
+
# Reverses conversation archival.
|
287
|
+
#
|
288
|
+
# @option options [channel] :channel
|
289
|
+
# ID of conversation to unarchive.
|
290
|
+
# @see https://api.slack.com/methods/conversations.unarchive
|
291
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.unarchive.json
|
292
|
+
def conversations_unarchive(options = {})
|
293
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
294
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
295
|
+
post('conversations.unarchive', options)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Web
|
5
|
+
module Api
|
6
|
+
module Endpoints
|
7
|
+
module Dialog
|
8
|
+
#
|
9
|
+
# Open a dialog with a user
|
10
|
+
#
|
11
|
+
# @option options [Object] :dialog
|
12
|
+
# The dialog definition. This must be a JSON-encoded string.
|
13
|
+
# @option options [Object] :trigger_id
|
14
|
+
# Exchange a trigger to post to the user.
|
15
|
+
# @see https://api.slack.com/methods/dialog.open
|
16
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dialog/dialog.open.json
|
17
|
+
def dialog_open(options = {})
|
18
|
+
throw ArgumentError.new('Required arguments :dialog missing') if options[:dialog].nil?
|
19
|
+
throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
|
20
|
+
# dialog must be passed as an encoded JSON string
|
21
|
+
if options.key?(:dialog)
|
22
|
+
dialog = options[:dialog]
|
23
|
+
dialog = JSON.dump(dialog) unless dialog.is_a?(String)
|
24
|
+
options = options.merge(dialog: dialog)
|
25
|
+
end
|
26
|
+
post('dialog.open', options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -6,10 +6,10 @@ module Slack
|
|
6
6
|
module Endpoints
|
7
7
|
module Dnd
|
8
8
|
#
|
9
|
-
# Ends the user's
|
9
|
+
# Ends the current user's Do Not Disturb session immediately.
|
10
10
|
#
|
11
11
|
# @see https://api.slack.com/methods/dnd.endDnd
|
12
|
-
# @see https://github.com/
|
12
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.endDnd.json
|
13
13
|
def dnd_endDnd(options = {})
|
14
14
|
post('dnd.endDnd', options)
|
15
15
|
end
|
@@ -18,42 +18,42 @@ module Slack
|
|
18
18
|
# Ends the current user's snooze mode immediately.
|
19
19
|
#
|
20
20
|
# @see https://api.slack.com/methods/dnd.endSnooze
|
21
|
-
# @see https://github.com/
|
21
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.endSnooze.json
|
22
22
|
def dnd_endSnooze(options = {})
|
23
23
|
post('dnd.endSnooze', options)
|
24
24
|
end
|
25
25
|
|
26
26
|
#
|
27
|
-
#
|
27
|
+
# Retrieves a user's current Do Not Disturb status.
|
28
28
|
#
|
29
29
|
# @option options [user] :user
|
30
30
|
# User to fetch status for (defaults to current user).
|
31
31
|
# @see https://api.slack.com/methods/dnd.info
|
32
|
-
# @see https://github.com/
|
32
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.info.json
|
33
33
|
def dnd_info(options = {})
|
34
34
|
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
35
35
|
post('dnd.info', options)
|
36
36
|
end
|
37
37
|
|
38
38
|
#
|
39
|
-
#
|
39
|
+
# Turns on Do Not Disturb mode for the current user, or changes its duration.
|
40
40
|
#
|
41
41
|
# @option options [Object] :num_minutes
|
42
42
|
# Number of minutes, from now, to snooze until.
|
43
43
|
# @see https://api.slack.com/methods/dnd.setSnooze
|
44
|
-
# @see https://github.com/
|
44
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.setSnooze.json
|
45
45
|
def dnd_setSnooze(options = {})
|
46
46
|
throw ArgumentError.new('Required arguments :num_minutes missing') if options[:num_minutes].nil?
|
47
47
|
post('dnd.setSnooze', options)
|
48
48
|
end
|
49
49
|
|
50
50
|
#
|
51
|
-
#
|
51
|
+
# Retrieves the Do Not Disturb status for users on a team.
|
52
52
|
#
|
53
53
|
# @option options [Object] :users
|
54
54
|
# Comma-separated list of users to fetch Do Not Disturb status for.
|
55
55
|
# @see https://api.slack.com/methods/dnd.teamInfo
|
56
|
-
# @see https://github.com/
|
56
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.teamInfo.json
|
57
57
|
def dnd_teamInfo(options = {})
|
58
58
|
post('dnd.teamInfo', options)
|
59
59
|
end
|
@@ -6,10 +6,10 @@ module Slack
|
|
6
6
|
module Endpoints
|
7
7
|
module Emoji
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# Lists custom emoji for a team.
|
10
10
|
#
|
11
11
|
# @see https://api.slack.com/methods/emoji.list
|
12
|
-
# @see https://github.com/
|
12
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/emoji/emoji.list.json
|
13
13
|
def emoji_list(options = {})
|
14
14
|
post('emoji.list', options)
|
15
15
|
end
|
@@ -6,34 +6,48 @@ module Slack
|
|
6
6
|
module Endpoints
|
7
7
|
module Files
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# Deletes a file.
|
10
10
|
#
|
11
11
|
# @option options [file] :file
|
12
12
|
# ID of file to delete.
|
13
13
|
# @see https://api.slack.com/methods/files.delete
|
14
|
-
# @see https://github.com/
|
14
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.delete.json
|
15
15
|
def files_delete(options = {})
|
16
16
|
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
17
17
|
post('files.delete', options)
|
18
18
|
end
|
19
19
|
|
20
20
|
#
|
21
|
-
#
|
21
|
+
# Change the properties of a file (undocumented)
|
22
|
+
#
|
23
|
+
# @option options [Object] :file
|
24
|
+
# ID of the file to be edited
|
25
|
+
# @option options [Object] :title
|
26
|
+
# New title of the file
|
27
|
+
# @option options [Object] :filetype
|
28
|
+
# New filetype of the file. See https://api.slack.com/types/file#file_types for a list of all supported types.
|
29
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.edit.json
|
30
|
+
def files_edit(options = {})
|
31
|
+
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
32
|
+
throw ArgumentError.new('Required arguments :title missing') if options[:title].nil?
|
33
|
+
post('files.edit', options)
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Gets information about a team file.
|
22
38
|
#
|
23
39
|
# @option options [file] :file
|
24
40
|
# Specify a file by providing its ID.
|
25
41
|
# @see https://api.slack.com/methods/files.info
|
26
|
-
# @see https://github.com/
|
42
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.info.json
|
27
43
|
def files_info(options = {})
|
28
44
|
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
29
45
|
post('files.info', options)
|
30
46
|
end
|
31
47
|
|
32
48
|
#
|
33
|
-
#
|
49
|
+
# Lists & filters team files.
|
34
50
|
#
|
35
|
-
# @option options [user] :user
|
36
|
-
# Filter files created by a single user.
|
37
51
|
# @option options [channel] :channel
|
38
52
|
# Filter files appearing in a specific channel, indicated by its ID.
|
39
53
|
# @option options [Object] :ts_from
|
@@ -54,8 +68,10 @@ module Slack
|
|
54
68
|
#
|
55
69
|
# You can pass multiple values in the types argument, like types=spaces,snippets.The default value is all, which does not filter the list.
|
56
70
|
# .
|
71
|
+
# @option options [user] :user
|
72
|
+
# Filter files created by a single user.
|
57
73
|
# @see https://api.slack.com/methods/files.list
|
58
|
-
# @see https://github.com/
|
74
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.list.json
|
59
75
|
def files_list(options = {})
|
60
76
|
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
61
77
|
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
@@ -63,50 +79,64 @@ module Slack
|
|
63
79
|
end
|
64
80
|
|
65
81
|
#
|
66
|
-
#
|
82
|
+
# Revokes public/external sharing access for a file
|
67
83
|
#
|
68
84
|
# @option options [file] :file
|
69
85
|
# File to revoke.
|
70
86
|
# @see https://api.slack.com/methods/files.revokePublicURL
|
71
|
-
# @see https://github.com/
|
87
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.revokePublicURL.json
|
72
88
|
def files_revokePublicURL(options = {})
|
73
89
|
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
74
90
|
post('files.revokePublicURL', options)
|
75
91
|
end
|
76
92
|
|
77
93
|
#
|
78
|
-
#
|
94
|
+
# Share an existing file in a channel (undocumented)
|
95
|
+
#
|
96
|
+
# @option options [Object] :file
|
97
|
+
# ID of the file to be shared
|
98
|
+
# @option options [channel] :channel
|
99
|
+
# Channel to share the file in. Works with both public (channel ID) and private channels (group ID).
|
100
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.share.json
|
101
|
+
def files_share(options = {})
|
102
|
+
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
103
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
104
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
105
|
+
post('files.share', options)
|
106
|
+
end
|
107
|
+
|
108
|
+
#
|
109
|
+
# Enables a file for public/external sharing.
|
79
110
|
#
|
80
111
|
# @option options [file] :file
|
81
112
|
# File to share.
|
82
113
|
# @see https://api.slack.com/methods/files.sharedPublicURL
|
83
|
-
# @see https://github.com/
|
114
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.sharedPublicURL.json
|
84
115
|
def files_sharedPublicURL(options = {})
|
85
116
|
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
86
117
|
post('files.sharedPublicURL', options)
|
87
118
|
end
|
88
119
|
|
89
120
|
#
|
90
|
-
#
|
121
|
+
# Uploads or creates a file.
|
91
122
|
#
|
92
|
-
# @option options [
|
93
|
-
#
|
123
|
+
# @option options [Object] :channels
|
124
|
+
# Comma-separated list of channel names or IDs where the file will be shared.
|
94
125
|
# @option options [Object] :content
|
95
126
|
# File contents via a POST variable. If omitting this parameter, you must provide a file.
|
96
|
-
# @option options [
|
97
|
-
#
|
127
|
+
# @option options [file] :file
|
128
|
+
# File contents via multipart/form-data. If omitting this parameter, you must submit content.
|
98
129
|
# @option options [Object] :filename
|
99
130
|
# Filename of file.
|
100
|
-
# @option options [Object] :
|
101
|
-
#
|
131
|
+
# @option options [Object] :filetype
|
132
|
+
# A file type identifier.
|
102
133
|
# @option options [Object] :initial_comment
|
103
134
|
# Initial comment to add to file.
|
104
|
-
# @option options [Object] :
|
105
|
-
#
|
135
|
+
# @option options [Object] :title
|
136
|
+
# Title of file.
|
106
137
|
# @see https://api.slack.com/methods/files.upload
|
107
|
-
# @see https://github.com/
|
138
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.upload.json
|
108
139
|
def files_upload(options = {})
|
109
|
-
throw ArgumentError.new('Required arguments :filename missing') if options[:filename].nil?
|
110
140
|
post('files.upload', options)
|
111
141
|
end
|
112
142
|
end
|
@@ -8,27 +8,27 @@ module Slack
|
|
8
8
|
#
|
9
9
|
# Add a comment to an existing file.
|
10
10
|
#
|
11
|
-
# @option options [file] :file
|
12
|
-
# File to add a comment to.
|
13
11
|
# @option options [Object] :comment
|
14
12
|
# Text of the comment to add.
|
13
|
+
# @option options [file] :file
|
14
|
+
# File to add a comment to.
|
15
15
|
# @see https://api.slack.com/methods/files.comments.add
|
16
|
-
# @see https://github.com/
|
16
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.comments/files.comments.add.json
|
17
17
|
def files_comments_add(options = {})
|
18
|
-
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
19
18
|
throw ArgumentError.new('Required arguments :comment missing') if options[:comment].nil?
|
19
|
+
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
20
20
|
post('files.comments.add', options)
|
21
21
|
end
|
22
22
|
|
23
23
|
#
|
24
|
-
#
|
24
|
+
# Deletes an existing comment on a file.
|
25
25
|
#
|
26
26
|
# @option options [file] :file
|
27
27
|
# File to delete a comment from.
|
28
28
|
# @option options [Object] :id
|
29
29
|
# The comment to delete.
|
30
30
|
# @see https://api.slack.com/methods/files.comments.delete
|
31
|
-
# @see https://github.com/
|
31
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.comments/files.comments.delete.json
|
32
32
|
def files_comments_delete(options = {})
|
33
33
|
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
34
34
|
throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
|
@@ -36,20 +36,20 @@ module Slack
|
|
36
36
|
end
|
37
37
|
|
38
38
|
#
|
39
|
-
# Edit an existing
|
39
|
+
# Edit an existing file comment.
|
40
40
|
#
|
41
|
+
# @option options [Object] :comment
|
42
|
+
# Text of the comment to edit.
|
41
43
|
# @option options [file] :file
|
42
44
|
# File containing the comment to edit.
|
43
45
|
# @option options [Object] :id
|
44
46
|
# The comment to edit.
|
45
|
-
# @option options [Object] :comment
|
46
|
-
# Text of the comment to edit.
|
47
47
|
# @see https://api.slack.com/methods/files.comments.edit
|
48
|
-
# @see https://github.com/
|
48
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.comments/files.comments.edit.json
|
49
49
|
def files_comments_edit(options = {})
|
50
|
+
throw ArgumentError.new('Required arguments :comment missing') if options[:comment].nil?
|
50
51
|
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
51
52
|
throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
|
52
|
-
throw ArgumentError.new('Required arguments :comment missing') if options[:comment].nil?
|
53
53
|
post('files.comments.edit', options)
|
54
54
|
end
|
55
55
|
end
|