slack-ruby-client 2.2.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +6 -0
  3. data/.github/workflows/integration_test.yml +1 -1
  4. data/.github/workflows/lint.yml +1 -1
  5. data/.github/workflows/pr_lint.yml +1 -1
  6. data/.github/workflows/test.yml +23 -13
  7. data/.github/workflows/update_api.yml +8 -3
  8. data/.gitignore +1 -0
  9. data/CHANGELOG.md +14 -0
  10. data/README.md +27 -2
  11. data/bin/commands/admin_apps_activities.rb +4 -4
  12. data/bin/commands/admin_apps_config.rb +2 -2
  13. data/bin/commands/admin_conversations.rb +2 -1
  14. data/bin/commands/admin_emoji.rb +1 -1
  15. data/bin/commands/admin_users.rb +6 -4
  16. data/bin/commands/admin_workflows.rb +4 -2
  17. data/bin/commands/admin_workflows_triggers_types_permissions.rb +31 -0
  18. data/bin/commands/apps_datastore.rb +46 -0
  19. data/bin/commands/canvases.rb +40 -0
  20. data/bin/commands/canvases_access.rb +34 -0
  21. data/bin/commands/canvases_sections.rb +21 -0
  22. data/bin/commands/chat.rb +9 -9
  23. data/bin/commands/conversations.rb +3 -2
  24. data/bin/commands/conversations_canvases.rb +21 -0
  25. data/bin/commands/conversations_externalInvitePermissions.rb +22 -0
  26. data/bin/commands/functions.rb +31 -0
  27. data/bin/commands/functions_distributions_permissions.rb +59 -0
  28. data/bin/commands/oauth.rb +2 -2
  29. data/bin/commands/oauth_v2.rb +2 -2
  30. data/bin/commands/pins.rb +0 -1
  31. data/bin/commands/reminders.rb +1 -1
  32. data/bin/commands/team.rb +2 -2
  33. data/bin/commands/team_externalTeams.rb +35 -0
  34. data/bin/commands/usergroups.rb +10 -10
  35. data/bin/commands/usergroups_users.rb +8 -8
  36. data/bin/commands/users_discoverableContacts.rb +20 -0
  37. data/bin/commands/workflows_triggers_permissions.rb +60 -0
  38. data/lib/slack/events/request.rb +4 -2
  39. data/lib/slack/messages/formatting.rb +13 -0
  40. data/lib/slack/version.rb +1 -1
  41. data/lib/slack/web/api/endpoints/admin_apps_activities.rb +5 -5
  42. data/lib/slack/web/api/endpoints/admin_apps_config.rb +3 -3
  43. data/lib/slack/web/api/endpoints/admin_conversations.rb +3 -1
  44. data/lib/slack/web/api/endpoints/admin_emoji.rb +1 -1
  45. data/lib/slack/web/api/endpoints/admin_functions_permissions.rb +1 -1
  46. data/lib/slack/web/api/endpoints/admin_users.rb +6 -2
  47. data/lib/slack/web/api/endpoints/admin_workflows.rb +9 -5
  48. data/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb +41 -0
  49. data/lib/slack/web/api/endpoints/apps_activities.rb +1 -1
  50. data/lib/slack/web/api/endpoints/apps_datastore.rb +71 -0
  51. data/lib/slack/web/api/endpoints/canvases.rb +52 -0
  52. data/lib/slack/web/api/endpoints/canvases_access.rb +47 -0
  53. data/lib/slack/web/api/endpoints/canvases_sections.rb +27 -0
  54. data/lib/slack/web/api/endpoints/chat.rb +21 -21
  55. data/lib/slack/web/api/endpoints/conversations.rb +4 -2
  56. data/lib/slack/web/api/endpoints/conversations_canvases.rb +26 -0
  57. data/lib/slack/web/api/endpoints/conversations_externalInvitePermissions.rb +31 -0
  58. data/lib/slack/web/api/endpoints/dnd.rb +1 -0
  59. data/lib/slack/web/api/endpoints/functions.rb +43 -0
  60. data/lib/slack/web/api/endpoints/functions_distributions_permissions.rb +80 -0
  61. data/lib/slack/web/api/endpoints/oauth.rb +2 -2
  62. data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
  63. data/lib/slack/web/api/endpoints/openid_connect.rb +1 -1
  64. data/lib/slack/web/api/endpoints/pins.rb +0 -2
  65. data/lib/slack/web/api/endpoints/reminders.rb +1 -1
  66. data/lib/slack/web/api/endpoints/search.rb +3 -3
  67. data/lib/slack/web/api/endpoints/team.rb +3 -3
  68. data/lib/slack/web/api/endpoints/team_externalTeams.rb +53 -0
  69. data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
  70. data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
  71. data/lib/slack/web/api/endpoints/usergroups_users.rb +6 -6
  72. data/lib/slack/web/api/endpoints/users.rb +1 -1
  73. data/lib/slack/web/api/endpoints/users_discoverableContacts.rb +24 -0
  74. data/lib/slack/web/api/endpoints/workflows_triggers_permissions.rb +87 -0
  75. data/lib/slack/web/api/endpoints.rb +22 -0
  76. data/lib/slack/web/api/errors.rb +84 -4
  77. data/lib/slack/web/api/patches/.gitkeep +0 -0
  78. data/lib/slack/web/api/templates/method.erb +1 -0
  79. data/lib/slack/web/api/templates/method_spec.erb +2 -1
  80. data/spec/slack/events/request_spec.rb +11 -0
  81. data/spec/slack/messages/formatting_spec.rb +32 -0
  82. data/spec/slack/web/api/endpoints/admin_workflows_triggers_types_permissions_spec.rb +21 -0
  83. data/spec/slack/web/api/endpoints/apps_datastore_spec.rb +29 -0
  84. data/spec/slack/web/api/endpoints/canvases_access_spec.rb +21 -0
  85. data/spec/slack/web/api/endpoints/canvases_sections_spec.rb +16 -0
  86. data/spec/slack/web/api/endpoints/canvases_spec.rb +21 -0
  87. data/spec/slack/web/api/endpoints/chat_spec.rb +76 -4
  88. data/spec/slack/web/api/endpoints/conversations_canvases_spec.rb +13 -0
  89. data/spec/slack/web/api/endpoints/conversations_externalInvitePermissions_spec.rb +19 -0
  90. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +2 -9
  91. data/spec/slack/web/api/endpoints/dnd_spec.rb +5 -0
  92. data/spec/slack/web/api/endpoints/functions_distributions_permissions_spec.rb +10 -0
  93. data/spec/slack/web/api/endpoints/functions_spec.rb +28 -0
  94. data/spec/slack/web/api/endpoints/team_externalTeams_spec.rb +13 -0
  95. data/spec/slack/web/api/endpoints/users_discoverableContacts_spec.rb +13 -0
  96. data/spec/slack/web/api/endpoints/workflows_triggers_permissions_spec.rb +31 -0
  97. metadata +37 -3
  98. data/lib/slack/web/api/patches/chat.attachments-blocks.patch +0 -21
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'ConversationsCanvases methods.'
8
+ command 'conversations_canvases' do |g|
9
+ g.desc 'Create a Channel Canvas for a channel.'
10
+ g.long_desc %( Create a Channel Canvas for a channel. )
11
+ g.command 'create' do |c|
12
+ c.flag 'channel_id', desc: 'Channel ID of the channel we create the channel canvas for.'
13
+ c.flag 'document_content', desc: 'Structure describing the type and value of the content to create.'
14
+ c.action do |_global_options, options, _args|
15
+ puts JSON.dump(@client.conversations_canvases_create(options))
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'ConversationsExternalinvitepermissions methods.'
8
+ command 'conversations_externalInvitePermissions' do |g|
9
+ g.desc "Upgrade or downgrade Slack Connect channel permissions between 'can post only' and 'can post and invite'."
10
+ g.long_desc %( Upgrade or downgrade Slack Connect channel permissions between 'can post only' and 'can post and invite'. )
11
+ g.command 'set' do |c|
12
+ c.flag 'action', desc: 'Type of action to be taken: upgrade or downgrade.'
13
+ c.flag 'channel', desc: 'The channel ID to change external invite permissions for.'
14
+ c.flag 'target_team', desc: 'The encoded team ID of the target team. Must be in the specified channel.'
15
+ c.action do |_global_options, options, _args|
16
+ puts JSON.dump(@client.conversations_externalInvitePermissions_set(options))
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'Functions methods.'
8
+ command 'functions' do |g|
9
+ g.desc 'Signal that a function failed to complete'
10
+ g.long_desc %( Signal that a function failed to complete )
11
+ g.command 'completeError' do |c|
12
+ c.flag 'error', desc: 'A human-readable error message that contains information about why the function failed to complete.'
13
+ c.flag 'function_execution_id', desc: 'Context identifier that maps to the executed function.'
14
+ c.action do |_global_options, options, _args|
15
+ puts JSON.dump(@client.functions_completeError(options))
16
+ end
17
+ end
18
+
19
+ g.desc 'Signal the successful completion of a function'
20
+ g.long_desc %( Signal the successful completion of a function )
21
+ g.command 'completeSuccess' do |c|
22
+ c.flag 'function_execution_id', desc: 'Context identifier that maps to the executed function.'
23
+ c.flag 'outputs', desc: 'A JSON-based object that conforms to the output parameters schema for the custom function defined in the manifest.'
24
+ c.action do |_global_options, options, _args|
25
+ puts JSON.dump(@client.functions_completeSuccess(options))
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'FunctionsDistributionsPermissions methods.'
8
+ command 'functions_distributions_permissions' do |g|
9
+ g.desc 'Grant users access to a custom slack function if its permission_type is set to named_entities'
10
+ g.long_desc %( Grant users access to a custom slack function if its permission_type is set to named_entities )
11
+ g.command 'add' do |c|
12
+ c.flag 'function_app_id', desc: 'The encoded ID of the app.'
13
+ c.flag 'function_callback_id', desc: "The callback ID defined in the function's definition file."
14
+ c.flag 'function_id', desc: 'The encoded ID of the function.'
15
+ c.flag 'user_ids', desc: 'List of encoded user IDs.'
16
+ c.action do |_global_options, options, _args|
17
+ puts JSON.dump(@client.functions_distributions_permissions_add(options))
18
+ end
19
+ end
20
+
21
+ g.desc 'List the access type of a custom slack function and include the users with access if its permission_type is set to named_entities'
22
+ g.long_desc %( List the access type of a custom slack function and include the users with access if its permission_type is set to named_entities )
23
+ g.command 'list' do |c|
24
+ c.flag 'function_app_id', desc: 'The encoded ID of the app.'
25
+ c.flag 'function_callback_id', desc: "The callback ID defined in the function's definition file."
26
+ c.flag 'function_id', desc: 'The encoded ID of the function.'
27
+ c.action do |_global_options, options, _args|
28
+ puts JSON.dump(@client.functions_distributions_permissions_list(options))
29
+ end
30
+ end
31
+
32
+ g.desc 'Revoke user access to a custom slack function if permission_type set to named_entities'
33
+ g.long_desc %( Revoke user access to a custom slack function if permission_type set to named_entities )
34
+ g.command 'remove' do |c|
35
+ c.flag 'function_app_id', desc: 'The encoded ID of the app.'
36
+ c.flag 'function_callback_id', desc: "The callback ID defined in the function's definition file."
37
+ c.flag 'function_id', desc: 'The encoded ID of the function.'
38
+ c.flag 'user_ids', desc: 'List of encoded user IDs.'
39
+ c.action do |_global_options, options, _args|
40
+ puts JSON.dump(@client.functions_distributions_permissions_remove(options))
41
+ end
42
+ end
43
+
44
+ g.desc 'Set the access type of a custom slack function and define the users to be granted access if permission_type is set to named_entities'
45
+ g.long_desc %( Set the access type of a custom slack function and define the users to be granted access if permission_type is set to named_entities )
46
+ g.command 'set' do |c|
47
+ c.flag 'permission_type', desc: 'The type of permission that defines how the function can be distributed.'
48
+ c.flag 'function_app_id', desc: 'The encoded ID of the app.'
49
+ c.flag 'function_callback_id', desc: "The callback ID defined in the function's definition file."
50
+ c.flag 'function_id', desc: 'The encoded ID of the function.'
51
+ c.flag 'user_ids', desc: 'List of encoded user IDs.'
52
+ c.action do |_global_options, options, _args|
53
+ puts JSON.dump(@client.functions_distributions_permissions_set(options))
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -9,8 +9,8 @@ module Slack
9
9
  g.desc 'Exchanges a temporary OAuth verifier code for an access token.'
10
10
  g.long_desc %( Exchanges a temporary OAuth verifier code for an access token. )
11
11
  g.command 'access' do |c|
12
- c.flag 'client_id', desc: 'Issued when you created your application.'
13
- c.flag 'client_secret', desc: 'Issued when you created your application.'
12
+ c.flag 'client_id', desc: 'Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme.'
13
+ c.flag 'client_secret', desc: 'Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme.'
14
14
  c.flag 'code', desc: 'The code param returned via the OAuth callback.'
15
15
  c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).'
16
16
  c.flag 'single_channel', desc: 'Request the user to add your app only to a single channel. Only valid with a legacy workspace app.'
@@ -9,8 +9,8 @@ module Slack
9
9
  g.desc 'Exchanges a temporary OAuth verifier code for an access token.'
10
10
  g.long_desc %( Exchanges a temporary OAuth verifier code for an access token. )
11
11
  g.command 'access' do |c|
12
- c.flag 'client_id', desc: 'Issued when you created your application.'
13
- c.flag 'client_secret', desc: 'Issued when you created your application.'
12
+ c.flag 'client_id', desc: 'Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme.'
13
+ c.flag 'client_secret', desc: 'Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme.'
14
14
  c.flag 'code', desc: 'The code param returned via the OAuth callback.'
15
15
  c.flag 'grant_type', desc: 'The grant_type param as described in the OAuth spec.'
16
16
  c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).'
data/bin/commands/pins.rb CHANGED
@@ -10,7 +10,6 @@ module Slack
10
10
  g.long_desc %( Pins an item to a channel. )
11
11
  g.command 'add' do |c|
12
12
  c.flag 'channel', desc: 'Channel to pin the messsage to. You must also include a timestamp when pinning messages.'
13
- c.flag 'quip_component_id', desc: 'Component ID for the pins component that was inserted into the channel canvas, if any.'
14
13
  c.flag 'timestamp', desc: 'Timestamp of the message to pin. You must also include the channel.'
15
14
  c.action do |_global_options, options, _args|
16
15
  puts JSON.dump(@client.pins_add(options))
@@ -10,7 +10,7 @@ module Slack
10
10
  g.long_desc %( Creates a reminder. )
11
11
  g.command 'add' do |c|
12
12
  c.flag 'text', desc: 'The content of the reminder.'
13
- 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").'
13
+ c.flag 'time', desc: 'Can also take a type of integer. 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").'
14
14
  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.'
15
15
  c.flag 'team_id', desc: 'Encoded team id, required if org token is used.'
16
16
  c.flag 'user', desc: 'No longer supported - reminders cannot be set for other users. Previously, was the user who would receive the reminder.'
data/bin/commands/team.rb CHANGED
@@ -33,7 +33,7 @@ module Slack
33
33
  g.desc 'Gets information about the current team.'
34
34
  g.long_desc %( Gets information about the current team. )
35
35
  g.command 'info' do |c|
36
- c.flag 'domain', desc: 'Query by domain instead of team (only when team is null). This only works for domains in the same enterprise as the querying team token. This also expects the domain to belong to a team and not the enterprise itself.'
36
+ c.flag 'domain', desc: "Query by domain instead of team (only when team is null). This only works for domains in the same enterprise as the querying team token. This also expects the domain to belong to a team and not the enterprise itself. This is the value set up for the 'Joining This Workspace' workspace setting. If it contains more than one domain, the field will contain multiple comma-separated domain values. If no domain is set, the field is empty."
37
37
  c.flag 'team', desc: 'Team to get info about; if omitted, will return information about the current team.'
38
38
  c.action do |_global_options, options, _args|
39
39
  puts JSON.dump(@client.team_info(options))
@@ -44,7 +44,7 @@ module Slack
44
44
  g.long_desc %( Gets the integration logs for the current team. )
45
45
  g.command 'integrationLogs' do |c|
46
46
  c.flag 'app_id', desc: 'Filter logs to this Slack app. Defaults to all logs.'
47
- c.flag 'change_type', desc: 'Filter logs with this change type. Defaults to all logs.'
47
+ c.flag 'change_type', desc: 'Filter logs with this change type. Possible values are added, removed, enabled, disabled, and updated. Defaults to all logs.'
48
48
  c.flag 'service_id', desc: 'Filter logs to this service. Defaults to all logs.'
49
49
  c.flag 'team_id', desc: 'encoded team id to get logs from, required if org token is used.'
50
50
  c.flag 'user', desc: "Filter logs generated by this user's actions. Defaults to all logs."
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'TeamExternalteams methods.'
8
+ command 'team_externalTeams' do |g|
9
+ g.desc 'Disconnect an external organization.'
10
+ g.long_desc %( Disconnect an external organization. )
11
+ g.command 'disconnect' do |c|
12
+ c.flag 'target_team', desc: 'The team ID of the target team.'
13
+ c.action do |_global_options, options, _args|
14
+ puts JSON.dump(@client.team_externalTeams_disconnect(options))
15
+ end
16
+ end
17
+
18
+ g.desc 'Returns a list of all the external teams connected and details about the connection.'
19
+ g.long_desc %( Returns a list of all the external teams connected and details about the connection. )
20
+ g.command 'list' do |c|
21
+ c.flag 'connection_status_filter', desc: 'Status of the connected team.'
22
+ c.flag 'cursor', desc: "Paginate through collections of data by setting parameter to the team_id attribute returned by a previous request's response_metadata. If not provided, the first page of the collection is returned. See pagination for more detail."
23
+ c.flag 'limit', desc: 'The maximum number of items to return per page.'
24
+ c.flag 'slack_connect_pref_filter', desc: 'Filters connected orgs by Slack Connect pref override(s). Value can be: approved_orgs_only allow_sc_file_uploads profile_visibility away_team_sc_invite_permissions accept_sc_invites sc_mpdm_to_private require_sc_channel_for_sc_dm external_awareness_context_bar.'
25
+ c.flag 'sort_direction', desc: 'Direction to sort in asc or desc.'
26
+ c.flag 'sort_field', desc: 'Name of the parameter that we are sorting by.'
27
+ c.flag 'workspace_filter', desc: 'Shows connected orgs which are connected on a specified encoded workspace ID.'
28
+ c.action do |_global_options, options, _args|
29
+ puts JSON.dump(@client.team_externalTeams_list(options))
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -6,8 +6,8 @@ module Slack
6
6
  class App
7
7
  desc 'Usergroups methods.'
8
8
  command 'usergroups' do |g|
9
- g.desc 'Create a User Group'
10
- g.long_desc %( Create a User Group )
9
+ g.desc 'Create a User Group.'
10
+ g.long_desc %( Create a User Group. )
11
11
  g.command 'create' do |c|
12
12
  c.flag 'name', desc: 'A name for the User Group. Must be unique among User Groups.'
13
13
  c.flag 'channels', desc: 'A comma separated string of encoded channel IDs for which the User Group uses as a default.'
@@ -20,8 +20,8 @@ module Slack
20
20
  end
21
21
  end
22
22
 
23
- g.desc 'Disable an existing User Group'
24
- g.long_desc %( Disable an existing User Group )
23
+ g.desc 'Disable an existing User Group.'
24
+ g.long_desc %( Disable an existing User Group. )
25
25
  g.command 'disable' do |c|
26
26
  c.flag 'usergroup', desc: 'The encoded ID of the User Group to disable.'
27
27
  c.flag 'include_count', desc: 'Include the number of users in the User Group.'
@@ -31,8 +31,8 @@ module Slack
31
31
  end
32
32
  end
33
33
 
34
- g.desc 'Enable a User Group'
35
- g.long_desc %( Enable a User Group )
34
+ g.desc 'Enable a User Group.'
35
+ g.long_desc %( Enable a User Group. )
36
36
  g.command 'enable' do |c|
37
37
  c.flag 'usergroup', desc: 'The encoded ID of the User Group to enable.'
38
38
  c.flag 'include_count', desc: 'Include the number of users in the User Group.'
@@ -42,8 +42,8 @@ module Slack
42
42
  end
43
43
  end
44
44
 
45
- g.desc 'List all User Groups for a team'
46
- g.long_desc %( List all User Groups for a team )
45
+ g.desc 'List all User Groups for a team.'
46
+ g.long_desc %( List all User Groups for a team. )
47
47
  g.command 'list' do |c|
48
48
  c.flag 'include_count', desc: 'Include the number of users in each User Group.'
49
49
  c.flag 'include_disabled', desc: 'Include disabled User Groups.'
@@ -54,8 +54,8 @@ module Slack
54
54
  end
55
55
  end
56
56
 
57
- g.desc 'Update an existing User Group'
58
- g.long_desc %( Update an existing User Group )
57
+ g.desc 'Update an existing User Group.'
58
+ g.long_desc %( Update an existing User Group. )
59
59
  g.command 'update' do |c|
60
60
  c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
61
61
  c.flag 'channels', desc: 'A comma separated string of encoded channel IDs for which the User Group uses as a default.'
@@ -6,10 +6,10 @@ module Slack
6
6
  class App
7
7
  desc 'UsergroupsUsers methods.'
8
8
  command 'usergroups_users' do |g|
9
- g.desc 'List all users in a User Group'
10
- g.long_desc %( List all users in a User Group )
9
+ g.desc 'List all users in a User Group.'
10
+ g.long_desc %( List all users in a User Group. )
11
11
  g.command 'list' do |c|
12
- c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
12
+ c.flag 'usergroup', desc: 'The encoded ID of the User Group to list users for.'
13
13
  c.flag 'include_disabled', desc: 'Allow results that involve disabled User Groups.'
14
14
  c.flag 'team_id', desc: 'encoded team id where the user group exists, required if org token is used.'
15
15
  c.action do |_global_options, options, _args|
@@ -17,12 +17,12 @@ module Slack
17
17
  end
18
18
  end
19
19
 
20
- g.desc 'Update the list of users for a User Group'
21
- g.long_desc %( Update the list of users for a User Group )
20
+ g.desc 'Update the list of users for a user group.'
21
+ g.long_desc %( Update the list of users for a user group. )
22
22
  g.command 'update' do |c|
23
- c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
24
- c.flag 'users', desc: 'A comma separated string of encoded user IDs that represent the entire list of users for the User Group.'
25
- c.flag 'include_count', desc: 'Include the number of users in the User Group.'
23
+ c.flag 'usergroup', desc: 'The encoded ID of the user group to update.'
24
+ c.flag 'users', desc: 'A comma separated string of encoded user IDs that represent the entire list of users for the user group.'
25
+ c.flag 'include_count', desc: 'Include the number of users in the user group.'
26
26
  c.flag 'team_id', desc: 'encoded team id where the user group exists, required if org token is used.'
27
27
  c.action do |_global_options, options, _args|
28
28
  puts JSON.dump(@client.usergroups_users_update(options))
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'UsersDiscoverablecontacts methods.'
8
+ command 'users_discoverableContacts' do |g|
9
+ g.desc 'Look up an email address to see if someone is discoverable on Slack'
10
+ g.long_desc %( Look up an email address to see if someone is discoverable on Slack )
11
+ g.command 'lookup' do |c|
12
+ c.flag 'email', desc: '.'
13
+ c.action do |_global_options, options, _args|
14
+ puts JSON.dump(@client.users_discoverableContacts_lookup(options))
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'WorkflowsTriggersPermissions methods.'
8
+ command 'workflows_triggers_permissions' do |g|
9
+ g.desc 'Allows users to run a trigger that has its permission type set to named_entities'
10
+ g.long_desc %( Allows users to run a trigger that has its permission type set to named_entities )
11
+ g.command 'add' do |c|
12
+ c.flag 'trigger_id', desc: 'Encoded ID of the trigger.'
13
+ c.flag 'channel_ids', desc: 'List of encoded channel IDs.'
14
+ c.flag 'org_ids', desc: 'List of encoded organization IDs.'
15
+ c.flag 'team_ids', desc: 'List of encoded workspace IDs.'
16
+ c.flag 'user_ids', desc: 'List of encoded user IDs.'
17
+ c.action do |_global_options, options, _args|
18
+ puts JSON.dump(@client.workflows_triggers_permissions_add(options))
19
+ end
20
+ end
21
+
22
+ g.desc 'Returns the permission type of a trigger and if applicable, includes the entities that have been granted access'
23
+ g.long_desc %( Returns the permission type of a trigger and if applicable, includes the entities that have been granted access )
24
+ g.command 'list' do |c|
25
+ c.flag 'trigger_id', desc: 'Encoded ID of the trigger.'
26
+ c.action do |_global_options, options, _args|
27
+ puts JSON.dump(@client.workflows_triggers_permissions_list(options))
28
+ end
29
+ end
30
+
31
+ g.desc "Revoke an entity's access to a trigger that has its permission type set to named_entities"
32
+ g.long_desc %( Revoke an entity's access to a trigger that has its permission type set to named_entities )
33
+ g.command 'remove' do |c|
34
+ c.flag 'trigger_id', desc: 'Encoded ID of the trigger.'
35
+ c.flag 'channel_ids', desc: 'List of encoded channel IDs.'
36
+ c.flag 'org_ids', desc: 'List of encoded organization IDs.'
37
+ c.flag 'team_ids', desc: 'List of encoded workspace IDs.'
38
+ c.flag 'user_ids', desc: 'List of encoded user IDs.'
39
+ c.action do |_global_options, options, _args|
40
+ puts JSON.dump(@client.workflows_triggers_permissions_remove(options))
41
+ end
42
+ end
43
+
44
+ g.desc 'Set the permission type for who can run a trigger'
45
+ g.long_desc %( Set the permission type for who can run a trigger )
46
+ g.command 'set' do |c|
47
+ c.flag 'permission_type', desc: 'The type of permission that defines who can run a trigger.'
48
+ c.flag 'trigger_id', desc: 'Encoded ID of the trigger.'
49
+ c.flag 'channel_ids', desc: 'List of encoded channel IDs.'
50
+ c.flag 'org_ids', desc: 'List of encoded organization IDs.'
51
+ c.flag 'team_ids', desc: 'List of encoded workspace IDs.'
52
+ c.flag 'user_ids', desc: 'List of encoded user IDs.'
53
+ c.action do |_global_options, options, _args|
54
+ puts JSON.dump(@client.workflows_triggers_permissions_set(options))
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -38,8 +38,10 @@ module Slack
38
38
  # Request body.
39
39
  def body
40
40
  @body ||= begin
41
- body = http_request.body.read
42
- http_request.body.rewind
41
+ input = http_request.body
42
+ input.rewind
43
+ body = input.read
44
+ input.rewind
43
45
  body
44
46
  end
45
47
  end
@@ -68,6 +68,19 @@ module Slack
68
68
  def url_link(text, url)
69
69
  "<#{url}|#{text}>"
70
70
  end
71
+
72
+ #
73
+ # Converts text from basic markdown into Slack's mishmash
74
+ # @see https://api.slack.com/reference/surfaces/formatting#basic-formatting
75
+ #
76
+ def markdown(text)
77
+ text
78
+ .gsub(/(?<!\*)\*([^*]+)\*(?!\*)/, '_\1_') # italic
79
+ .gsub(/\*\*\*(.*?)\*\*\*/, '*_\1_*') # bold & italic
80
+ .gsub(/\*\*(.*?)\*\*/, '*\1*') # bold
81
+ .gsub(/~~(.*?)~~/, '~\1~') # strikethrough
82
+ .gsub(/\[(.*?)\]\((.*?)\)/, '<\2|\1>') # links
83
+ end
71
84
  end
72
85
  end
73
86
  end
data/lib/slack/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Slack
3
- VERSION = '2.2.0'
3
+ VERSION = '2.4.0'
4
4
  end
@@ -12,9 +12,9 @@ module Slack
12
12
  # @option options [Object] :app_id
13
13
  # The ID of the app to get activities from.
14
14
  # @option options [string] :component_id
15
- # The component ID of log events to be returned. Will be 'FnXXXXXX' for functions, and 'WfXXXXXX' for worflows.
15
+ # The component ID of log events to be returned. Will be FnXXXXXX for functions, and WfXXXXXX for worflows.
16
16
  # @option options [string] :component_type
17
- # The component type of log events to be returned. Acceptable values are ('events_api', 'workflows', 'functions', 'tables').
17
+ # The component type of log events to be returned. Acceptable values are events_api, workflows, functions and tables.
18
18
  # @option options [string] :cursor
19
19
  # 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.
20
20
  # @option options [integer] :limit
@@ -26,11 +26,11 @@ module Slack
26
26
  # @option options [integer] :min_date_created
27
27
  # The earliest timestamp of the log to retrieve (epoch microseconds).
28
28
  # @option options [string] :min_log_level
29
- # The minimum log level of the log events to be returned. Defaults to 'info'. Acceptable values (in order of relative importance from smallest to largest) are ('trace', 'debug', 'info', 'warn', 'error', 'fatal').
30
- # @option options [string] :sort_direction
29
+ # The minimum log level of the log events to be returned. Defaults to info. Acceptable values (in order of relative importance from smallest to largest) are trace, debug, info, warn, error and fatal.
30
+ # @option options [enum] :sort_direction
31
31
  # The direction you want the data sorted by (always by timestamp).
32
32
  # @option options [string] :source
33
- # The source of log events to be returned. Acceptable values are ('slack', 'developer').
33
+ # The source of log events to be returned. Acceptable values are slack and developer.
34
34
  # @option options [string] :team_id
35
35
  # The team who owns this log.
36
36
  # @option options [string] :trace_id
@@ -24,9 +24,9 @@ module Slack
24
24
  # @option options [Object] :app_id
25
25
  # The encoded app ID to set the app config for.
26
26
  # @option options [object] :domain_restrictions
27
- # Domain restrictions for the app.
28
- # @option options [string] :workflow_auth_strategy
29
- # The workflow auth permission.
27
+ # Domain restrictions for the app. Should be an object with two properties: urls and emails. Each is an array of strings, and each sets the allowed URLs and emails for connector authorization, respectively.
28
+ # @option options [enum] :workflow_auth_strategy
29
+ # The workflow auth permission. Can be one of builder_choice or end_user_only.
30
30
  # @see https://api.slack.com/methods/admin.apps.config.set
31
31
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.apps.config/admin.apps.config.set.json
32
32
  def admin_apps_config_set(options = {})
@@ -22,7 +22,7 @@ module Slack
22
22
  # Archive public or private channels in bulk.
23
23
  #
24
24
  # @option options [array] :channel_ids
25
- # An array of channel IDs to archive.
25
+ # An array of channel IDs to archive. No more than 100 items are allowed.
26
26
  # @see https://api.slack.com/methods/admin.conversations.bulkArchive
27
27
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.bulkArchive.json
28
28
  def admin_conversations_bulkArchive(options = {})
@@ -264,6 +264,8 @@ module Slack
264
264
  # Sort direction. Possible values are asc for ascending order like (1, 2, 3) or (a, b, c), and desc for descending order like (3, 2, 1) or (c, b, a).
265
265
  # @option options [array] :team_ids
266
266
  # Comma separated string of team IDs, signifying the internal workspaces to search through.
267
+ # @option options [boolean] :total_count_only
268
+ # Only return the total_count of channels. Omits channel data and allows access for admins without channel manager permissions.
267
269
  # @see https://api.slack.com/methods/admin.conversations.search
268
270
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.search.json
269
271
  def admin_conversations_search(options = {})
@@ -10,7 +10,7 @@ module Slack
10
10
  # Add an emoji.
11
11
  #
12
12
  # @option options [string] :name
13
- # The name of the emoji to be added. Colons (:myemoji:) around the value are not required, although they may be included.
13
+ # The name of the emoji to be added (using lower-case letters only). Colons (:myemoji:) around the value are not required, although they may be included.
14
14
  # @option options [string] :url
15
15
  # The URL of a file to use as an image for the emoji. Square images under 128KB and with transparent backgrounds work best.
16
16
  # @see https://api.slack.com/methods/admin.emoji.add
@@ -23,7 +23,7 @@ module Slack
23
23
  #
24
24
  # @option options [string] :function_id
25
25
  # The function ID to set permissions for.
26
- # @option options [string] :visibility
26
+ # @option options [enum] :visibility
27
27
  # The function visibility.
28
28
  # @option options [array] :user_ids
29
29
  # List of user IDs to allow for named_entities visibility.
@@ -64,6 +64,10 @@ module Slack
64
64
  #
65
65
  # @option options [string] :cursor
66
66
  # Set cursor to next_cursor returned by the previous call to list items in the next page.
67
+ # @option options [boolean] :include_deactivated_user_workspaces
68
+ # Only applies with org token and no team_id. If true, return workspaces for a user even if they may be deactivated on them. If false, return workspaces for a user only when user is active on them. Default is false.
69
+ # @option options [boolean] :is_active
70
+ # If true, only active users will be returned. If false, only deactivated users will be returned. Default is true.
67
71
  # @option options [integer] :limit
68
72
  # Limit for how many users to be retrieved per page.
69
73
  # @option options [Object] :team_id
@@ -96,7 +100,7 @@ module Slack
96
100
  end
97
101
 
98
102
  #
99
- # Set an existing guest, regular user, or owner to be an admin user.
103
+ # Set an existing regular user or owner to be a workspace admin.
100
104
  #
101
105
  # @option options [Object] :team_id
102
106
  # The ID (T1234) of the workspace.
@@ -128,7 +132,7 @@ module Slack
128
132
  end
129
133
 
130
134
  #
131
- # Set an existing guest, regular user, or admin user to be a workspace owner.
135
+ # Set an existing regular user or admin to be a workspace owner.
132
136
  #
133
137
  # @option options [Object] :team_id
134
138
  # The ID (T1234) of the workspace.
@@ -12,23 +12,27 @@ module Slack
12
12
  # @option options [Object] :app_id
13
13
  # The parent app ID for which to return workflows.
14
14
  # @option options [array] :collaborator_ids
15
- # Only include workflows by the collaborators inputted.
15
+ # Only include workflows where the provided user IDs are a manager/collaborator of that workflow.
16
16
  # @option options [string] :cursor
17
17
  # Set cursor to next_cursor returned by the previous call to list items in the next page.
18
+ # @option options [boolean] :is_sales_elevate
19
+ # Filter workflows by their Sales Elevate status.
18
20
  # @option options [integer] :limit
19
21
  # The number of results that will be returned by the API on each invocation.
20
22
  # @option options [boolean] :no_collaborators
21
23
  # Only include workflows with no collaborators in the result; default is false.
22
24
  # @option options [integer] :num_trigger_ids
23
- # Number of trigger IDs to fetch for each workflow; default is 0.
25
+ # Number of trigger IDs to fetch for each workflow; default is 10.
24
26
  # @option options [string] :query
25
27
  # A search query to filter for workflow name or description.
26
- # @option options [string] :sort
28
+ # @option options [enum] :sort
27
29
  # The field used to sort the returned workflows.
28
- # @option options [string] :sort_dir
30
+ # @option options [enum] :sort_dir
29
31
  # Sort direction. Possible values are asc for ascending order like (1, 2, 3) or (a, b, c), and desc for descending order like (3, 2, 1) or (c, b, a).
30
- # @option options [string] :source
32
+ # @option options [enum] :source
31
33
  # Source of workflow creation, either from code or workflow builder.
34
+ # @option options [string] :trigger_type_id
35
+ # Only include workflows with this trigger type.
32
36
  # @see https://api.slack.com/methods/admin.workflows.search
33
37
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.workflows/admin.workflows.search.json
34
38
  def admin_workflows_search(options = {})