slack-ruby-client 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/update_api.yml +1 -1
- data/.rubocop_todo.yml +43 -13
- data/CHANGELOG.md +12 -0
- data/CONTRIBUTING.md +7 -7
- data/Gemfile +1 -0
- data/README.md +46 -28
- data/bin/commands/admin_conversations.rb +21 -0
- data/bin/commands/admin_users_session.rb +1 -1
- data/bin/commands/admin_workflows.rb +3 -1
- data/bin/commands/admin_workflows_triggers_types_permissions.rb +4 -4
- data/bin/commands/assistant_threads.rb +45 -0
- data/bin/commands/bookmarks.rb +1 -0
- data/bin/commands/canvases.rb +4 -4
- data/bin/commands/canvases_access.rb +3 -3
- data/bin/commands/chat.rb +7 -3
- data/bin/commands/conversations.rb +5 -5
- data/bin/commands/conversations_canvases.rb +2 -2
- data/bin/commands/conversations_requestSharedInvite.rb +48 -0
- data/bin/commands/files.rb +2 -1
- data/bin/commands/usergroups.rb +5 -0
- data/bin/commands/usergroups_users.rb +2 -0
- data/examples/files_upload_v2/.env.example +1 -0
- data/examples/files_upload_v2/Gemfile +5 -0
- data/examples/files_upload_v2/README.md +13 -0
- data/examples/files_upload_v2/files_upload_v2.rb +37 -0
- data/examples/oauth_v2/.env.example +4 -0
- data/examples/oauth_v2/Gemfile +7 -0
- data/examples/oauth_v2/README.md +33 -0
- data/examples/oauth_v2/oauth_v2.rb +60 -0
- data/lib/slack/messages/formatting.rb +1 -1
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_conversations.rb +35 -0
- data/lib/slack/web/api/endpoints/admin_users_session.rb +2 -3
- data/lib/slack/web/api/endpoints/admin_workflows.rb +5 -1
- data/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb +2 -2
- data/lib/slack/web/api/endpoints/assistant_threads.rb +68 -0
- data/lib/slack/web/api/endpoints/bookmarks.rb +2 -0
- data/lib/slack/web/api/endpoints/canvases.rb +2 -2
- data/lib/slack/web/api/endpoints/canvases_access.rb +4 -4
- data/lib/slack/web/api/endpoints/chat.rb +12 -3
- data/lib/slack/web/api/endpoints/conversations.rb +4 -4
- data/lib/slack/web/api/endpoints/conversations_canvases.rb +1 -1
- data/lib/slack/web/api/endpoints/conversations_requestSharedInvite.rb +73 -0
- data/lib/slack/web/api/endpoints/files.rb +3 -1
- data/lib/slack/web/api/endpoints/usergroups.rb +10 -0
- data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -0
- data/lib/slack/web/api/endpoints.rb +4 -0
- data/lib/slack/web/api/errors.rb +48 -4
- data/lib/slack/web/api/helpers/files.rb +87 -0
- data/lib/slack/web/api/helpers.rb +13 -0
- data/lib/slack/web/api/templates/method_spec.erb +4 -3
- data/lib/slack/web/client.rb +1 -0
- data/lib/slack/web/faraday/connection.rb +13 -26
- data/lib/slack/web/faraday/options.rb +24 -0
- data/lib/slack/web/faraday/request.rb +2 -1
- data/lib/slack-ruby-client.rb +2 -0
- data/slack-ruby-client.gemspec +2 -1
- metadata +32 -154
- data/screenshots/create-app.png +0 -0
- data/spec/fixtures/slack/web/429_error.yml +0 -81
- data/spec/fixtures/slack/web/auth_test_error.yml +0 -81
- data/spec/fixtures/slack/web/auth_test_success.yml +0 -81
- data/spec/fixtures/slack/web/conversations_info.yml +0 -167
- data/spec/fixtures/slack/web/conversations_setTopic.yml +0 -84
- data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +0 -172
- data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +0 -253
- data/spec/fixtures/slack/web/paginated_users_list.yml +0 -613
- data/spec/fixtures/slack/web/rtm_connect.yml +0 -391
- data/spec/fixtures/slack/web/users_info.yml +0 -214
- data/spec/fixtures/slack/web/users_list.yml +0 -133
- data/spec/fixtures/slack/web/views_open_error.yml +0 -83
- data/spec/integration/integration_spec.rb +0 -207
- data/spec/slack/config_spec.rb +0 -16
- data/spec/slack/events/config_spec.rb +0 -35
- data/spec/slack/events/request_spec.rb +0 -199
- data/spec/slack/messages/formatting_spec.rb +0 -156
- data/spec/slack/real_time/api/message_spec.rb +0 -20
- data/spec/slack/real_time/api/ping_spec.rb +0 -17
- data/spec/slack/real_time/api/typing_spec.rb +0 -19
- data/spec/slack/real_time/client_spec.rb +0 -601
- data/spec/slack/real_time/concurrency/clients/async_spec.rb +0 -16
- data/spec/slack/real_time/concurrency/it_behaves_like_a_realtime_socket.rb +0 -21
- data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +0 -10
- data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +0 -10
- data/spec/slack/real_time/event_handlers/bot_spec.rb +0 -47
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +0 -16
- data/spec/slack/real_time/event_handlers/im_spec.rb +0 -51
- data/spec/slack/real_time/event_handlers/private_channel_spec.rb +0 -99
- data/spec/slack/real_time/event_handlers/public_channel_spec.rb +0 -123
- data/spec/slack/real_time/event_handlers/team_spec.rb +0 -63
- data/spec/slack/real_time/event_handlers/user_spec.rb +0 -65
- data/spec/slack/real_time/rtm_connect_spec.rb +0 -14
- data/spec/slack/real_time/stores/store_spec.rb +0 -50
- data/spec/slack/slack_spec.rb +0 -93
- data/spec/slack/version_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_apps_activities_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_apps_config_spec.rb +0 -18
- data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_apps_spec.rb +0 -18
- data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_auth_policy_spec.rb +0 -35
- data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +0 -38
- data/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +0 -32
- data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +0 -133
- data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +0 -37
- data/spec/slack/web/api/endpoints/admin_functions_permissions_spec.rb +0 -21
- data/spec/slack/web/api/endpoints/admin_functions_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_inviteRequests_approved_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_inviteRequests_denied_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_inviteRequests_spec.rb +0 -18
- data/spec/slack/web/api/endpoints/admin_roles_spec.rb +0 -30
- data/spec/slack/web/api/endpoints/admin_teams_admins_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_teams_owners_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +0 -53
- data/spec/slack/web/api/endpoints/admin_teams_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +0 -37
- data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +0 -41
- data/spec/slack/web/api/endpoints/admin_users_spec.rb +0 -67
- data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_workflows_collaborators_spec.rb +0 -24
- data/spec/slack/web/api/endpoints/admin_workflows_permissions_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_workflows_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_workflows_triggers_types_permissions_spec.rb +0 -21
- data/spec/slack/web/api/endpoints/api_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/apps_activities_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/apps_auth_external_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/apps_connections_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/apps_datastore_spec.rb +0 -74
- data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/apps_manifest_spec.rb +0 -44
- data/spec/slack/web/api/endpoints/apps_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/auth_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/auth_teams_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/bookmarks_spec.rb +0 -40
- data/spec/slack/web/api/endpoints/bots_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/calls_participants_spec.rb +0 -24
- data/spec/slack/web/api/endpoints/calls_spec.rb +0 -31
- data/spec/slack/web/api/endpoints/canvases_access_spec.rb +0 -21
- data/spec/slack/web/api/endpoints/canvases_sections_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/canvases_spec.rb +0 -21
- data/spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/chat_spec.rb +0 -134
- data/spec/slack/web/api/endpoints/conversations_canvases_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/conversations_externalInvitePermissions_spec.rb +0 -19
- data/spec/slack/web/api/endpoints/conversations_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +0 -27
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +0 -206
- data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +0 -40
- data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +0 -38
- data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +0 -112
- data/spec/slack/web/api/endpoints/dialog_spec.rb +0 -14
- data/spec/slack/web/api/endpoints/dnd_spec.rb +0 -18
- data/spec/slack/web/api/endpoints/emoji_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/files_comments_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/files_remote_spec.rb +0 -24
- data/spec/slack/web/api/endpoints/files_spec.rb +0 -57
- data/spec/slack/web/api/endpoints/functions_distributions_permissions_spec.rb +0 -10
- data/spec/slack/web/api/endpoints/functions_spec.rb +0 -28
- data/spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/migration_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/oauth_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/oauth_v2_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/openid_connect_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/pins_spec.rb +0 -23
- data/spec/slack/web/api/endpoints/reactions_spec.rb +0 -24
- data/spec/slack/web/api/endpoints/reminders_spec.rb +0 -31
- data/spec/slack/web/api/endpoints/rtm_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/search_spec.rb +0 -23
- data/spec/slack/web/api/endpoints/stars_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/team_billing_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/team_externalTeams_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/team_preferences_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/team_profile_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/team_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/tooling_tokens_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/usergroups_spec.rb +0 -28
- data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +0 -21
- data/spec/slack/web/api/endpoints/users_admin_spec.rb +0 -18
- data/spec/slack/web/api/endpoints/users_discoverableContacts_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/users_prefs_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/users_profile_spec.rb +0 -14
- data/spec/slack/web/api/endpoints/users_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/views_spec.rb +0 -65
- data/spec/slack/web/api/endpoints/workflows_spec.rb +0 -34
- data/spec/slack/web/api/endpoints/workflows_triggers_permissions_spec.rb +0 -31
- data/spec/slack/web/api/error_spec.rb +0 -14
- data/spec/slack/web/api/errors/slack_error_spec.rb +0 -33
- data/spec/slack/web/api/mixins/conversations_list_spec.rb +0 -21
- data/spec/slack/web/api/mixins/conversations_spec.rb +0 -45
- data/spec/slack/web/api/mixins/users_spec.rb +0 -52
- data/spec/slack/web/api/options_spec.rb +0 -69
- data/spec/slack/web/api/pagination/cursor_spec.rb +0 -102
- data/spec/slack/web/client_spec.rb +0 -359
- data/spec/slack/web/faraday/request_spec.rb +0 -80
- data/spec/slack/web/faraday/response/raise_error_spec.rb +0 -86
- data/spec/spec_helper.rb +0 -30
- data/spec/support/queue_with_timeout.rb +0 -35
- data/spec/support/real_time/concurrency/mock.rb +0 -31
- data/spec/support/real_time/connected_client.rb +0 -21
- data/spec/support/real_time/event.rb +0 -12
- data/spec/support/real_time/loaded_client.rb +0 -120
- data/spec/support/token.rb +0 -11
- data/spec/support/vcr.rb +0 -45
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This file was auto-generated by lib/tasks/web.rake
|
3
|
+
|
4
|
+
module Slack
|
5
|
+
module Web
|
6
|
+
module Api
|
7
|
+
module Endpoints
|
8
|
+
module ConversationsRequestsharedinvite
|
9
|
+
#
|
10
|
+
# Approves a request to add an external user to a channel and sends them a Slack Connect invite
|
11
|
+
#
|
12
|
+
# @option options [Object] :invite_id
|
13
|
+
# ID of the requested shared channel invite to approve.
|
14
|
+
# @option options [string] :channel_id
|
15
|
+
# Optional channel_id to which external user will be invited to. Will override the value on the requested invite.
|
16
|
+
# @option options [boolean] :is_external_limited
|
17
|
+
# Optional boolean on whether the invited team will have post-only permissions in the channel. Will override the value on the requested invite.
|
18
|
+
# @option options [object] :message
|
19
|
+
# Object describing the text to send along with the invite. If this object is specified, both text and is_override are required properties. If is_override is set to true, text will override the original invitation message. Otherwise, text will be appended to the original invitation message. The total length of the message cannot exceed 560 characters. If is_override is set to false, the length of text and the user specified message on the invite request in total must be less than 560 characters.
|
20
|
+
# @see https://api.slack.com/methods/conversations.requestSharedInvite.approve
|
21
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations.requestSharedInvite/conversations.requestSharedInvite.approve.json
|
22
|
+
def conversations_requestSharedInvite_approve(options = {})
|
23
|
+
raise ArgumentError, 'Required arguments :invite_id missing' if options[:invite_id].nil?
|
24
|
+
post('conversations.requestSharedInvite.approve', options)
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# Denies a request to invite an external user to a channel
|
29
|
+
#
|
30
|
+
# @option options [Object] :invite_id
|
31
|
+
# ID of the requested shared channel invite to deny.
|
32
|
+
# @option options [string] :message
|
33
|
+
# Optional message explaining why the request to invite was denied.
|
34
|
+
# @see https://api.slack.com/methods/conversations.requestSharedInvite.deny
|
35
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations.requestSharedInvite/conversations.requestSharedInvite.deny.json
|
36
|
+
def conversations_requestSharedInvite_deny(options = {})
|
37
|
+
raise ArgumentError, 'Required arguments :invite_id missing' if options[:invite_id].nil?
|
38
|
+
post('conversations.requestSharedInvite.deny', options)
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# Lists requests to add external users to channels with ability to filter.
|
43
|
+
#
|
44
|
+
# @option options [string] :cursor
|
45
|
+
# Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. See pagination for more detail.
|
46
|
+
# @option options [boolean] :include_approved
|
47
|
+
# When true approved invitation requests will be returned, otherwise they will be excluded.
|
48
|
+
# @option options [boolean] :include_denied
|
49
|
+
# When true denied invitation requests will be returned, otherwise they will be excluded.
|
50
|
+
# @option options [boolean] :include_expired
|
51
|
+
# When true expired invitation requests will be returned, otherwise they will be excluded.
|
52
|
+
# @option options [array] :invite_ids
|
53
|
+
# An optional list of invitation ids to look up.
|
54
|
+
# @option options [integer] :limit
|
55
|
+
# The number of items to return. Must be between 1 - 1000 (inclusive).
|
56
|
+
# @option options [Object] :user_id
|
57
|
+
# Optional filter to return invitation requests for the inviting user.
|
58
|
+
# @see https://api.slack.com/methods/conversations.requestSharedInvite.list
|
59
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations.requestSharedInvite/conversations.requestSharedInvite.list.json
|
60
|
+
def conversations_requestSharedInvite_list(options = {})
|
61
|
+
if block_given?
|
62
|
+
Pagination::Cursor.new(self, :conversations_requestSharedInvite_list, options).each do |page|
|
63
|
+
yield page
|
64
|
+
end
|
65
|
+
else
|
66
|
+
post('conversations.requestSharedInvite.list', options)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -13,10 +13,12 @@ module Slack
|
|
13
13
|
# Array of file ids and their corresponding (optional) titles.
|
14
14
|
# @option options [Object] :channel_id
|
15
15
|
# Channel ID where the file will be shared. If not specified the file will be private.
|
16
|
+
# @option options [string] :channels
|
17
|
+
# Comma-separated string of channel IDs where the file will be shared.
|
16
18
|
# @option options [string] :initial_comment
|
17
19
|
# The message text introducing the file in specified channels.
|
18
20
|
# @option options [string] :thread_ts
|
19
|
-
# Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.
|
21
|
+
# Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead. Also make sure to provide only one channel when using 'thread_ts'.
|
20
22
|
# @see https://api.slack.com/methods/files.completeUploadExternal
|
21
23
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.completeUploadExternal.json
|
22
24
|
def files_completeUploadExternal(options = {})
|
@@ -11,10 +11,14 @@ module Slack
|
|
11
11
|
#
|
12
12
|
# @option options [string] :name
|
13
13
|
# A name for the User Group. Must be unique among User Groups.
|
14
|
+
# @option options [array] :additional_channels
|
15
|
+
# A comma separated string of encoded channel IDs for which the User Group can custom add usergroup members too.
|
14
16
|
# @option options [array] :channels
|
15
17
|
# A comma separated string of encoded channel IDs for which the User Group uses as a default.
|
16
18
|
# @option options [string] :description
|
17
19
|
# A short description of the User Group.
|
20
|
+
# @option options [boolean] :enable_section
|
21
|
+
# Configure this user group to show as a sidebar section for all group members. Note: Only relevant if group has 1 or more default channels added.
|
18
22
|
# @option options [string] :handle
|
19
23
|
# A mention handle. Must be unique among channels, users and User Groups.
|
20
24
|
# @option options [boolean] :include_count
|
@@ -71,6 +75,8 @@ module Slack
|
|
71
75
|
# Include the list of users for each User Group.
|
72
76
|
# @option options [string] :team_id
|
73
77
|
# encoded team id to list user groups in, required if org token is used.
|
78
|
+
# @option options [Object] :usergroup_id
|
79
|
+
# The id of the usergroup you would like to filter the results down to.
|
74
80
|
# @see https://api.slack.com/methods/usergroups.list
|
75
81
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups/usergroups.list.json
|
76
82
|
def usergroups_list(options = {})
|
@@ -82,10 +88,14 @@ module Slack
|
|
82
88
|
#
|
83
89
|
# @option options [Object] :usergroup
|
84
90
|
# The encoded ID of the User Group to update.
|
91
|
+
# @option options [array] :additional_channels
|
92
|
+
# A comma separated string of encoded channel IDs for which the User Group can custom add usergroup members too.
|
85
93
|
# @option options [array] :channels
|
86
94
|
# A comma separated string of encoded channel IDs for which the User Group uses as a default.
|
87
95
|
# @option options [string] :description
|
88
96
|
# A short description of the User Group.
|
97
|
+
# @option options [boolean] :enable_section
|
98
|
+
# Configure this user group to show as a sidebar section for all group members. Note: Only relevant if group has 1 or more default channels added.
|
89
99
|
# @option options [string] :handle
|
90
100
|
# A mention handle. Must be unique among channels, users and User Groups.
|
91
101
|
# @option options [boolean] :include_count
|
@@ -29,8 +29,12 @@ module Slack
|
|
29
29
|
# The encoded ID of the user group to update.
|
30
30
|
# @option options [array] :users
|
31
31
|
# A comma separated string of encoded user IDs that represent the entire list of users for the user group.
|
32
|
+
# @option options [array] :additional_channels
|
33
|
+
# A comma separated string of encoded channel IDs for which the User Group can custom add usergroup members too.
|
32
34
|
# @option options [boolean] :include_count
|
33
35
|
# Include the number of users in the user group.
|
36
|
+
# @option options [boolean] :is_shared
|
37
|
+
# Boolean to identify if the API is getting called when a shared section is getting shared.
|
34
38
|
# @option options [string] :team_id
|
35
39
|
# encoded team id where the user group exists, required if org token is used.
|
36
40
|
# @see https://api.slack.com/methods/usergroups.users.update
|
@@ -41,6 +41,7 @@ require_relative 'endpoints/apps_connections'
|
|
41
41
|
require_relative 'endpoints/apps_datastore'
|
42
42
|
require_relative 'endpoints/apps_event_authorizations'
|
43
43
|
require_relative 'endpoints/apps_manifest'
|
44
|
+
require_relative 'endpoints/assistant_threads'
|
44
45
|
require_relative 'endpoints/auth'
|
45
46
|
require_relative 'endpoints/auth_teams'
|
46
47
|
require_relative 'endpoints/bookmarks'
|
@@ -55,6 +56,7 @@ require_relative 'endpoints/chat_scheduledMessages'
|
|
55
56
|
require_relative 'endpoints/conversations'
|
56
57
|
require_relative 'endpoints/conversations_canvases'
|
57
58
|
require_relative 'endpoints/conversations_externalInvitePermissions'
|
59
|
+
require_relative 'endpoints/conversations_requestSharedInvite'
|
58
60
|
require_relative 'endpoints/dialog'
|
59
61
|
require_relative 'endpoints/dnd'
|
60
62
|
require_relative 'endpoints/emoji'
|
@@ -139,6 +141,7 @@ module Slack
|
|
139
141
|
include AppsDatastore
|
140
142
|
include AppsEventAuthorizations
|
141
143
|
include AppsManifest
|
144
|
+
include AssistantThreads
|
142
145
|
include Auth
|
143
146
|
include AuthTeams
|
144
147
|
include Bookmarks
|
@@ -153,6 +156,7 @@ module Slack
|
|
153
156
|
include Conversations
|
154
157
|
include ConversationsCanvases
|
155
158
|
include ConversationsExternalinvitepermissions
|
159
|
+
include ConversationsRequestsharedinvite
|
156
160
|
include Dialog
|
157
161
|
include Dnd
|
158
162
|
include Emoji
|
data/lib/slack/web/api/errors.rb
CHANGED
@@ -111,18 +111,24 @@ module Slack
|
|
111
111
|
class CanvasEditingFailed < SlackError; end
|
112
112
|
class CanvasGloballyDisabled < SlackError; end
|
113
113
|
class CanvasNotFound < SlackError; end
|
114
|
+
class CanvasTabCreationFailed < SlackError; end
|
114
115
|
class ChannelArchived < SlackError; end
|
115
116
|
class ChannelCannotBeUnshared < SlackError; end
|
116
117
|
class ChannelCanvasAlreadyExists < SlackError; end
|
117
118
|
class ChannelCanvasCreationFailed < SlackError; end
|
118
119
|
class ChannelCanvasDeleted < SlackError; end
|
119
120
|
class ChannelConversionInProgress < SlackError; end
|
121
|
+
class ChannelConversionIncomplete < SlackError; end
|
122
|
+
class ChannelIsArchived < SlackError; end
|
120
123
|
class ChannelIsNotPrivate < SlackError; end
|
121
124
|
class ChannelMentionSyncRequired < SlackError; end
|
122
125
|
class ChannelNotArchived < SlackError; end
|
123
126
|
class ChannelNotFound < SlackError; end
|
127
|
+
class ChannelNotOrgWideShared < SlackError; end
|
124
128
|
class ChannelOwnerRestriction < SlackError; end
|
129
|
+
class ChannelSharedWithNonapprovedTeam < SlackError; end
|
125
130
|
class ChannelTypeNotSupported < SlackError; end
|
131
|
+
class ChannelsLimitExceeded < SlackError; end
|
126
132
|
class ClientIdTokenMismatch < SlackError; end
|
127
133
|
class CodeAlreadyUsed < SlackError; end
|
128
134
|
class ConnectedOrgDenied < SlackError; end
|
@@ -178,6 +184,7 @@ module Slack
|
|
178
184
|
class ErrorBadWide < SlackError; end
|
179
185
|
class ErrorInvalidAlias < SlackError; end
|
180
186
|
class ErrorInvalidEmojiToRename < SlackError; end
|
187
|
+
class ErrorLowerCaseNamesOnly < SlackError; end
|
181
188
|
class ErrorMissingName < SlackError; end
|
182
189
|
class ErrorNameTaken < SlackError; end
|
183
190
|
class ErrorNameTakenI18n < SlackError; end
|
@@ -207,6 +214,7 @@ module Slack
|
|
207
214
|
class FailedToAliasEmoji < SlackError; end
|
208
215
|
class FailedToFetchActiveTeam < SlackError; end
|
209
216
|
class FailedToFetchInfo < SlackError; end
|
217
|
+
class FailedToRemoveEmoji < SlackError; end
|
210
218
|
class FailedToRemoveGroupUsers < SlackError; end
|
211
219
|
class FailedToRemoveUserFromWorkspace < SlackError; end
|
212
220
|
class FailedToRenameEmoji < SlackError; end
|
@@ -223,6 +231,7 @@ module Slack
|
|
223
231
|
class FailedToStartTrial < SlackError; end
|
224
232
|
class FailedToUnlinkChannel < SlackError; end
|
225
233
|
class FailedToUnshare < SlackError; end
|
234
|
+
class FailedToUpdateUserIds < SlackError; end
|
226
235
|
class FailedToValidateCaller < SlackError; end
|
227
236
|
class FailedToValidateChannels < SlackError; end
|
228
237
|
class FailedToValidateCustomMessage < SlackError; end
|
@@ -245,6 +254,7 @@ module Slack
|
|
245
254
|
class FileUploadsDisabled < SlackError; end
|
246
255
|
class ForbiddenHandle < SlackError; end
|
247
256
|
class ForbiddenTeam < SlackError; end
|
257
|
+
class FreeTeamCanvasTabAlreadyExists < SlackError; end
|
248
258
|
class FreeTeamNotAllowed < SlackError; end
|
249
259
|
class FreeTeamsCannotCreateStandaloneCanvases < SlackError; end
|
250
260
|
class FreeTeamsCannotEditStandaloneCanvases < SlackError; end
|
@@ -264,6 +274,7 @@ module Slack
|
|
264
274
|
class InvalidAction < SlackError; end
|
265
275
|
class InvalidActor < SlackError; end
|
266
276
|
class InvalidApp < SlackError; end
|
277
|
+
class InvalidAppActionType < SlackError; end
|
267
278
|
class InvalidAppId < SlackError; end
|
268
279
|
class InvalidArgName < SlackError; end
|
269
280
|
class InvalidArgs < SlackError; end
|
@@ -336,6 +347,7 @@ module Slack
|
|
336
347
|
class InvalidScopes < SlackError; end
|
337
348
|
class InvalidSearchChannelType < SlackError; end
|
338
349
|
class InvalidSetting < SlackError; end
|
350
|
+
class InvalidShortcutType < SlackError; end
|
339
351
|
class InvalidSort < SlackError; end
|
340
352
|
class InvalidSortDir < SlackError; end
|
341
353
|
class InvalidSource < SlackError; end
|
@@ -367,6 +379,9 @@ module Slack
|
|
367
379
|
class InvalidVisibility < SlackError; end
|
368
380
|
class InvalidWorkflowAuthStrategy < SlackError; end
|
369
381
|
class InvalidWorkspaceFilter < SlackError; end
|
382
|
+
class InviteAlreadyApproved < SlackError; end
|
383
|
+
class InviteAlreadyDenied < SlackError; end
|
384
|
+
class InviteExpired < SlackError; end
|
370
385
|
class InviteFromSameOrg < SlackError; end
|
371
386
|
class InviteLookupError < SlackError; end
|
372
387
|
class InviteNotFound < SlackError; end
|
@@ -389,6 +404,7 @@ module Slack
|
|
389
404
|
class LinkNotFound < SlackError; end
|
390
405
|
class MalwareDetected < SlackError; end
|
391
406
|
class ManagedChannelNotSupported < SlackError; end
|
407
|
+
class MarkdownTextConflict < SlackError; end
|
392
408
|
class MemberAnalyticsDisabled < SlackError; end
|
393
409
|
class MemberLimitExceeded < SlackError; end
|
394
410
|
class MessageLimitExceeded < SlackError; end
|
@@ -454,6 +470,7 @@ module Slack
|
|
454
470
|
class NoScopes < SlackError; end
|
455
471
|
class NoSuchSubteam < SlackError; end
|
456
472
|
class NoTeamIdsGiven < SlackError; end
|
473
|
+
class NoTeamOrEnterpriseProvided < SlackError; end
|
457
474
|
class NoTeamsToDisconnect < SlackError; end
|
458
475
|
class NoText < SlackError; end
|
459
476
|
class NoTokensFound < SlackError; end
|
@@ -482,6 +499,7 @@ module Slack
|
|
482
499
|
class NotImplemented < SlackError; end
|
483
500
|
class NotInChannel < SlackError; end
|
484
501
|
class NotInDnd < SlackError; end
|
502
|
+
class NotInTeam < SlackError; end
|
485
503
|
class NotOwner < SlackError; end
|
486
504
|
class NotPaid < SlackError; end
|
487
505
|
class NotPinnable < SlackError; end
|
@@ -500,7 +518,6 @@ module Slack
|
|
500
518
|
class OrgUserNotInTeam < SlackError; end
|
501
519
|
class OverMaxEntityLimit < SlackError; end
|
502
520
|
class OverPaginationLimit < SlackError; end
|
503
|
-
class PaginationNotAvailable < SlackError; end
|
504
521
|
class PaidOnly < SlackError; end
|
505
522
|
class PaidTeamsOnly < SlackError; end
|
506
523
|
class ParameterValidationFailed < SlackError; end
|
@@ -526,6 +543,8 @@ module Slack
|
|
526
543
|
class Ratelimit < SlackError; end
|
527
544
|
class Ratelimited < SlackError; end
|
528
545
|
class RecipientsNotSpecified < SlackError; end
|
546
|
+
class RecordChannelAlreadyExists < SlackError; end
|
547
|
+
class RecordNotFound < SlackError; end
|
529
548
|
class RequestAlreadyResolved < SlackError; end
|
530
549
|
class RequestIdOrAppIdIsRequired < SlackError; end
|
531
550
|
class RequestIdRequiredForCustomIntegrations < SlackError; end
|
@@ -537,11 +556,11 @@ module Slack
|
|
537
556
|
class RestrictedActionReadOnlyChannel < SlackError; end
|
538
557
|
class RestrictedActionThreadLocked < SlackError; end
|
539
558
|
class RestrictedActionThreadOnlyChannel < SlackError; end
|
559
|
+
class RestrictedPlanLevel < SlackError; end
|
540
560
|
class RestrictedTooMany < SlackError; end
|
541
561
|
class RetentionOverrideNotAllowed < SlackError; end
|
542
562
|
class SentRecently < SlackError; end
|
543
563
|
class ServiceUnavailable < SlackError; end
|
544
|
-
class SessionExpired < SlackError; end
|
545
564
|
class SessionInvalidationFailed < SlackError; end
|
546
565
|
class SessionNotFound < SlackError; end
|
547
566
|
class SessionResetNotAllowed < SlackError; end
|
@@ -570,6 +589,7 @@ module Slack
|
|
570
589
|
class TeamNotFound < SlackError; end
|
571
590
|
class TeamNotOnEnterprise < SlackError; end
|
572
591
|
class TeamQuotaExceeded < SlackError; end
|
592
|
+
class TeamTierCannotCreateChannelCanvases < SlackError; end
|
573
593
|
class TeamsNotFound < SlackError; end
|
574
594
|
class TemplateNotVisible < SlackError; end
|
575
595
|
class ThreadLocked < SlackError; end
|
@@ -634,9 +654,11 @@ module Slack
|
|
634
654
|
class UserAlreadyDeleted < SlackError; end
|
635
655
|
class UserAlreadyTeamMember < SlackError; end
|
636
656
|
class UserCannotCreateChannel < SlackError; end
|
657
|
+
class UserCannotManagePublicChannels < SlackError; end
|
637
658
|
class UserCannotManageWorkspace < SlackError; end
|
638
659
|
class UserDisabled < SlackError; end
|
639
660
|
class UserDoesNotOwnChannel < SlackError; end
|
661
|
+
class UserEmailUnverified < SlackError; end
|
640
662
|
class UserIsAlreadyDeleted < SlackError; end
|
641
663
|
class UserIsBot < SlackError; end
|
642
664
|
class UserIsNotAGuest < SlackError; end
|
@@ -766,18 +788,24 @@ module Slack
|
|
766
788
|
'canvas_editing_failed' => CanvasEditingFailed,
|
767
789
|
'canvas_globally_disabled' => CanvasGloballyDisabled,
|
768
790
|
'canvas_not_found' => CanvasNotFound,
|
791
|
+
'canvas_tab_creation_failed' => CanvasTabCreationFailed,
|
769
792
|
'channel_archived' => ChannelArchived,
|
770
793
|
'channel_cannot_be_unshared' => ChannelCannotBeUnshared,
|
771
794
|
'channel_canvas_already_exists' => ChannelCanvasAlreadyExists,
|
772
795
|
'channel_canvas_creation_failed' => ChannelCanvasCreationFailed,
|
773
796
|
'channel_canvas_deleted' => ChannelCanvasDeleted,
|
774
797
|
'channel_conversion_in_progress' => ChannelConversionInProgress,
|
798
|
+
'channel_conversion_incomplete' => ChannelConversionIncomplete,
|
799
|
+
'channel_is_archived' => ChannelIsArchived,
|
775
800
|
'channel_is_not_private' => ChannelIsNotPrivate,
|
776
801
|
'channel_mention_sync_required' => ChannelMentionSyncRequired,
|
777
802
|
'channel_not_archived' => ChannelNotArchived,
|
778
803
|
'channel_not_found' => ChannelNotFound,
|
804
|
+
'channel_not_org_wide_shared' => ChannelNotOrgWideShared,
|
779
805
|
'channel_owner_restriction' => ChannelOwnerRestriction,
|
806
|
+
'channel_shared_with_nonapproved_team' => ChannelSharedWithNonapprovedTeam,
|
780
807
|
'channel_type_not_supported' => ChannelTypeNotSupported,
|
808
|
+
'channels_limit_exceeded' => ChannelsLimitExceeded,
|
781
809
|
'client_id_token_mismatch' => ClientIdTokenMismatch,
|
782
810
|
'code_already_used' => CodeAlreadyUsed,
|
783
811
|
'connected_org_denied' => ConnectedOrgDenied,
|
@@ -833,6 +861,7 @@ module Slack
|
|
833
861
|
'error_bad_wide' => ErrorBadWide,
|
834
862
|
'error_invalid_alias' => ErrorInvalidAlias,
|
835
863
|
'error_invalid_emoji_to_rename' => ErrorInvalidEmojiToRename,
|
864
|
+
'error_lower_case_names_only' => ErrorLowerCaseNamesOnly,
|
836
865
|
'error_missing_name' => ErrorMissingName,
|
837
866
|
'error_name_taken' => ErrorNameTaken,
|
838
867
|
'error_name_taken_i18n' => ErrorNameTakenI18n,
|
@@ -862,6 +891,7 @@ module Slack
|
|
862
891
|
'failed_to_alias_emoji' => FailedToAliasEmoji,
|
863
892
|
'failed_to_fetch_active_team' => FailedToFetchActiveTeam,
|
864
893
|
'failed_to_fetch_info' => FailedToFetchInfo,
|
894
|
+
'failed_to_remove_emoji' => FailedToRemoveEmoji,
|
865
895
|
'failed_to_remove_group_users' => FailedToRemoveGroupUsers,
|
866
896
|
'failed_to_remove_user_from_workspace' => FailedToRemoveUserFromWorkspace,
|
867
897
|
'failed_to_rename_emoji' => FailedToRenameEmoji,
|
@@ -878,6 +908,7 @@ module Slack
|
|
878
908
|
'failed_to_start_trial' => FailedToStartTrial,
|
879
909
|
'failed_to_unlink_channel' => FailedToUnlinkChannel,
|
880
910
|
'failed_to_unshare' => FailedToUnshare,
|
911
|
+
'failed_to_update_user_ids' => FailedToUpdateUserIds,
|
881
912
|
'failed_to_validate_caller' => FailedToValidateCaller,
|
882
913
|
'failed_to_validate_channels' => FailedToValidateChannels,
|
883
914
|
'failed_to_validate_custom_message' => FailedToValidateCustomMessage,
|
@@ -900,6 +931,7 @@ module Slack
|
|
900
931
|
'file_uploads_disabled' => FileUploadsDisabled,
|
901
932
|
'forbidden_handle' => ForbiddenHandle,
|
902
933
|
'forbidden_team' => ForbiddenTeam,
|
934
|
+
'free_team_canvas_tab_already_exists' => FreeTeamCanvasTabAlreadyExists,
|
903
935
|
'free_team_not_allowed' => FreeTeamNotAllowed,
|
904
936
|
'free_teams_cannot_create_standalone_canvases' => FreeTeamsCannotCreateStandaloneCanvases,
|
905
937
|
'free_teams_cannot_edit_standalone_canvases' => FreeTeamsCannotEditStandaloneCanvases,
|
@@ -919,6 +951,7 @@ module Slack
|
|
919
951
|
'invalid_action' => InvalidAction,
|
920
952
|
'invalid_actor' => InvalidActor,
|
921
953
|
'invalid_app' => InvalidApp,
|
954
|
+
'invalid_app_action_type' => InvalidAppActionType,
|
922
955
|
'invalid_app_id' => InvalidAppId,
|
923
956
|
'invalid_arg_name' => InvalidArgName,
|
924
957
|
'invalid_args' => InvalidArgs,
|
@@ -991,6 +1024,7 @@ module Slack
|
|
991
1024
|
'invalid_scopes' => InvalidScopes,
|
992
1025
|
'invalid_search_channel_type' => InvalidSearchChannelType,
|
993
1026
|
'invalid_setting' => InvalidSetting,
|
1027
|
+
'invalid_shortcut_type' => InvalidShortcutType,
|
994
1028
|
'invalid_sort' => InvalidSort,
|
995
1029
|
'invalid_sort_dir' => InvalidSortDir,
|
996
1030
|
'invalid_source' => InvalidSource,
|
@@ -1022,6 +1056,9 @@ module Slack
|
|
1022
1056
|
'invalid_visibility' => InvalidVisibility,
|
1023
1057
|
'invalid_workflow_auth_strategy' => InvalidWorkflowAuthStrategy,
|
1024
1058
|
'invalid_workspace_filter' => InvalidWorkspaceFilter,
|
1059
|
+
'invite_already_approved' => InviteAlreadyApproved,
|
1060
|
+
'invite_already_denied' => InviteAlreadyDenied,
|
1061
|
+
'invite_expired' => InviteExpired,
|
1025
1062
|
'invite_from_same_org' => InviteFromSameOrg,
|
1026
1063
|
'invite_lookup_error' => InviteLookupError,
|
1027
1064
|
'invite_not_found' => InviteNotFound,
|
@@ -1044,6 +1081,7 @@ module Slack
|
|
1044
1081
|
'link_not_found' => LinkNotFound,
|
1045
1082
|
'malware_detected' => MalwareDetected,
|
1046
1083
|
'managed_channel_not_supported' => ManagedChannelNotSupported,
|
1084
|
+
'markdown_text_conflict' => MarkdownTextConflict,
|
1047
1085
|
'member_analytics_disabled' => MemberAnalyticsDisabled,
|
1048
1086
|
'member_limit_exceeded' => MemberLimitExceeded,
|
1049
1087
|
'message_limit_exceeded' => MessageLimitExceeded,
|
@@ -1109,6 +1147,7 @@ module Slack
|
|
1109
1147
|
'no_scopes' => NoScopes,
|
1110
1148
|
'no_such_subteam' => NoSuchSubteam,
|
1111
1149
|
'no_team_ids_given' => NoTeamIdsGiven,
|
1150
|
+
'no_team_or_enterprise_provided' => NoTeamOrEnterpriseProvided,
|
1112
1151
|
'no_teams_to_disconnect' => NoTeamsToDisconnect,
|
1113
1152
|
'no_text' => NoText,
|
1114
1153
|
'no_tokens_found' => NoTokensFound,
|
@@ -1137,6 +1176,7 @@ module Slack
|
|
1137
1176
|
'not_implemented' => NotImplemented,
|
1138
1177
|
'not_in_channel' => NotInChannel,
|
1139
1178
|
'not_in_dnd' => NotInDnd,
|
1179
|
+
'not_in_team' => NotInTeam,
|
1140
1180
|
'not_owner' => NotOwner,
|
1141
1181
|
'not_paid' => NotPaid,
|
1142
1182
|
'not_pinnable' => NotPinnable,
|
@@ -1155,7 +1195,6 @@ module Slack
|
|
1155
1195
|
'org_user_not_in_team' => OrgUserNotInTeam,
|
1156
1196
|
'over_max_entity_limit' => OverMaxEntityLimit,
|
1157
1197
|
'over_pagination_limit' => OverPaginationLimit,
|
1158
|
-
'pagination_not_available' => PaginationNotAvailable,
|
1159
1198
|
'paid_only' => PaidOnly,
|
1160
1199
|
'paid_teams_only' => PaidTeamsOnly,
|
1161
1200
|
'parameter_validation_failed' => ParameterValidationFailed,
|
@@ -1181,6 +1220,8 @@ module Slack
|
|
1181
1220
|
'ratelimit' => Ratelimit,
|
1182
1221
|
'ratelimited' => Ratelimited,
|
1183
1222
|
'recipients_not_specified' => RecipientsNotSpecified,
|
1223
|
+
'record_channel_already_exists' => RecordChannelAlreadyExists,
|
1224
|
+
'record_not_found' => RecordNotFound,
|
1184
1225
|
'request_already_resolved' => RequestAlreadyResolved,
|
1185
1226
|
'request_id_or_app_id_is_required' => RequestIdOrAppIdIsRequired,
|
1186
1227
|
'request_id_required_for_custom_integrations' => RequestIdRequiredForCustomIntegrations,
|
@@ -1192,11 +1233,11 @@ module Slack
|
|
1192
1233
|
'restricted_action_read_only_channel' => RestrictedActionReadOnlyChannel,
|
1193
1234
|
'restricted_action_thread_locked' => RestrictedActionThreadLocked,
|
1194
1235
|
'restricted_action_thread_only_channel' => RestrictedActionThreadOnlyChannel,
|
1236
|
+
'restricted_plan_level' => RestrictedPlanLevel,
|
1195
1237
|
'restricted_too_many' => RestrictedTooMany,
|
1196
1238
|
'retention_override_not_allowed' => RetentionOverrideNotAllowed,
|
1197
1239
|
'sent_recently' => SentRecently,
|
1198
1240
|
'service_unavailable' => ServiceUnavailable,
|
1199
|
-
'session_expired' => SessionExpired,
|
1200
1241
|
'session_invalidation_failed' => SessionInvalidationFailed,
|
1201
1242
|
'session_not_found' => SessionNotFound,
|
1202
1243
|
'session_reset_not_allowed' => SessionResetNotAllowed,
|
@@ -1225,6 +1266,7 @@ module Slack
|
|
1225
1266
|
'team_not_found' => TeamNotFound,
|
1226
1267
|
'team_not_on_enterprise' => TeamNotOnEnterprise,
|
1227
1268
|
'team_quota_exceeded' => TeamQuotaExceeded,
|
1269
|
+
'team_tier_cannot_create_channel_canvases' => TeamTierCannotCreateChannelCanvases,
|
1228
1270
|
'teams_not_found' => TeamsNotFound,
|
1229
1271
|
'template_not_visible' => TemplateNotVisible,
|
1230
1272
|
'thread_locked' => ThreadLocked,
|
@@ -1289,9 +1331,11 @@ module Slack
|
|
1289
1331
|
'user_already_deleted' => UserAlreadyDeleted,
|
1290
1332
|
'user_already_team_member' => UserAlreadyTeamMember,
|
1291
1333
|
'user_cannot_create_channel' => UserCannotCreateChannel,
|
1334
|
+
'user_cannot_manage_public_channels' => UserCannotManagePublicChannels,
|
1292
1335
|
'user_cannot_manage_workspace' => UserCannotManageWorkspace,
|
1293
1336
|
'user_disabled' => UserDisabled,
|
1294
1337
|
'user_does_not_own_channel' => UserDoesNotOwnChannel,
|
1338
|
+
'user_email_unverified' => UserEmailUnverified,
|
1295
1339
|
'user_is_already_deleted' => UserIsAlreadyDeleted,
|
1296
1340
|
'user_is_bot' => UserIsBot,
|
1297
1341
|
'user_is_not_a_guest' => UserIsNotAGuest,
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Slack
|
3
|
+
module Web
|
4
|
+
module Api
|
5
|
+
module Helpers
|
6
|
+
module Files
|
7
|
+
#
|
8
|
+
# Uses Slack APIs new sequential file upload flow. This replaces the files.upload method
|
9
|
+
# @see https://api.slack.com/changelog/2024-04-a-better-way-to-upload-files-is-here-to-stay
|
10
|
+
# @see https://api.slack.com/messaging/files#uploading_files
|
11
|
+
#
|
12
|
+
# @option params [string] :filename
|
13
|
+
# Name of the file being uploaded.
|
14
|
+
# @option params [string] :content
|
15
|
+
# File contents via a POST variable.
|
16
|
+
# @option params [string] :alt_txt
|
17
|
+
# Description of image for screen-reader.
|
18
|
+
# @option params [string] :snippet_type
|
19
|
+
# Syntax type of the snippet being uploaded.
|
20
|
+
# @option params [string] :title
|
21
|
+
# Title of file.
|
22
|
+
# @option params [string] :channel_id
|
23
|
+
# Channel ID where the file will be shared. If not specified the file will be private.
|
24
|
+
# @option params [string] :channel
|
25
|
+
# Channel where the file will be shared, alias of channel_id. If not specified the file will be private.
|
26
|
+
# @option params [string] :channels
|
27
|
+
# Comma-separated string of channel IDs where the file will be shared. If not specified the file will be private.
|
28
|
+
# @option params [string] :initial_comment
|
29
|
+
# The message text introducing the file in specified channels.
|
30
|
+
# @option params [string] :thread_ts
|
31
|
+
# Provide another message's ts value to upload this file as a reply.
|
32
|
+
# Never use a reply's ts value; use its parent instead.
|
33
|
+
# Also make sure to provide only one channel when using 'thread_ts'.
|
34
|
+
def files_upload_v2(params = {})
|
35
|
+
%i[filename content].each do |param|
|
36
|
+
raise ArgumentError, "Required argument :#{param} missing" if params[param].nil?
|
37
|
+
end
|
38
|
+
|
39
|
+
channel_params = %i[channel channels channel_id].map { |param| params[param] }.compact
|
40
|
+
raise ArgumentError, 'Only one of :channel, :channels, or :channel_id is required' if channel_params.size > 1
|
41
|
+
|
42
|
+
complete_upload_request_params = params.slice(:initial_comment, :thread_ts)
|
43
|
+
|
44
|
+
if params[:channels]
|
45
|
+
complete_upload_request_params[:channels] = Array(params[:channels]).map do |channel|
|
46
|
+
conversations_id(channel: channel)['channel']['id']
|
47
|
+
end.uniq.join(',')
|
48
|
+
elsif params[:channel]
|
49
|
+
complete_upload_request_params[:channel] = conversations_id(
|
50
|
+
channel: params[:channel]
|
51
|
+
)['channel']['id']
|
52
|
+
elsif params[:channel_id]
|
53
|
+
complete_upload_request_params[:channel_id] = params[:channel_id]
|
54
|
+
end
|
55
|
+
|
56
|
+
content = params[:content]
|
57
|
+
title = params[:title] || params[:filename]
|
58
|
+
|
59
|
+
upload_url_request_params = params.slice(:filename, :alt_txt, :snippet_type)
|
60
|
+
upload_url_request_params[:length] = content.bytesize
|
61
|
+
|
62
|
+
# Get the upload url.
|
63
|
+
get_upload_url_response = files_getUploadURLExternal(upload_url_request_params)
|
64
|
+
upload_url = get_upload_url_response[:upload_url]
|
65
|
+
file_id = get_upload_url_response[:file_id]
|
66
|
+
|
67
|
+
# Upload the file.
|
68
|
+
::Faraday::Connection.new(upload_url, options) do |connection|
|
69
|
+
connection.request :multipart
|
70
|
+
connection.request :url_encoded
|
71
|
+
connection.use ::Slack::Web::Faraday::Response::WrapError
|
72
|
+
connection.response :logger, logger if logger
|
73
|
+
connection.adapter adapter
|
74
|
+
end.post do |request|
|
75
|
+
request.body = content
|
76
|
+
end
|
77
|
+
|
78
|
+
# Complete the upload.
|
79
|
+
complete_upload_request_params[:files] = [{ id: file_id, title: title }].to_json
|
80
|
+
|
81
|
+
files_completeUploadExternal(complete_upload_request_params)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -8,11 +8,12 @@ RSpec.describe Slack::Web::Api::Endpoints::<%= group.gsub(".", "_").camelize %>
|
|
8
8
|
<% names.sort.each_with_index do |(name, data), index| %>
|
9
9
|
<% next if data['mixin'] %>
|
10
10
|
<% group_required_params = data['arg_groups']&.map { |grp| grp['args'].first if grp['args'].size > 1 } || [] %>
|
11
|
-
<% required_params = data['args'].select{ |k, v| v['required']
|
11
|
+
<% required_params = data['args'].select{ |k, v| v['required'] } %>
|
12
|
+
<% all_required_params = data['args'].select{ |k, v| v['required'] || group_required_params.include?(k) } %>
|
12
13
|
<% json_params = data['args'].map { |arg_name, arg_v| arg_name if arg_v['format'] == 'json' }.compact %>
|
13
|
-
<% next if (
|
14
|
+
<% next if (all_required_params.none? || custom_spec_exists) && json_params.none? && data['arg_groups'].nil? %>
|
14
15
|
<% method_name = [group.gsub(".", "_"), name].join('_') %>
|
15
|
-
<% example_params =
|
16
|
+
<% example_params = all_required_params.to_h { |var, opts| [var, opts['example']] } %>
|
16
17
|
context '<%= group %>_<%= name %>' do
|
17
18
|
<% unless custom_spec_exists %>
|
18
19
|
<% required_params.each do |arg_name, arg_v| %>
|
data/lib/slack/web/client.rb
CHANGED
@@ -3,35 +3,22 @@ module Slack
|
|
3
3
|
module Web
|
4
4
|
module Faraday
|
5
5
|
module Connection
|
6
|
+
include Slack::Web::Faraday::Options
|
7
|
+
|
6
8
|
private
|
7
9
|
|
8
10
|
def connection
|
9
|
-
@connection ||=
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
request_options[:timeout] = timeout if timeout
|
21
|
-
request_options[:open_timeout] = open_timeout if open_timeout
|
22
|
-
options[:request] = request_options if request_options.any?
|
23
|
-
|
24
|
-
::Faraday::Connection.new(endpoint, options) do |connection|
|
25
|
-
connection.request :multipart
|
26
|
-
connection.request :url_encoded
|
27
|
-
connection.use ::Slack::Web::Faraday::Response::RaiseError
|
28
|
-
connection.response :mashify, mash_class: Slack::Messages::Message
|
29
|
-
connection.response :json, content_type: /\b*$/
|
30
|
-
connection.use ::Slack::Web::Faraday::Response::WrapError
|
31
|
-
connection.response :logger, logger if logger
|
32
|
-
connection.adapter adapter
|
33
|
-
end
|
34
|
-
end
|
11
|
+
@connection ||= ::Faraday::Connection.new(endpoint, options) do |connection|
|
12
|
+
connection.headers['Accept'] = 'application/json; charset=utf-8'
|
13
|
+
connection.request :multipart
|
14
|
+
connection.request :url_encoded
|
15
|
+
connection.use ::Slack::Web::Faraday::Response::RaiseError
|
16
|
+
connection.response :mashify, mash_class: Slack::Messages::Message
|
17
|
+
connection.response :json, content_type: /\b*$/
|
18
|
+
connection.use ::Slack::Web::Faraday::Response::WrapError
|
19
|
+
connection.response :logger, logger if logger
|
20
|
+
connection.adapter adapter
|
21
|
+
end
|
35
22
|
end
|
36
23
|
end
|
37
24
|
end
|