forked from slack-ruby/slack-ruby-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conversations.rb
261 lines (238 loc) · 15.6 KB
/
conversations.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake
module Slack
module Cli
class App
desc 'Conversations methods.'
command 'conversations' do |g|
g.desc 'Accepts an invitation to a Slack Connect channel.'
g.long_desc %( Accepts an invitation to a Slack Connect channel. )
g.command 'acceptSharedInvite' do |c|
c.flag 'channel_name', desc: 'Name of the channel. If the channel does not exist already in your workspace, this name is the one that the channel will take.'
c.flag 'channel_id', desc: "ID of the channel that you'd like to accept. Must provide either invite_id or channel_id."
c.flag 'free_trial_accepted', desc: "Whether you'd like to use your workspace's free trial to begin using Slack Connect."
c.flag 'invite_id', desc: 'See the shared_channel_invite_received event payload for more details on how to retrieve the ID of the invitation.'
c.flag 'is_private', desc: 'Whether the channel should be private.'
c.flag 'team_id', desc: 'The ID of the workspace to accept the channel in. If an org-level token is used to call this method, the team_id argument is required.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_acceptSharedInvite(options))
end
end
g.desc 'Approves an invitation to a Slack Connect channel'
g.long_desc %( Approves an invitation to a Slack Connect channel )
g.command 'approveSharedInvite' do |c|
c.flag 'invite_id', desc: 'ID of the shared channel invite to approve.'
c.flag 'target_team', desc: 'The team or enterprise id of the other party involved in the invitation you are approving.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_approveSharedInvite(options))
end
end
g.desc 'Archives a conversation.'
g.long_desc %( Archives a conversation. )
g.command 'archive' do |c|
c.flag 'channel', desc: 'ID of conversation to archive.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_archive(options))
end
end
g.desc 'Closes a direct message or multi-person direct message.'
g.long_desc %( Closes a direct message or multi-person direct message. )
g.command 'close' do |c|
c.flag 'channel', desc: 'Conversation to close.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_close(options))
end
end
g.desc 'Initiates a public or private channel-based conversation'
g.long_desc %( Initiates a public or private channel-based conversation )
g.command 'create' do |c|
c.flag 'name', desc: 'Name of the public or private channel to create.'
c.flag 'is_private', desc: 'Create a private channel instead of a public one.'
c.flag 'team_id', desc: 'encoded team id to create the channel in, required if org token is used.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_create(options))
end
end
g.desc 'Declines a Slack Connect channel invite.'
g.long_desc %( Declines a Slack Connect channel invite. )
g.command 'declineSharedInvite' do |c|
c.flag 'invite_id', desc: 'ID of the Slack Connect invite to decline. Subscribe to the shared_channel_invite_accepted event to receive IDs of Slack Connect channel invites that have been accepted and are awaiting approval.'
c.flag 'target_team', desc: 'The team or enterprise id of the other party involved in the invitation you are declining.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_declineSharedInvite(options))
end
end
g.desc "Fetches a conversation's history of messages and events."
g.long_desc %( Fetches a conversation's history of messages and events. )
g.command 'history' do |c|
c.flag 'channel', desc: 'Conversation ID to fetch history for.'
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
c.flag 'include_all_metadata', desc: 'Return all metadata associated with this message.'
c.flag 'inclusive', desc: 'Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified.'
c.flag 'latest', desc: 'Only messages before this Unix timestamp will be included in results. Default is the current time.'
c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
c.flag 'oldest', desc: 'Only messages after this Unix timestamp will be included in results.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_history(options))
end
end
g.desc 'Retrieve information about a conversation.'
g.long_desc %( Retrieve information about a conversation. )
g.command 'info' do |c|
c.flag 'channel', desc: 'Conversation ID to learn more about.'
c.flag 'include_locale', desc: 'Set this to true to receive the locale for this conversation. Defaults to false.'
c.flag 'include_num_members', desc: 'Set to true to include the member count for the specified conversation. Defaults to false.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_info(options))
end
end
g.desc 'Invites users to a channel.'
g.long_desc %( Invites users to a channel. )
g.command 'invite' do |c|
c.flag 'channel', desc: 'The ID of the public or private channel to invite user(s) to.'
c.flag 'users', desc: 'A comma separated list of user IDs. Up to 1000 users may be listed.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_invite(options))
end
end
g.desc 'Sends an invitation to a Slack Connect channel'
g.long_desc %( Sends an invitation to a Slack Connect channel )
g.command 'inviteShared' do |c|
c.flag 'channel', desc: "ID of the channel on your team that you'd like to share."
c.flag 'emails', desc: 'Optional email to receive this invite. Either emails or user_ids must be provided.'
c.flag 'external_limited', desc: 'Optional boolean on whether invite is to a external limited member. Defaults to true.'
c.flag 'user_ids', desc: 'Optional user_id to receive this invite. Either emails or user_ids must be provided.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_inviteShared(options))
end
end
g.desc 'Joins an existing conversation.'
g.long_desc %( Joins an existing conversation. )
g.command 'join' do |c|
c.flag 'channel', desc: 'ID of conversation to join.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_join(options))
end
end
g.desc 'Removes a user from a conversation.'
g.long_desc %( Removes a user from a conversation. )
g.command 'kick' do |c|
c.flag 'channel', desc: 'ID of conversation to remove user from.'
c.flag 'user', desc: 'User ID to be removed.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_kick(options))
end
end
g.desc 'Leaves a conversation.'
g.long_desc %( Leaves a conversation. )
g.command 'leave' do |c|
c.flag 'channel', desc: 'Conversation to leave.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_leave(options))
end
end
g.desc 'Lists all channels in a Slack team.'
g.long_desc %( Lists all channels in a Slack team. )
g.command 'list' do |c|
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached. Must be an integer no larger than 1000."
c.flag 'team_id', desc: 'encoded team id to list channels in, required if token belongs to org-wide app.'
c.flag 'types', desc: 'Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_list(options))
end
end
g.desc 'Lists shared channel invites that have been generated or received but have not been approved by all parties'
g.long_desc %( Lists shared channel invites that have been generated or received but have not been approved by all parties )
g.command 'listConnectInvites' do |c|
c.flag 'cursor', desc: 'Set to next_cursor returned by previous call to list items in subsequent page.'
c.flag 'team_id', desc: 'Encoded team id for the workspace to retrieve invites for, required if org token is used.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_listConnectInvites(options))
end
end
g.desc 'Sets the read cursor in a channel.'
g.long_desc %( Sets the read cursor in a channel. )
g.command 'mark' do |c|
c.flag 'channel', desc: 'Channel or conversation to set the read cursor for.'
c.flag 'ts', desc: 'Unique identifier of message you want marked as most recently seen in this conversation.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_mark(options))
end
end
g.desc 'Retrieve members of a conversation.'
g.long_desc %( Retrieve members of a conversation. )
g.command 'members' do |c|
c.flag 'channel', desc: 'ID of the conversation to retrieve members for.'
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_members(options))
end
end
g.desc 'Opens or resumes a direct message or multi-person direct message.'
g.long_desc %( Opens or resumes a direct message or multi-person direct message. )
g.command 'open' do |c|
c.flag 'channel', desc: "Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead."
c.flag 'prevent_creation', desc: 'Do not create a direct message or multi-person direct message. This is used to see if there is an existing dm or mpdm.'
c.flag 'return_im', desc: 'Boolean, indicates you want the full IM channel definition in the response.'
c.flag 'users', desc: 'Comma separated lists of users. If only one user is included, this creates a 1:1 DM. The ordering of the users is preserved whenever a multi-person direct message is returned. Supply a channel when not supplying users.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_open(options))
end
end
g.desc 'Renames a conversation.'
g.long_desc %( Renames a conversation. )
g.command 'rename' do |c|
c.flag 'channel', desc: 'ID of conversation to rename.'
c.flag 'name', desc: 'New name for conversation.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_rename(options))
end
end
g.desc 'Retrieve a thread of messages posted to a conversation'
g.long_desc %( Retrieve a thread of messages posted to a conversation )
g.command 'replies' do |c|
c.flag 'channel', desc: 'Conversation ID to fetch thread from.'
c.flag 'ts', desc: "Unique identifier of either a thread's parent message or a message in the thread. ts must be the timestamp of an existing message with 0 or more replies. If there are no replies then just the single message referenced by ts will return - it is just an ordinary, unthreaded message."
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
c.flag 'include_all_metadata', desc: 'Return all metadata associated with this message.'
c.flag 'inclusive', desc: 'Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified.'
c.flag 'latest', desc: 'Only messages before this Unix timestamp will be included in results.'
c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
c.flag 'oldest', desc: 'Only messages after this Unix timestamp will be included in results.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_replies(options))
end
end
g.desc 'Sets the purpose for a conversation.'
g.long_desc %( Sets the purpose for a conversation. )
g.command 'setPurpose' do |c|
c.flag 'channel', desc: 'Conversation to set the purpose of.'
c.flag 'purpose', desc: 'A new, specialer purpose.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_setPurpose(options))
end
end
g.desc 'Sets the topic for a conversation.'
g.long_desc %( Sets the topic for a conversation. )
g.command 'setTopic' do |c|
c.flag 'channel', desc: 'Conversation to set the topic of.'
c.flag 'topic', desc: 'The new topic string. Does not support formatting or linkification.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_setTopic(options))
end
end
g.desc 'Reverses conversation archival.'
g.long_desc %( Reverses conversation archival. )
g.command 'unarchive' do |c|
c.flag 'channel', desc: 'ID of conversation to unarchive.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_unarchive(options))
end
end
end
end
end
end