slack-ruby-client 0.17.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +65 -31
- data/.travis.yml +1 -0
- data/CHANGELOG.md +10 -0
- data/CONTRIBUTING.md +3 -3
- data/README.md +5 -5
- data/RELEASING.md +1 -1
- data/UPGRADING.md +42 -0
- data/bin/commands/admin_apps.rb +11 -0
- data/bin/commands/admin_apps_requests.rb +1 -0
- data/bin/commands/admin_auth_policy.rb +39 -0
- data/bin/commands/admin_conversations.rb +10 -0
- data/bin/commands/admin_conversations_restrictAccess.rb +1 -1
- data/bin/commands/admin_users.rb +1 -0
- data/bin/commands/admin_users_session.rb +40 -0
- data/bin/commands/apps_manifest.rb +51 -0
- data/bin/commands/chat.rb +9 -6
- data/bin/commands/conversations.rb +59 -2
- data/bin/commands/dnd.rb +1 -1
- data/bin/commands/files.rb +2 -1
- data/bin/commands/oauth.rb +0 -13
- data/bin/commands/oauth_v2.rb +13 -1
- data/bin/commands/openid_connect.rb +27 -0
- data/bin/commands/pins.rb +2 -2
- data/bin/commands/reminders.rb +6 -0
- data/bin/commands/rtm.rb +2 -2
- data/bin/commands/search.rb +2 -1
- data/bin/commands/stars.rb +7 -6
- data/bin/commands/team_billing.rb +13 -0
- data/bin/commands/team_preferences.rb +13 -0
- data/bin/commands/tooling_tokens.rb +14 -0
- data/bin/commands/usergroups.rb +1 -1
- data/bin/commands/users.rb +1 -1
- data/bin/commands/views.rb +1 -1
- data/bin/commands.rb +6 -8
- data/lib/slack/config.rb +1 -2
- data/lib/slack/events/request.rb +3 -1
- data/lib/slack/real_time/client.rb +4 -5
- data/lib/slack/real_time/concurrency/async.rb +6 -8
- data/lib/slack/real_time/socket.rb +1 -2
- data/lib/slack/real_time/stores/base.rb +1 -6
- data/lib/slack/real_time/stores/starter.rb +6 -3
- data/lib/slack/real_time/stores/store.rb +5 -0
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics.rb +3 -3
- data/lib/slack/web/api/endpoints/admin_apps.rb +21 -5
- data/lib/slack/web/api/endpoints/admin_apps_approved.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps_requests.rb +4 -2
- data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_auth_policy.rb +72 -0
- data/lib/slack/web/api/endpoints/admin_barriers.rb +6 -6
- data/lib/slack/web/api/endpoints/admin_conversations.rb +38 -24
- data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +4 -4
- data/lib/slack/web/api/endpoints/admin_emoji.rb +9 -9
- data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +3 -3
- data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams.rb +6 -6
- data/lib/slack/web/api/endpoints/admin_teams_admins.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams_owners.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams_settings.rb +5 -5
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +10 -10
- data/lib/slack/web/api/endpoints/admin_users.rb +20 -18
- data/lib/slack/web/api/endpoints/admin_users_session.rb +65 -9
- data/lib/slack/web/api/endpoints/api.rb +1 -1
- data/lib/slack/web/api/endpoints/apps.rb +2 -2
- data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +3 -3
- data/lib/slack/web/api/endpoints/apps_manifest.rb +75 -0
- data/lib/slack/web/api/endpoints/auth.rb +1 -1
- data/lib/slack/web/api/endpoints/auth_teams.rb +3 -3
- data/lib/slack/web/api/endpoints/bots.rb +2 -2
- data/lib/slack/web/api/endpoints/calls.rb +15 -15
- data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
- data/lib/slack/web/api/endpoints/chat.rb +60 -54
- data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +3 -3
- data/lib/slack/web/api/endpoints/conversations.rb +115 -25
- data/lib/slack/web/api/endpoints/dialog.rb +2 -2
- data/lib/slack/web/api/endpoints/dnd.rb +4 -5
- data/lib/slack/web/api/endpoints/files.rb +16 -14
- data/lib/slack/web/api/endpoints/files_comments.rb +1 -1
- data/lib/slack/web/api/endpoints/files_remote.rb +20 -20
- data/lib/slack/web/api/endpoints/migration.rb +3 -3
- data/lib/slack/web/api/endpoints/oauth.rb +5 -27
- data/lib/slack/web/api/endpoints/oauth_v2.rb +24 -6
- data/lib/slack/web/api/endpoints/openid_connect.rb +42 -0
- data/lib/slack/web/api/endpoints/pins.rb +4 -4
- data/lib/slack/web/api/endpoints/reactions.rb +12 -12
- data/lib/slack/web/api/endpoints/reminders.rb +17 -5
- data/lib/slack/web/api/endpoints/rtm.rb +10 -10
- data/lib/slack/web/api/endpoints/search.rb +24 -16
- data/lib/slack/web/api/endpoints/stars.rb +11 -9
- data/lib/slack/web/api/endpoints/team.rb +8 -8
- data/lib/slack/web/api/endpoints/team_billing.rb +21 -0
- data/lib/slack/web/api/endpoints/team_preferences.rb +21 -0
- data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
- data/lib/slack/web/api/endpoints/tooling_tokens.rb +24 -0
- data/lib/slack/web/api/endpoints/usergroups.rb +19 -19
- data/lib/slack/web/api/endpoints/usergroups_users.rb +7 -7
- data/lib/slack/web/api/endpoints/users.rb +16 -16
- data/lib/slack/web/api/endpoints/users_profile.rb +4 -4
- data/lib/slack/web/api/endpoints/views.rb +12 -12
- data/lib/slack/web/api/endpoints/workflows.rb +9 -9
- data/lib/slack/web/api/endpoints.rb +12 -18
- data/lib/slack/web/api/errors/server_error.rb +37 -0
- data/lib/slack/web/api/errors/too_many_requests_error.rb +1 -4
- data/lib/slack/web/api/errors.rb +200 -8
- data/lib/slack/web/api/mixins.rb +0 -2
- data/lib/slack/web/api/patches/chat.1.patch +1 -2
- data/lib/slack/web/api/templates/endpoints.erb +0 -2
- data/lib/slack/web/faraday/request.rb +2 -1
- data/lib/slack/web/faraday/response/raise_error.rb +1 -1
- data/lib/slack/web/faraday/response/wrap_error.rb +2 -2
- data/lib/slack/web/pagination/cursor.rb +1 -5
- data/lib/slack-ruby-client.rb +1 -1
- data/slack-ruby-client.gemspec +2 -3
- data/spec/fixtures/slack/web/429_error.yml +50 -54
- data/spec/fixtures/slack/web/auth_test_error.yml +51 -18
- data/spec/fixtures/slack/web/auth_test_success.yml +50 -26
- data/spec/fixtures/slack/web/conversations_info.yml +133 -9
- data/spec/fixtures/slack/web/conversations_setTopic.yml +42 -27
- data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +89 -59
- data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +131 -86
- data/spec/fixtures/slack/web/paginated_users_list.yml +501 -69
- data/spec/fixtures/slack/web/rtm_connect.yml +267 -30
- data/spec/fixtures/slack/web/rtm_start.yml +771 -60
- data/spec/fixtures/slack/web/users_info.yml +153 -69
- data/spec/fixtures/slack/web/users_list.yml +102 -41
- data/spec/fixtures/slack/web/views_open_error.yml +49 -42
- data/spec/slack/real_time/client_spec.rb +17 -21
- data/spec/slack/real_time/event_handlers/bot_spec.rb +1 -1
- data/spec/slack/real_time/event_handlers/channel_spec.rb +1 -1
- data/spec/slack/real_time/event_handlers/im_spec.rb +5 -5
- data/spec/slack/real_time/event_handlers/user_spec.rb +2 -2
- data/spec/slack/slack_spec.rb +3 -1
- data/spec/slack/web/api/endpoints/admin_apps_spec.rb +5 -0
- data/spec/slack/web/api/endpoints/admin_auth_policy_spec.rb +35 -0
- data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +14 -9
- data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +1 -1
- data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +6 -6
- data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +22 -2
- data/spec/slack/web/api/endpoints/admin_users_spec.rb +8 -8
- data/spec/slack/web/api/endpoints/apps_manifest_spec.rb +36 -0
- data/spec/slack/web/api/endpoints/apps_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/calls_participants_spec.rb +4 -4
- data/spec/slack/web/api/endpoints/calls_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +4 -6
- data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +1 -1
- data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/dnd_spec.rb +0 -5
- data/spec/slack/web/api/endpoints/files_comments_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/files_remote_spec.rb +3 -3
- data/spec/slack/web/api/endpoints/oauth_spec.rb +0 -11
- data/spec/slack/web/api/endpoints/oauth_v2_spec.rb +6 -3
- data/spec/slack/web/api/endpoints/{im_spec.rb → openid_connect_spec.rb} +1 -1
- data/spec/slack/web/api/endpoints/reactions_spec.rb +3 -3
- data/spec/slack/web/api/endpoints/reminders_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/{mpim_spec.rb → team_billing_spec.rb} +1 -1
- data/spec/slack/web/api/endpoints/{apps_permissions_scopes_spec.rb → team_preferences_spec.rb} +1 -1
- data/spec/slack/web/api/endpoints/tooling_tokens_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +2 -2
- data/spec/slack/web/api/error_spec.rb +5 -7
- data/spec/slack/web/api/errors/slack_error_spec.rb +21 -26
- data/spec/slack/web/api/mixins/conversations_list_spec.rb +1 -1
- data/spec/slack/web/api/pagination/cursor_spec.rb +1 -3
- data/spec/slack/web/client_spec.rb +7 -6
- data/spec/slack/web/faraday/request_spec.rb +80 -0
- data/spec/slack/web/faraday/response/raise_error_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/support/real_time/connected_client.rb +1 -7
- data/spec/support/vcr.rb +33 -2
- metadata +28 -144
- data/lib/slack/web/api/errors/internal_error.rb +0 -14
- data/lib/slack/web/api/mixins/channels.id.json +0 -20
- data/lib/slack/web/api/mixins/channels.id.rb +0 -25
- data/lib/slack/web/api/mixins/groups.id.json +0 -20
- data/lib/slack/web/api/mixins/groups.id.rb +0 -25
- data/spec/fixtures/slack/web/503_error.yml +0 -14
- data/spec/fixtures/slack/web/channels_info.yml +0 -139
- data/spec/slack/web/api/endpoints/apps_permissions_resources_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +0 -19
- data/spec/slack/web/api/endpoints/conversations_spec.rb +0 -109
- data/spec/slack/web/api/mixins/channels_spec.rb +0 -43
- data/spec/slack/web/api/mixins/groups_spec.rb +0 -43
@@ -1,8 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This file was auto-generated by lib/tasks/web.rake
|
3
3
|
|
4
|
-
desc
|
4
|
+
desc 'Conversations methods.'
|
5
5
|
command 'conversations' do |g|
|
6
|
+
g.desc 'Accepts an invitation to a Slack Connect channel.'
|
7
|
+
g.long_desc %( Accepts an invitation to a Slack Connect channel. )
|
8
|
+
g.command 'acceptSharedInvite' do |c|
|
9
|
+
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.'
|
10
|
+
c.flag 'channel_id', desc: "ID of the channel that you'd like to accept. Must provide either invite_id or channel_id."
|
11
|
+
c.flag 'free_trial_accepted', desc: "Whether you'd like to use your workspace's free trial to begin using Slack Connect."
|
12
|
+
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.'
|
13
|
+
c.flag 'is_private', desc: 'Whether the channel should be private.'
|
14
|
+
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.'
|
15
|
+
c.action do |_global_options, options, _args|
|
16
|
+
puts JSON.dump($client.conversations_acceptSharedInvite(options))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
g.desc 'Approves an invitation to a Slack Connect channel'
|
21
|
+
g.long_desc %( Approves an invitation to a Slack Connect channel )
|
22
|
+
g.command 'approveSharedInvite' do |c|
|
23
|
+
c.flag 'invite_id', desc: 'ID of the shared channel invite to approve.'
|
24
|
+
c.flag 'target_team', desc: 'The team or enterprise id of the other party involved in the invitation you are approving.'
|
25
|
+
c.action do |_global_options, options, _args|
|
26
|
+
puts JSON.dump($client.conversations_approveSharedInvite(options))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
6
30
|
g.desc 'Archives a conversation.'
|
7
31
|
g.long_desc %( Archives a conversation. )
|
8
32
|
g.command 'archive' do |c|
|
@@ -32,13 +56,23 @@ command 'conversations' do |g|
|
|
32
56
|
end
|
33
57
|
end
|
34
58
|
|
59
|
+
g.desc 'Declines a Slack Connect channel invite.'
|
60
|
+
g.long_desc %( Declines a Slack Connect channel invite. )
|
61
|
+
g.command 'declineSharedInvite' do |c|
|
62
|
+
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.'
|
63
|
+
c.flag 'target_team', desc: 'The team or enterprise id of the other party involved in the invitation you are declining.'
|
64
|
+
c.action do |_global_options, options, _args|
|
65
|
+
puts JSON.dump($client.conversations_declineSharedInvite(options))
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
35
69
|
g.desc "Fetches a conversation's history of messages and events."
|
36
70
|
g.long_desc %( Fetches a conversation's history of messages and events. )
|
37
71
|
g.command 'history' do |c|
|
38
72
|
c.flag 'channel', desc: 'Conversation ID to fetch history for.'
|
39
73
|
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."
|
40
74
|
c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results only when either timestamp is specified.'
|
41
|
-
c.flag 'latest', desc: 'End of time range of messages to include in results.'
|
75
|
+
c.flag 'latest', desc: 'End of time range of messages to include in results. Default is the current time.'
|
42
76
|
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."
|
43
77
|
c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
|
44
78
|
c.action do |_global_options, options, _args|
|
@@ -67,6 +101,18 @@ command 'conversations' do |g|
|
|
67
101
|
end
|
68
102
|
end
|
69
103
|
|
104
|
+
g.desc 'Sends an invitation to a Slack Connect channel'
|
105
|
+
g.long_desc %( Sends an invitation to a Slack Connect channel )
|
106
|
+
g.command 'inviteShared' do |c|
|
107
|
+
c.flag 'channel', desc: "ID of the channel on your team that you'd like to share."
|
108
|
+
c.flag 'emails', desc: 'Optional email to receive this invite. Either emails or user_ids must be provided.'
|
109
|
+
c.flag 'external_limited', desc: 'Optional boolean on whether invite is to a external limited member. Defaults to true.'
|
110
|
+
c.flag 'user_ids', desc: 'Optional user_id to receive this invite. Either emails or user_ids must be provided.'
|
111
|
+
c.action do |_global_options, options, _args|
|
112
|
+
puts JSON.dump($client.conversations_inviteShared(options))
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
70
116
|
g.desc 'Joins an existing conversation.'
|
71
117
|
g.long_desc %( Joins an existing conversation. )
|
72
118
|
g.command 'join' do |c|
|
@@ -108,6 +154,16 @@ command 'conversations' do |g|
|
|
108
154
|
end
|
109
155
|
end
|
110
156
|
|
157
|
+
g.desc 'Lists shared channel invites that have been generated or received but have not been approved by all parties'
|
158
|
+
g.long_desc %( Lists shared channel invites that have been generated or received but have not been approved by all parties )
|
159
|
+
g.command 'listConnectInvites' do |c|
|
160
|
+
c.flag 'cursor', desc: 'Set to next_cursor returned by previous call to list items in subsequent page.'
|
161
|
+
c.flag 'team_id', desc: 'Encoded team id for the workspace to retrieve invites for, required if org token is used.'
|
162
|
+
c.action do |_global_options, options, _args|
|
163
|
+
puts JSON.dump($client.conversations_listConnectInvites(options))
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
111
167
|
g.desc 'Sets the read cursor in a channel.'
|
112
168
|
g.long_desc %( Sets the read cursor in a channel. )
|
113
169
|
g.command 'mark' do |c|
|
@@ -133,6 +189,7 @@ command 'conversations' do |g|
|
|
133
189
|
g.long_desc %( Opens or resumes a direct message or multi-person direct message. )
|
134
190
|
g.command 'open' do |c|
|
135
191
|
c.flag 'channel', desc: "Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead."
|
192
|
+
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.'
|
136
193
|
c.flag 'return_im', desc: 'Boolean, indicates you want the full IM channel definition in the response.'
|
137
194
|
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.'
|
138
195
|
c.action do |_global_options, options, _args|
|
data/bin/commands/dnd.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This file was auto-generated by lib/tasks/web.rake
|
3
3
|
|
4
|
-
desc '
|
4
|
+
desc 'Dnd methods.'
|
5
5
|
command 'dnd' do |g|
|
6
6
|
g.desc "Ends the current user's Do Not Disturb session immediately."
|
7
7
|
g.long_desc %( Ends the current user's Do Not Disturb session immediately. )
|
data/bin/commands/files.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This file was auto-generated by lib/tasks/web.rake
|
3
3
|
|
4
|
-
desc '
|
4
|
+
desc 'Files methods.'
|
5
5
|
command 'files' do |g|
|
6
6
|
g.desc 'Deletes a file.'
|
7
7
|
g.long_desc %( Deletes a file. )
|
@@ -38,6 +38,7 @@ command 'files' do |g|
|
|
38
38
|
g.long_desc %( List for a team, in a channel, or from a user with applied filters. )
|
39
39
|
g.command 'list' do |c|
|
40
40
|
c.flag 'channel', desc: 'Filter files appearing in a specific channel, indicated by its ID.'
|
41
|
+
c.flag 'files', desc: '.'
|
41
42
|
c.flag 'show_files_hidden_by_limit', desc: 'Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit.'
|
42
43
|
c.flag 'team_id', desc: 'encoded team id to list files in, required if org token is used.'
|
43
44
|
c.flag 'ts_from', desc: 'Filter files created after this timestamp (inclusive).'
|
data/bin/commands/oauth.rb
CHANGED
@@ -15,17 +15,4 @@ command 'oauth' do |g|
|
|
15
15
|
puts JSON.dump($client.oauth_access(options))
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
19
|
-
g.desc 'Exchanges a temporary OAuth verifier code for a workspace token.'
|
20
|
-
g.long_desc %( Exchanges a temporary OAuth verifier code for a workspace token. )
|
21
|
-
g.command 'token' do |c|
|
22
|
-
c.flag 'client_id', desc: 'Issued when you created your application.'
|
23
|
-
c.flag 'client_secret', desc: 'Issued when you created your application.'
|
24
|
-
c.flag 'code', desc: 'The code param returned via the OAuth callback.'
|
25
|
-
c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).'
|
26
|
-
c.flag 'single_channel', desc: 'Request the user to add your app only to a single channel.'
|
27
|
-
c.action do |_global_options, options, _args|
|
28
|
-
puts JSON.dump($client.oauth_token(options))
|
29
|
-
end
|
30
|
-
end
|
31
18
|
end
|
data/bin/commands/oauth_v2.rb
CHANGED
@@ -6,12 +6,24 @@ command 'oauth_v2' do |g|
|
|
6
6
|
g.desc 'Exchanges a temporary OAuth verifier code for an access token.'
|
7
7
|
g.long_desc %( Exchanges a temporary OAuth verifier code for an access token. )
|
8
8
|
g.command 'access' do |c|
|
9
|
-
c.flag 'code', desc: 'The code param returned via the OAuth callback.'
|
10
9
|
c.flag 'client_id', desc: 'Issued when you created your application.'
|
11
10
|
c.flag 'client_secret', desc: 'Issued when you created your application.'
|
11
|
+
c.flag 'code', desc: 'The code param returned via the OAuth callback.'
|
12
|
+
c.flag 'grant_type', desc: 'The grant_type param as described in the OAuth spec.'
|
12
13
|
c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).'
|
14
|
+
c.flag 'refresh_token', desc: 'The refresh_token param as described in the OAuth spec.'
|
13
15
|
c.action do |_global_options, options, _args|
|
14
16
|
puts JSON.dump($client.oauth_v2_access(options))
|
15
17
|
end
|
16
18
|
end
|
19
|
+
|
20
|
+
g.desc 'Exchanges a legacy access token for a new expiring access token and refresh token'
|
21
|
+
g.long_desc %( Exchanges a legacy access token for a new expiring access token and refresh token )
|
22
|
+
g.command 'exchange' do |c|
|
23
|
+
c.flag 'client_id', desc: 'Issued when you created your application.'
|
24
|
+
c.flag 'client_secret', desc: 'Issued when you created your application.'
|
25
|
+
c.action do |_global_options, options, _args|
|
26
|
+
puts JSON.dump($client.oauth_v2_exchange(options))
|
27
|
+
end
|
28
|
+
end
|
17
29
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This file was auto-generated by lib/tasks/web.rake
|
3
|
+
|
4
|
+
desc 'OpenidConnect methods.'
|
5
|
+
command 'openid_connect' do |g|
|
6
|
+
g.desc 'Exchanges a temporary OAuth verifier code for an access token for Sign in with Slack.'
|
7
|
+
g.long_desc %( Exchanges a temporary OAuth verifier code for an access token for Sign in with Slack. )
|
8
|
+
g.command 'token' do |c|
|
9
|
+
c.flag 'client_id', desc: 'Issued when you created your application.'
|
10
|
+
c.flag 'client_secret', desc: 'Issued when you created your application.'
|
11
|
+
c.flag 'code', desc: 'The code param returned via the OAuth callback.'
|
12
|
+
c.flag 'grant_type', desc: 'The grant_type param as described in the OAuth spec.'
|
13
|
+
c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).'
|
14
|
+
c.flag 'refresh_token', desc: 'The refresh_token param as described in the OAuth spec.'
|
15
|
+
c.action do |_global_options, options, _args|
|
16
|
+
puts JSON.dump($client.openid_connect_token(options))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
g.desc 'Get the identity of a user who has authorized Sign in with Slack.'
|
21
|
+
g.long_desc %( Get the identity of a user who has authorized Sign in with Slack. )
|
22
|
+
g.command 'userInfo' do |c|
|
23
|
+
c.action do |_global_options, options, _args|
|
24
|
+
puts JSON.dump($client.openid_connect_userInfo(options))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/bin/commands/pins.rb
CHANGED
@@ -6,8 +6,8 @@ command 'pins' do |g|
|
|
6
6
|
g.desc 'Pins an item to a channel.'
|
7
7
|
g.long_desc %( Pins an item to a channel. )
|
8
8
|
g.command 'add' do |c|
|
9
|
-
c.flag 'channel', desc: 'Channel to pin the
|
10
|
-
c.flag 'timestamp', desc: 'Timestamp of the message to pin.'
|
9
|
+
c.flag 'channel', desc: 'Channel to pin the messsage to. You must also include a timestamp when pinning messages.'
|
10
|
+
c.flag 'timestamp', desc: 'Timestamp of the message to pin. You must also include the channel.'
|
11
11
|
c.action do |_global_options, options, _args|
|
12
12
|
puts JSON.dump($client.pins_add(options))
|
13
13
|
end
|
data/bin/commands/reminders.rb
CHANGED
@@ -8,6 +8,8 @@ command 'reminders' do |g|
|
|
8
8
|
g.command 'add' do |c|
|
9
9
|
c.flag 'text', desc: 'The content of the reminder.'
|
10
10
|
c.flag 'time', desc: 'When this reminder should happen: the Unix timestamp (up to five years from now), the number of seconds until the reminder (if within 24 hours), or a natural language description (Ex. "in 15 minutes," or "every Thursday").'
|
11
|
+
c.flag 'recurrence', desc: 'Specify the repeating behavior of a reminder. Available options: daily, weekly, monthly, or yearly. If weekly, may further specify the days of the week.'
|
12
|
+
c.flag 'team_id', desc: 'Encoded team id, required if org token is used.'
|
11
13
|
c.flag 'user', desc: 'The user who will receive the reminder. If no user is specified, the reminder will go to user who created it.'
|
12
14
|
c.action do |_global_options, options, _args|
|
13
15
|
puts JSON.dump($client.reminders_add(options))
|
@@ -18,6 +20,7 @@ command 'reminders' do |g|
|
|
18
20
|
g.long_desc %( Marks a reminder as complete. )
|
19
21
|
g.command 'complete' do |c|
|
20
22
|
c.flag 'reminder', desc: 'The ID of the reminder to be marked as complete.'
|
23
|
+
c.flag 'team_id', desc: 'Encoded team id, required if org token is used.'
|
21
24
|
c.action do |_global_options, options, _args|
|
22
25
|
puts JSON.dump($client.reminders_complete(options))
|
23
26
|
end
|
@@ -27,6 +30,7 @@ command 'reminders' do |g|
|
|
27
30
|
g.long_desc %( Deletes a reminder. )
|
28
31
|
g.command 'delete' do |c|
|
29
32
|
c.flag 'reminder', desc: 'The ID of the reminder.'
|
33
|
+
c.flag 'team_id', desc: 'Encoded team id, required if org token is used.'
|
30
34
|
c.action do |_global_options, options, _args|
|
31
35
|
puts JSON.dump($client.reminders_delete(options))
|
32
36
|
end
|
@@ -36,6 +40,7 @@ command 'reminders' do |g|
|
|
36
40
|
g.long_desc %( Gets information about a reminder. )
|
37
41
|
g.command 'info' do |c|
|
38
42
|
c.flag 'reminder', desc: 'The ID of the reminder.'
|
43
|
+
c.flag 'team_id', desc: 'Encoded team id, required if org token is passed.'
|
39
44
|
c.action do |_global_options, options, _args|
|
40
45
|
puts JSON.dump($client.reminders_info(options))
|
41
46
|
end
|
@@ -44,6 +49,7 @@ command 'reminders' do |g|
|
|
44
49
|
g.desc 'Lists all reminders created by or for a given user.'
|
45
50
|
g.long_desc %( Lists all reminders created by or for a given user. )
|
46
51
|
g.command 'list' do |c|
|
52
|
+
c.flag 'team_id', desc: 'Encoded team id, required if org token is passed.'
|
47
53
|
c.action do |_global_options, options, _args|
|
48
54
|
puts JSON.dump($client.reminders_list(options))
|
49
55
|
end
|
data/bin/commands/rtm.rb
CHANGED
@@ -13,8 +13,8 @@ command 'rtm' do |g|
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
g.desc 'Starts a Real Time Messaging session.'
|
17
|
-
g.long_desc %( Starts a Real Time Messaging session. )
|
16
|
+
g.desc 'Deprecated: Starts a Real Time Messaging session. Use rtm.connect instead.'
|
17
|
+
g.long_desc %( Deprecated: Starts a Real Time Messaging session. Use rtm.connect instead. )
|
18
18
|
g.command 'start' do |c|
|
19
19
|
c.flag 'batch_presence_aware', desc: 'Batch presence deliveries via subscription. Enabling changes the shape of presence_change events. See batch presence.'
|
20
20
|
c.flag 'include_locale', desc: 'Set this to true to receive the locale for users and channels. Defaults to false.'
|
data/bin/commands/search.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This file was auto-generated by lib/tasks/web.rake
|
3
3
|
|
4
|
-
desc
|
4
|
+
desc 'Search methods.'
|
5
5
|
command 'search' do |g|
|
6
6
|
g.desc 'Searches for messages and files matching a query.'
|
7
7
|
g.long_desc %( Searches for messages and files matching a query. )
|
@@ -33,6 +33,7 @@ command 'search' do |g|
|
|
33
33
|
g.long_desc %( Searches for messages matching a query. )
|
34
34
|
g.command 'messages' do |c|
|
35
35
|
c.flag 'query', desc: 'Search query.'
|
36
|
+
c.flag 'cursor', desc: "Use this when getting results with cursormark pagination. For first call send * for subsequent calls, send the value of next_cursor returned in the previous call's results."
|
36
37
|
c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
|
37
38
|
c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
|
38
39
|
c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
|
data/bin/commands/stars.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
|
4
4
|
desc 'Stars methods.'
|
5
5
|
command 'stars' do |g|
|
6
|
-
g.desc '
|
7
|
-
g.long_desc %(
|
6
|
+
g.desc 'Save an item for later. Formerly known as _adding a star_.'
|
7
|
+
g.long_desc %( Save an item for later. Formerly known as _adding a star_. )
|
8
8
|
g.command 'add' do |c|
|
9
9
|
c.flag 'channel', desc: 'Channel to add star to, or channel where the message to add star to was posted (used with timestamp).'
|
10
10
|
c.flag 'file', desc: 'File to add star to.'
|
@@ -15,18 +15,19 @@ command 'stars' do |g|
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
g.desc '
|
19
|
-
g.long_desc %(
|
18
|
+
g.desc "List a user's saved items, formerly known as _stars_."
|
19
|
+
g.long_desc %( List a user's saved items, formerly known as _stars_. )
|
20
20
|
g.command 'list' do |c|
|
21
21
|
c.flag 'cursor', desc: "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."
|
22
22
|
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."
|
23
|
+
c.flag 'team_id', desc: 'encoded team id to list stars in, required if org token is used.'
|
23
24
|
c.action do |_global_options, options, _args|
|
24
25
|
puts JSON.dump($client.stars_list(options))
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
|
-
g.desc 'Removes a star from an item.'
|
29
|
-
g.long_desc %( Removes a star from an item. )
|
29
|
+
g.desc 'Removes a saved item (star) from an item.'
|
30
|
+
g.long_desc %( Removes a saved item (star) from an item. )
|
30
31
|
g.command 'remove' do |c|
|
31
32
|
c.flag 'channel', desc: 'Channel to remove star from, or channel where the message to remove star from was posted (used with timestamp).'
|
32
33
|
c.flag 'file', desc: 'File to remove star from.'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This file was auto-generated by lib/tasks/web.rake
|
3
|
+
|
4
|
+
desc 'TeamBilling methods.'
|
5
|
+
command 'team_billing' do |g|
|
6
|
+
g.desc "Reads a workspace's billing plan information."
|
7
|
+
g.long_desc %( Reads a workspace's billing plan information. )
|
8
|
+
g.command 'info' do |c|
|
9
|
+
c.action do |_global_options, options, _args|
|
10
|
+
puts JSON.dump($client.team_billing_info(options))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This file was auto-generated by lib/tasks/web.rake
|
3
|
+
|
4
|
+
desc 'TeamPreferences methods.'
|
5
|
+
command 'team_preferences' do |g|
|
6
|
+
g.desc "Retrieve a list of a workspace's team preferences."
|
7
|
+
g.long_desc %( Retrieve a list of a workspace's team preferences. )
|
8
|
+
g.command 'list' do |c|
|
9
|
+
c.action do |_global_options, options, _args|
|
10
|
+
puts JSON.dump($client.team_preferences_list(options))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This file was auto-generated by lib/tasks/web.rake
|
3
|
+
|
4
|
+
desc 'ToolingTokens methods.'
|
5
|
+
command 'tooling_tokens' do |g|
|
6
|
+
g.desc 'Exchanges a refresh token for a new app configuration token.'
|
7
|
+
g.long_desc %( Exchanges a refresh token for a new app configuration token. )
|
8
|
+
g.command 'rotate' do |c|
|
9
|
+
c.flag 'refresh_token', desc: 'The xoxe refresh token that was issued along with the old app configuration token.'
|
10
|
+
c.action do |_global_options, options, _args|
|
11
|
+
puts JSON.dump($client.tooling_tokens_rotate(options))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/bin/commands/usergroups.rb
CHANGED
data/bin/commands/users.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This file was auto-generated by lib/tasks/web.rake
|
3
3
|
|
4
|
-
desc '
|
4
|
+
desc 'Users methods.'
|
5
5
|
command 'users' do |g|
|
6
6
|
g.desc 'List conversations the calling user may access.'
|
7
7
|
g.long_desc %( List conversations the calling user may access. )
|
data/bin/commands/views.rb
CHANGED
@@ -39,8 +39,8 @@ command 'views' do |g|
|
|
39
39
|
g.command 'update' do |c|
|
40
40
|
c.flag 'view', desc: 'A view object. This must be a JSON-encoded string.'
|
41
41
|
c.flag 'external_id', desc: 'A unique identifier of the view set by the developer. Must be unique for all views on a team. Max length of 255 characters. Either view_id or external_id is required.'
|
42
|
-
c.flag 'hash', desc: 'A string that represents view state to protect against possible race conditions.'
|
43
42
|
c.flag 'view_id', desc: 'A unique identifier of the view to be updated. Either view_id or external_id is required.'
|
43
|
+
c.flag 'hash', desc: 'A string that represents view state to protect against possible race conditions.'
|
44
44
|
c.action do |_global_options, options, _args|
|
45
45
|
puts JSON.dump($client.views_update(options))
|
46
46
|
end
|
data/bin/commands.rb
CHANGED
@@ -6,6 +6,7 @@ require 'commands/admin_apps'
|
|
6
6
|
require 'commands/admin_apps_approved'
|
7
7
|
require 'commands/admin_apps_requests'
|
8
8
|
require 'commands/admin_apps_restricted'
|
9
|
+
require 'commands/admin_auth_policy'
|
9
10
|
require 'commands/admin_barriers'
|
10
11
|
require 'commands/admin_conversations'
|
11
12
|
require 'commands/admin_conversations_ekm'
|
@@ -25,16 +26,12 @@ require 'commands/api'
|
|
25
26
|
require 'commands/apps'
|
26
27
|
require 'commands/apps_connections'
|
27
28
|
require 'commands/apps_event_authorizations'
|
28
|
-
require 'commands/
|
29
|
-
require 'commands/apps_permissions_resources'
|
30
|
-
require 'commands/apps_permissions_scopes'
|
31
|
-
require 'commands/apps_permissions_users'
|
29
|
+
require 'commands/apps_manifest'
|
32
30
|
require 'commands/auth'
|
33
31
|
require 'commands/auth_teams'
|
34
32
|
require 'commands/bots'
|
35
33
|
require 'commands/calls'
|
36
34
|
require 'commands/calls_participants'
|
37
|
-
require 'commands/channels'
|
38
35
|
require 'commands/chat'
|
39
36
|
require 'commands/chat_scheduledMessages'
|
40
37
|
require 'commands/conversations'
|
@@ -44,12 +41,10 @@ require 'commands/emoji'
|
|
44
41
|
require 'commands/files'
|
45
42
|
require 'commands/files_comments'
|
46
43
|
require 'commands/files_remote'
|
47
|
-
require 'commands/groups'
|
48
|
-
require 'commands/im'
|
49
44
|
require 'commands/migration'
|
50
|
-
require 'commands/mpim'
|
51
45
|
require 'commands/oauth'
|
52
46
|
require 'commands/oauth_v2'
|
47
|
+
require 'commands/openid_connect'
|
53
48
|
require 'commands/pins'
|
54
49
|
require 'commands/reactions'
|
55
50
|
require 'commands/reminders'
|
@@ -57,7 +52,10 @@ require 'commands/rtm'
|
|
57
52
|
require 'commands/search'
|
58
53
|
require 'commands/stars'
|
59
54
|
require 'commands/team'
|
55
|
+
require 'commands/team_billing'
|
56
|
+
require 'commands/team_preferences'
|
60
57
|
require 'commands/team_profile'
|
58
|
+
require 'commands/tooling_tokens'
|
61
59
|
require 'commands/usergroups'
|
62
60
|
require 'commands/usergroups_users'
|
63
61
|
require 'commands/users'
|
data/lib/slack/config.rb
CHANGED
data/lib/slack/events/request.rb
CHANGED
@@ -3,7 +3,9 @@ module Slack
|
|
3
3
|
module Events
|
4
4
|
class Request
|
5
5
|
class MissingSigningSecret < StandardError; end
|
6
|
+
|
6
7
|
class TimestampExpired < StandardError; end
|
8
|
+
|
7
9
|
class InvalidSignature < StandardError; end
|
8
10
|
|
9
11
|
attr_reader :http_request,
|
@@ -51,7 +53,7 @@ module Slack
|
|
51
53
|
def valid?
|
52
54
|
raise MissingSigningSecret unless signing_secret
|
53
55
|
|
54
|
-
digest = OpenSSL::Digest
|
56
|
+
digest = OpenSSL::Digest.new('SHA256')
|
55
57
|
signature_basestring = [version, timestamp, body].join(':')
|
56
58
|
hex_hash = OpenSSL::HMAC.hexdigest(digest, signing_secret, signature_basestring)
|
57
59
|
computed_signature = [version, hex_hash].join('=')
|
@@ -3,6 +3,7 @@ module Slack
|
|
3
3
|
module RealTime
|
4
4
|
class Client
|
5
5
|
class ClientNotStartedError < StandardError; end
|
6
|
+
|
6
7
|
class ClientAlreadyStartedError < StandardError; end
|
7
8
|
|
8
9
|
include Api::MessageId
|
@@ -16,10 +17,7 @@ module Slack
|
|
16
17
|
attr_accessor :events
|
17
18
|
end
|
18
19
|
|
19
|
-
attr_accessor :web_client
|
20
|
-
attr_accessor :store
|
21
|
-
attr_accessor :url
|
22
|
-
attr_accessor(*Config::ATTRIBUTES)
|
20
|
+
attr_accessor :web_client, :store, :url, *Config::ATTRIBUTES
|
23
21
|
|
24
22
|
protected :store_class, :store_class=
|
25
23
|
|
@@ -133,7 +131,7 @@ module Slack
|
|
133
131
|
rescue Slack::Web::Api::Errors::SlackError => e
|
134
132
|
# stop pinging if bot was uninstalled
|
135
133
|
case e.message
|
136
|
-
when 'account_inactive', 'invalid_auth'
|
134
|
+
when 'account_inactive', 'invalid_auth'
|
137
135
|
logger.warn(to_s) { e.message }
|
138
136
|
raise e
|
139
137
|
end
|
@@ -201,6 +199,7 @@ module Slack
|
|
201
199
|
end
|
202
200
|
|
203
201
|
attr_reader :callbacks
|
202
|
+
|
204
203
|
def socket_class
|
205
204
|
concurrency::Socket
|
206
205
|
end
|
@@ -45,14 +45,12 @@ module Slack
|
|
45
45
|
@client_task&.stop
|
46
46
|
|
47
47
|
@client_task = task.async do |subtask|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
client.logger.error(subtask.to_s) { e.message }
|
55
|
-
end
|
48
|
+
subtask.annotate "#{client} run-loop"
|
49
|
+
client.run_loop
|
50
|
+
rescue ::Async::Wrapper::Cancelled => e
|
51
|
+
# Will get restarted by ping worker.
|
52
|
+
rescue StandardError => e
|
53
|
+
client.logger.error(subtask.to_s) { e.message }
|
56
54
|
end
|
57
55
|
|
58
56
|
@restart.wait
|
@@ -8,12 +8,7 @@ module Slack
|
|
8
8
|
attr_accessor :events
|
9
9
|
end
|
10
10
|
|
11
|
-
attr_accessor :users
|
12
|
-
attr_accessor :bots
|
13
|
-
attr_accessor :channels
|
14
|
-
attr_accessor :groups
|
15
|
-
attr_accessor :teams
|
16
|
-
attr_accessor :ims
|
11
|
+
attr_accessor :users, :bots, :channels, :groups, :teams, :ims
|
17
12
|
|
18
13
|
def self
|
19
14
|
nil
|
@@ -4,9 +4,7 @@ module Slack
|
|
4
4
|
module Stores
|
5
5
|
# Only stores initial information.
|
6
6
|
class Starter < Base
|
7
|
-
attr_reader :self
|
8
|
-
|
9
|
-
attr_reader :team
|
7
|
+
attr_reader :self, :team
|
10
8
|
|
11
9
|
def initialize(attrs)
|
12
10
|
@team = Models::Team.new(attrs.team)
|
@@ -15,6 +13,11 @@ module Slack
|
|
15
13
|
|
16
14
|
### RealTime Events
|
17
15
|
|
16
|
+
# A shared channel invite was sent to a Slack user.
|
17
|
+
# @see https://api.slack.com/events/shared_channel_invite_received
|
18
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/shared_channel_invite_received.json
|
19
|
+
# on :shared_channel_invite_received do |data|
|
20
|
+
|
18
21
|
# An enterprise grid migration has started on an external workspace..
|
19
22
|
# @see https://api.slack.com/events/external_org_migration_started
|
20
23
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/external_org_migration_started.json
|
@@ -55,6 +55,11 @@ module Slack
|
|
55
55
|
|
56
56
|
### RealTime Events
|
57
57
|
|
58
|
+
# A shared channel invite was sent to a Slack user.
|
59
|
+
# @see https://api.slack.com/events/shared_channel_invite_received
|
60
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/shared_channel_invite_received.json
|
61
|
+
# on :shared_channel_invite_received do |data|
|
62
|
+
|
58
63
|
# An enterprise grid migration has started on an external workspace..
|
59
64
|
# @see https://api.slack.com/events/external_org_migration_started
|
60
65
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/external_org_migration_started.json
|
data/lib/slack/version.rb
CHANGED
@@ -9,11 +9,11 @@ module Slack
|
|
9
9
|
#
|
10
10
|
# Retrieve analytics data for a given date, presented as a compressed JSON file
|
11
11
|
#
|
12
|
-
# @option options [
|
12
|
+
# @option options [string] :type
|
13
13
|
# The type of analytics to retrieve. The options are currently limited to member (for grid member analytics) and public_channel (for public channel analytics).
|
14
|
-
# @option options [
|
14
|
+
# @option options [date] :date
|
15
15
|
# Date to retrieve the analytics data for, expressed as YYYY-MM-DD in UTC.
|
16
|
-
# @option options [
|
16
|
+
# @option options [boolean] :metadata_only
|
17
17
|
# Retrieve metadata for the type of analytics indicated. Can be used only with type set to public_channel analytics. See detail below. Omit the date parameter when using this argument.
|
18
18
|
# @see https://api.slack.com/methods/admin.analytics.getFile
|
19
19
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.analytics/admin.analytics.getFile.json
|