slack-ruby-client 0.9.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +16 -11
- data/CHANGELOG.md +11 -0
- data/README.md +40 -12
- data/UPGRADING.md +1 -1
- data/bin/commands.rb +1 -0
- data/bin/commands/channels.rb +3 -0
- data/bin/commands/conversations.rb +178 -0
- data/bin/commands/groups.rb +1 -9
- data/bin/commands/im.rb +3 -0
- data/bin/commands/rtm.rb +1 -0
- data/bin/commands/users.rb +3 -1
- data/lib/slack-ruby-client.rb +6 -0
- data/lib/slack/real_time/client.rb +1 -1
- data/lib/slack/real_time/concurrency/celluloid.rb +1 -1
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +2 -0
- data/lib/slack/web/api/endpoints/channels.rb +13 -1
- data/lib/slack/web/api/endpoints/conversations.rb +301 -0
- data/lib/slack/web/api/endpoints/groups.rb +2 -13
- data/lib/slack/web/api/endpoints/im.rb +13 -1
- data/lib/slack/web/api/endpoints/rtm.rb +2 -0
- data/lib/slack/web/api/endpoints/users.rb +11 -1
- data/lib/slack/web/api/templates/command.erb +2 -2
- data/lib/slack/web/api/templates/method.erb +10 -0
- data/lib/slack/web/config.rb +7 -3
- data/lib/slack/web/faraday/connection.rb +1 -1
- data/lib/slack/web/pagination/cursor.rb +48 -0
- data/spec/fixtures/slack/web/paginated_users_list.yml +181 -0
- data/spec/slack/real_time/client_spec.rb +60 -62
- data/spec/slack/real_time/concurrency/celluloid_spec.rb +41 -31
- data/spec/slack/web/api/endpoints/conversations_spec.rb +100 -0
- data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +8 -0
- data/spec/slack/web/api/pagination/cursor_spec.rb +70 -0
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b96448be8f1c835685f93f3393f8920cae201f40
|
4
|
+
data.tar.gz: 425cd9b3c64c3ece99de2ee2fd678b088cee8332
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ef45ffaa491253809ea56bbcdff87ca957ac483da23a3233b8167452e7cdf36f071fa94fd1cb123f1dd6eb148d6b590c64fee78d1df0301689d6ca8964d9bc1
|
7
|
+
data.tar.gz: 38041c875f7b29eb12b0345bae2b04664dab1d31d1eda39c408feabff8f3f180112c28be13b4909737474f6c06c70ccb48c3faf1ad2b6acd9384ec4dd6bf97b4
|
data/.rubocop_todo.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2017-
|
3
|
+
# on 2017-09-19 15:04:24 -0400 using RuboCop version 0.35.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 4
|
10
10
|
Lint/HandleExceptions:
|
11
11
|
Exclude:
|
12
12
|
- 'lib/slack-ruby-client.rb'
|
@@ -20,7 +20,7 @@ Lint/UnusedBlockArgument:
|
|
20
20
|
Exclude:
|
21
21
|
- 'lib/slack/messages/formatting.rb'
|
22
22
|
|
23
|
-
# Offense count:
|
23
|
+
# Offense count: 18
|
24
24
|
Metrics/AbcSize:
|
25
25
|
Max: 44
|
26
26
|
|
@@ -29,25 +29,30 @@ Metrics/AbcSize:
|
|
29
29
|
Metrics/ClassLength:
|
30
30
|
Max: 165
|
31
31
|
|
32
|
-
# Offense count:
|
32
|
+
# Offense count: 4
|
33
33
|
Metrics/CyclomaticComplexity:
|
34
34
|
Max: 9
|
35
35
|
|
36
|
-
# Offense count:
|
36
|
+
# Offense count: 734
|
37
37
|
# Configuration parameters: AllowURI, URISchemes.
|
38
38
|
Metrics/LineLength:
|
39
|
-
Max:
|
39
|
+
Max: 266
|
40
40
|
|
41
|
-
# Offense count:
|
41
|
+
# Offense count: 9
|
42
42
|
# Configuration parameters: CountComments.
|
43
43
|
Metrics/MethodLength:
|
44
44
|
Max: 32
|
45
45
|
|
46
|
-
# Offense count:
|
46
|
+
# Offense count: 1
|
47
|
+
# Configuration parameters: CountComments.
|
48
|
+
Metrics/ModuleLength:
|
49
|
+
Max: 113
|
50
|
+
|
51
|
+
# Offense count: 3
|
47
52
|
Metrics/PerceivedComplexity:
|
48
53
|
Max: 11
|
49
54
|
|
50
|
-
# Offense count:
|
55
|
+
# Offense count: 64
|
51
56
|
# Configuration parameters: Exclude.
|
52
57
|
Style/Documentation:
|
53
58
|
Enabled: false
|
@@ -58,12 +63,12 @@ Style/FileName:
|
|
58
63
|
Exclude:
|
59
64
|
- 'lib/slack-ruby-client.rb'
|
60
65
|
|
61
|
-
# Offense count:
|
66
|
+
# Offense count: 136
|
62
67
|
# Configuration parameters: AllowedVariables.
|
63
68
|
Style/GlobalVars:
|
64
69
|
Enabled: false
|
65
70
|
|
66
|
-
# Offense count:
|
71
|
+
# Offense count: 24
|
67
72
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
68
73
|
Style/MethodName:
|
69
74
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
### 0.10.0 (9/19/2017)
|
2
|
+
|
3
|
+
* [#169](https://github.com/slack-ruby/slack-ruby-client/pull/169): Added [Conversations API](https://api.slack.com/docs/conversations-api) - [@jmanian](https://github.com/jmanian).
|
4
|
+
* [#169](https://github.com/slack-ruby/slack-ruby-client/pull/169): Added `include_locale` parameter to several methods (`channels_info`, `groups_info`, `im_open`, `rtm_start`, `users_info`, `users_list`) - [@jmanian](https://github.com/jmanian).
|
5
|
+
* [#169](https://github.com/slack-ruby/slack-ruby-client/pull/169): Removed `groups_close` - [@jmanian](https://github.com/jmanian).
|
6
|
+
* [#167](https://github.com/slack-ruby/slack-ruby-client/pull/167): Added support for pausing between paginated requests that can cause Slack rate limiting - [@jmanian](https://github.com/jmanian).
|
7
|
+
* [#163](https://github.com/slack-ruby/slack-ruby-client/pull/164): Use `OpenSSL::X509::DEFAULT_CERT_DIR` and `OpenSSL::X509::DEFAULT_CERT_FILE` for default ca_cert and ca_file - [@leifcr](https://github.com/leifcr).
|
8
|
+
* [#161](https://github.com/slack-ruby/slack-ruby-client/pull/161): Added support for cursor pagination - [@dblock](https://github.com/dblock).
|
9
|
+
* [#162](https://github.com/slack-ruby/slack-ruby-client/pull/162): Gracefully close websocket on `Errno::EPIPE` - [@johanoskarsson](https://github.com/johanoskarsson).
|
10
|
+
* [#172](https://github.com/slack-ruby/slack-ruby-client/pull/172): Use `rtm.start` when store is a subclass of `Slack::RealTime::Stores::Store` (default) - [@kstole](https://github.com/kstole).
|
11
|
+
|
1
12
|
### 0.9.1 (8/24/2017)
|
2
13
|
|
3
14
|
* [#158](https://github.com/slack-ruby/slack-ruby-client/issues/158): Updated to latest slack-api-ref; Updated chat.3.update patch to reflect argument reordering; Added chat.4.postEphemeral patch to apply the attachments JSON fix (whitespace last line of diff matters! ;-) - [@alexagranov](https://github.com/alexagranov).
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web) and [RealTime Messa
|
|
18
18
|
|
19
19
|
## Stable Release
|
20
20
|
|
21
|
-
You're reading the documentation for the **stable** release of slack-ruby-client. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
21
|
+
You're reading the documentation for the **stable** release of slack-ruby-client, 0.10.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
@@ -164,17 +164,19 @@ client = Slack::Web::Client.new(user_agent: 'Slack Ruby Client/1.0')
|
|
164
164
|
|
165
165
|
The following settings are supported.
|
166
166
|
|
167
|
-
setting
|
168
|
-
|
169
|
-
token
|
170
|
-
user_agent
|
171
|
-
proxy
|
172
|
-
ca_path
|
173
|
-
ca_file
|
174
|
-
endpoint
|
175
|
-
logger
|
176
|
-
timeout
|
177
|
-
open_timeout
|
167
|
+
setting | description
|
168
|
+
--------------------|-------------------------------------------------------------------------------------------------
|
169
|
+
token | Slack API token.
|
170
|
+
user_agent | User-agent, defaults to _Slack Ruby Client/version_.
|
171
|
+
proxy | Optional HTTP proxy.
|
172
|
+
ca_path | Optional SSL certificates path.
|
173
|
+
ca_file | Optional SSL certificates file.
|
174
|
+
endpoint | Slack endpoint, default is _https://slack.com/api_.
|
175
|
+
logger | Optional `Logger` instance that logs HTTP requests.
|
176
|
+
timeout | Optional open/read timeout in seconds.
|
177
|
+
open_timeout | Optional connection open timeout in seconds.
|
178
|
+
default_page_size | Optional page size for paginated requests, default is _100_.
|
179
|
+
default_max_retries | Optional number of retries for paginated requests, default is _100_.
|
178
180
|
|
179
181
|
You can also pass request options, including `timeout` and `open_timeout` into individual calls.
|
180
182
|
|
@@ -182,6 +184,32 @@ You can also pass request options, including `timeout` and `open_timeout` into i
|
|
182
184
|
client.channels_list(request: { timeout: 180 })
|
183
185
|
```
|
184
186
|
|
187
|
+
#### Pagination Support
|
188
|
+
|
189
|
+
The Web client natively supports [cursor pagination](https://api.slack.com/docs/pagination#cursors) for methods that allow it, such as `users_list`. Supply a block and the client will make repeated requests adjusting the value of `cursor` with every response. The default limit is set to 100 and can be adjusted via `Slack::Web::Client.config.default_page_size` or by passing it directly into the API call.
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
all_members = []
|
193
|
+
client.users_list(presence: true, limit: 10) do |response|
|
194
|
+
all_members.concat(response.members)
|
195
|
+
end
|
196
|
+
all_members # many thousands of team members retrieved 10 at a time
|
197
|
+
```
|
198
|
+
|
199
|
+
When using cursor pagination the client will automatically pause and then retry the request if it runs into Slack rate limiting. (It will pause according to the `Retry-After` header in the 429 response before retrying the request.) If it receives too many rate-limited responses in a row it will give up and raise an error. The default number of retries is 100 and can be adjusted via `Slack::Web::Client.config.default_max_retries` or by passing it directly into the method as `max_retries`.
|
200
|
+
|
201
|
+
You can also proactively avoid rate limiting by adding a pause between every paginated request with the `sleep_interval` parameter, which is given in seconds.
|
202
|
+
|
203
|
+
```ruby
|
204
|
+
all_members = []
|
205
|
+
client.users_list(presence: true, limit: 10, sleep_interval: 5, max_retries: 20) do |response|
|
206
|
+
# pauses for 5 seconds between each request
|
207
|
+
# gives up after 20 consecutive rate-limited responses
|
208
|
+
all_members.concat(response.members)
|
209
|
+
end
|
210
|
+
all_members # many thousands of team members retrieved 10 at a time
|
211
|
+
```
|
212
|
+
|
185
213
|
### RealTime Client
|
186
214
|
|
187
215
|
The Real Time Messaging API is a WebSocket-based API that allows you to receive events from Slack in real time and send messages as user.
|
data/UPGRADING.md
CHANGED
@@ -5,7 +5,7 @@ Upgrading Slack-Ruby-Client
|
|
5
5
|
|
6
6
|
#### Changes in How the RTM Client Connects
|
7
7
|
|
8
|
-
The RealTime client now automatically chooses either [rtm.start](https://api.slack.com/methods/rtm.start) or [rtm.connect](https://api.slack.com/methods/rtm.connect) to open a connection. The
|
8
|
+
The RealTime client now automatically chooses either [rtm.start](https://api.slack.com/methods/rtm.start) or [rtm.connect](https://api.slack.com/methods/rtm.connect) to open a connection. The `rtm.connect` method is a newer, preferred method, which serves connection purposes and returns some basic team info. The `rtm.start` method additionally returns a lot of data about the team, its channels, and members, and is required to use the full `Slack::RealTime::Stores::Store` storage class.
|
9
9
|
|
10
10
|
Prior versions always used `rtm.start`, to restore this behavior, configure `start_method`.
|
11
11
|
|
data/bin/commands.rb
CHANGED
data/bin/commands/channels.rb
CHANGED
@@ -38,6 +38,7 @@ command 'channels' do |g|
|
|
38
38
|
g.long_desc %( Gets information about a channel. )
|
39
39
|
g.command 'info' do |c|
|
40
40
|
c.flag 'channel', desc: 'Channel to get info on.'
|
41
|
+
c.flag 'include_locale', desc: 'Set this to true to receive the locale for this channel. Defaults to false.'
|
41
42
|
c.action do |_global_options, options, _args|
|
42
43
|
puts JSON.dump($client.channels_info(options))
|
43
44
|
end
|
@@ -85,8 +86,10 @@ command 'channels' do |g|
|
|
85
86
|
g.desc 'Lists all channels in a Slack team.'
|
86
87
|
g.long_desc %( Lists all channels in a Slack team. )
|
87
88
|
g.command 'list' do |c|
|
89
|
+
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."
|
88
90
|
c.flag 'exclude_archived', desc: 'Exclude archived channels from the list.'
|
89
91
|
c.flag 'exclude_members', desc: 'Exclude the members collection from each channel.'
|
92
|
+
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."
|
90
93
|
c.action do |_global_options, options, _args|
|
91
94
|
puts JSON.dump($client.channels_list(options))
|
92
95
|
end
|
@@ -0,0 +1,178 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
desc "Interface with all kinds of conversations the same way, whether they're public or private channels, direct messages, or otherwise."
|
4
|
+
command 'conversations' do |g|
|
5
|
+
g.desc 'Archives a conversation.'
|
6
|
+
g.long_desc %( Archives a conversation. )
|
7
|
+
g.command 'archive' do |c|
|
8
|
+
c.flag 'channel', desc: 'ID of conversation to archive.'
|
9
|
+
c.action do |_global_options, options, _args|
|
10
|
+
puts JSON.dump($client.conversations_archive(options))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
g.desc 'Closes a direct message or multi-person direct message.'
|
15
|
+
g.long_desc %( Closes a direct message or multi-person direct message. )
|
16
|
+
g.command 'close' do |c|
|
17
|
+
c.flag 'channel', desc: 'Conversation to close.'
|
18
|
+
c.action do |_global_options, options, _args|
|
19
|
+
puts JSON.dump($client.conversations_close(options))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
g.desc 'Initiates a public or private channel-based conversation'
|
24
|
+
g.long_desc %( Initiates a public or private channel-based conversation )
|
25
|
+
g.command 'create' do |c|
|
26
|
+
c.flag 'name', desc: 'Name of the public or private channel to create.'
|
27
|
+
c.flag 'is_private', desc: 'Create a private channel instead of a public one.'
|
28
|
+
c.action do |_global_options, options, _args|
|
29
|
+
puts JSON.dump($client.conversations_create(options))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
g.desc "Fetches a conversation's history of messages and events."
|
34
|
+
g.long_desc %( Fetches a conversation's history of messages and events. )
|
35
|
+
g.command 'history' do |c|
|
36
|
+
c.flag 'channel', desc: 'Conversation ID to fetch history for.'
|
37
|
+
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."
|
38
|
+
c.flag 'latest', desc: 'End of time range of messages to include in results.'
|
39
|
+
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."
|
40
|
+
c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
|
41
|
+
c.action do |_global_options, options, _args|
|
42
|
+
puts JSON.dump($client.conversations_history(options))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
g.desc 'Retrieve information about a conversation.'
|
47
|
+
g.long_desc %( Retrieve information about a conversation. )
|
48
|
+
g.command 'info' do |c|
|
49
|
+
c.flag 'channel', desc: 'Conversation ID to learn more about.'
|
50
|
+
c.flag 'include_locale', desc: 'Set this to true to receive the locale for this conversation. Defaults to false.'
|
51
|
+
c.action do |_global_options, options, _args|
|
52
|
+
puts JSON.dump($client.conversations_info(options))
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
g.desc 'Invites users to a channel.'
|
57
|
+
g.long_desc %( Invites users to a channel. )
|
58
|
+
g.command 'invite' do |c|
|
59
|
+
c.flag 'channel', desc: 'The ID of the public or private channel to invite user(s) to.'
|
60
|
+
c.flag 'users', desc: 'A comma separated list of user IDs. Up to 30 users may be listed.'
|
61
|
+
c.action do |_global_options, options, _args|
|
62
|
+
puts JSON.dump($client.conversations_invite(options))
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
g.desc 'Joins an existing conversation.'
|
67
|
+
g.long_desc %( Joins an existing conversation. )
|
68
|
+
g.command 'join' do |c|
|
69
|
+
c.flag 'channel', desc: 'ID of conversation to join.'
|
70
|
+
c.action do |_global_options, options, _args|
|
71
|
+
puts JSON.dump($client.conversations_join(options))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
g.desc 'Removes a user from a conversation.'
|
76
|
+
g.long_desc %( Removes a user from a conversation. )
|
77
|
+
g.command 'kick' do |c|
|
78
|
+
c.flag 'channel', desc: 'ID of conversation to remove user from.'
|
79
|
+
c.flag 'user', desc: 'User ID to be removed.'
|
80
|
+
c.action do |_global_options, options, _args|
|
81
|
+
puts JSON.dump($client.conversations_kick(options))
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
g.desc 'Leaves a conversation.'
|
86
|
+
g.long_desc %( Leaves a conversation. )
|
87
|
+
g.command 'leave' do |c|
|
88
|
+
c.flag 'channel', desc: 'Conversation to leave.'
|
89
|
+
c.action do |_global_options, options, _args|
|
90
|
+
puts JSON.dump($client.conversations_leave(options))
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
g.desc 'Lists all channels in a Slack team.'
|
95
|
+
g.long_desc %( Lists all channels in a Slack team. )
|
96
|
+
g.command 'list' do |c|
|
97
|
+
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."
|
98
|
+
c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
|
99
|
+
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."
|
100
|
+
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.'
|
101
|
+
c.action do |_global_options, options, _args|
|
102
|
+
puts JSON.dump($client.conversations_list(options))
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
g.desc 'Retrieve members of a conversation.'
|
107
|
+
g.long_desc %( Retrieve members of a conversation. )
|
108
|
+
g.command 'members' do |c|
|
109
|
+
c.flag 'channel', desc: 'ID of the conversation to retrieve members for.'
|
110
|
+
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."
|
111
|
+
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."
|
112
|
+
c.action do |_global_options, options, _args|
|
113
|
+
puts JSON.dump($client.conversations_members(options))
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
g.desc 'Opens or resumes a direct message or multi-person direct message.'
|
118
|
+
g.long_desc %( Opens or resumes a direct message or multi-person direct message. )
|
119
|
+
g.command 'open' do |c|
|
120
|
+
c.flag 'channel', desc: "Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead."
|
121
|
+
c.flag 'return_im', desc: 'Boolean, indicates you want the full IM channel definition in the response.'
|
122
|
+
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.'
|
123
|
+
c.action do |_global_options, options, _args|
|
124
|
+
puts JSON.dump($client.conversations_open(options))
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
g.desc 'Renames a conversation.'
|
129
|
+
g.long_desc %( Renames a conversation. )
|
130
|
+
g.command 'rename' do |c|
|
131
|
+
c.flag 'channel', desc: 'ID of conversation to rename.'
|
132
|
+
c.flag 'name', desc: 'New name for conversation.'
|
133
|
+
c.action do |_global_options, options, _args|
|
134
|
+
puts JSON.dump($client.conversations_rename(options))
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
g.desc 'Retrieve a thread of messages posted to a conversation'
|
139
|
+
g.long_desc %( Retrieve a thread of messages posted to a conversation )
|
140
|
+
g.command 'replies' do |c|
|
141
|
+
c.flag 'channel', desc: 'Conversation ID to fetch thread from.'
|
142
|
+
c.flag 'ts', desc: "Unique identifier of a thread's parent message."
|
143
|
+
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."
|
144
|
+
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."
|
145
|
+
c.action do |_global_options, options, _args|
|
146
|
+
puts JSON.dump($client.conversations_replies(options))
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
g.desc 'Sets the purpose for a conversation.'
|
151
|
+
g.long_desc %( Sets the purpose for a conversation. )
|
152
|
+
g.command 'setPurpose' do |c|
|
153
|
+
c.flag 'channel', desc: 'Conversation to set the purpose of.'
|
154
|
+
c.flag 'purpose', desc: 'A new, specialer purpose.'
|
155
|
+
c.action do |_global_options, options, _args|
|
156
|
+
puts JSON.dump($client.conversations_setPurpose(options))
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
g.desc 'Sets the topic for a conversation.'
|
161
|
+
g.long_desc %( Sets the topic for a conversation. )
|
162
|
+
g.command 'setTopic' do |c|
|
163
|
+
c.flag 'channel', desc: 'Conversation to set the topic of.'
|
164
|
+
c.flag 'topic', desc: 'The new topic string. Does not support formatting or linkification.'
|
165
|
+
c.action do |_global_options, options, _args|
|
166
|
+
puts JSON.dump($client.conversations_setTopic(options))
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
g.desc 'Reverses conversation archival.'
|
171
|
+
g.long_desc %( Reverses conversation archival. )
|
172
|
+
g.command 'unarchive' do |c|
|
173
|
+
c.flag 'channel', desc: 'ID of conversation to unarchive.'
|
174
|
+
c.action do |_global_options, options, _args|
|
175
|
+
puts JSON.dump($client.conversations_unarchive(options))
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
data/bin/commands/groups.rb
CHANGED
@@ -11,15 +11,6 @@ command 'groups' do |g|
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
g.desc 'Closes a private channel.'
|
15
|
-
g.long_desc %( Closes a private channel. )
|
16
|
-
g.command 'close' do |c|
|
17
|
-
c.flag 'channel', desc: 'Private channel to close.'
|
18
|
-
c.action do |_global_options, options, _args|
|
19
|
-
puts JSON.dump($client.groups_close(options))
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
14
|
g.desc 'Creates a private channel.'
|
24
15
|
g.long_desc %( Creates a private channel. )
|
25
16
|
g.command 'create' do |c|
|
@@ -56,6 +47,7 @@ command 'groups' do |g|
|
|
56
47
|
g.long_desc %( Gets information about a private channel. )
|
57
48
|
g.command 'info' do |c|
|
58
49
|
c.flag 'channel', desc: 'Private channel to get info on.'
|
50
|
+
c.flag 'include_locale', desc: 'Set this to true to receive the locale for this group. Defaults to false.'
|
59
51
|
c.action do |_global_options, options, _args|
|
60
52
|
puts JSON.dump($client.groups_info(options))
|
61
53
|
end
|
data/bin/commands/im.rb
CHANGED
@@ -27,6 +27,8 @@ command 'im' do |g|
|
|
27
27
|
g.desc 'Lists direct message channels for the calling user.'
|
28
28
|
g.long_desc %( Lists direct message channels for the calling user. )
|
29
29
|
g.command 'list' do |c|
|
30
|
+
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."
|
31
|
+
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."
|
30
32
|
c.action do |_global_options, options, _args|
|
31
33
|
puts JSON.dump($client.im_list(options))
|
32
34
|
end
|
@@ -46,6 +48,7 @@ command 'im' do |g|
|
|
46
48
|
g.long_desc %( Opens a direct message channel. )
|
47
49
|
g.command 'open' do |c|
|
48
50
|
c.flag 'user', desc: 'User to open a direct message channel with.'
|
51
|
+
c.flag 'include_locale', desc: 'Set this to true to receive the locale for this im. Defaults to false.'
|
49
52
|
c.flag 'return_im', desc: 'Boolean, indicates you want the full IM channel definition in the response.'
|
50
53
|
c.action do |_global_options, options, _args|
|
51
54
|
puts JSON.dump($client.im_open(options))
|
data/bin/commands/rtm.rb
CHANGED
@@ -16,6 +16,7 @@ command 'rtm' do |g|
|
|
16
16
|
g.long_desc %( Starts a Real Time Messaging session. )
|
17
17
|
g.command 'start' do |c|
|
18
18
|
c.flag 'batch_presence_aware', desc: 'Group presence change notices as presence_change_batch events when possible. See batching.'
|
19
|
+
c.flag 'include_locale', desc: 'Set this to true to receive the locale for users and channels. Defaults to false.'
|
19
20
|
c.flag 'mpim_aware', desc: 'Returns MPIMs to the client in the API response.'
|
20
21
|
c.flag 'no_latest', desc: 'Exclude latest timestamps for channels, groups, mpims, and ims. Automatically sets no_unreads to 1.'
|
21
22
|
c.flag 'no_unreads', desc: 'Skip unread counts for each channel (improves performance).'
|
data/bin/commands/users.rb
CHANGED
@@ -31,6 +31,7 @@ command 'users' do |g|
|
|
31
31
|
g.long_desc %( Gets information about a user. )
|
32
32
|
g.command 'info' do |c|
|
33
33
|
c.flag 'user', desc: 'User to get info on.'
|
34
|
+
c.flag 'include_locale', desc: 'Set this to true to receive the locale for this user. Defaults to false.'
|
34
35
|
c.action do |_global_options, options, _args|
|
35
36
|
puts JSON.dump($client.users_info(options))
|
36
37
|
end
|
@@ -39,7 +40,8 @@ command 'users' do |g|
|
|
39
40
|
g.desc 'Lists all users in a Slack team.'
|
40
41
|
g.long_desc %( Lists all users in a Slack team. )
|
41
42
|
g.command 'list' do |c|
|
42
|
-
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
|
43
|
+
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."
|
44
|
+
c.flag 'include_locale', desc: 'Set this to true to receive the locale for users. Defaults to false.'
|
43
45
|
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."
|
44
46
|
c.flag 'presence', desc: 'Whether to include presence data in the output. Setting this to false improves performance, especially with large teams.'
|
45
47
|
c.action do |_global_options, options, _args|
|