From 2205d5a155957e397e0f7047d06ff498cfe85eff Mon Sep 17 00:00:00 2001 From: slack-ruby-ci-bot Date: Thu, 14 Sep 2023 23:19:39 +0000 Subject: [PATCH] Update API from slack-api-ref@f2e768a (2023-09-14) --- bin/commands/admin_apps_activities.rb | 6 +- bin/commands/admin_apps_config.rb | 31 ++++++++++ bin/commands/admin_functions.rb | 23 ++++++++ bin/commands/admin_functions_permissions.rb | 31 ++++++++++ bin/commands/admin_teams.rb | 2 +- bin/commands/admin_users.rb | 2 +- bin/commands/admin_workflows.rb | 38 ++++++++++++ bin/commands/admin_workflows_collaborators.rb | 31 ++++++++++ bin/commands/admin_workflows_permissions.rb | 21 +++++++ bin/commands/dnd.rb | 2 +- lib/slack/web/api/endpoints.rb | 12 ++++ .../api/endpoints/admin_apps_activities.rb | 6 +- .../web/api/endpoints/admin_apps_config.rb | 40 +++++++++++++ .../web/api/endpoints/admin_functions.rb | 36 +++++++++++ .../endpoints/admin_functions_permissions.rb | 41 +++++++++++++ lib/slack/web/api/endpoints/admin_teams.rb | 2 +- lib/slack/web/api/endpoints/admin_users.rb | 2 +- .../web/api/endpoints/admin_workflows.rb | 59 +++++++++++++++++++ .../admin_workflows_collaborators.rb | 42 +++++++++++++ .../endpoints/admin_workflows_permissions.rb | 26 ++++++++ lib/slack/web/api/endpoints/dnd.rb | 2 +- lib/slack/web/api/errors.rb | 20 +++++++ lib/slack/web/api/slack-api-ref | 2 +- .../api/endpoints/admin_apps_config_spec.rb | 18 ++++++ .../admin_functions_permissions_spec.rb | 21 +++++++ .../web/api/endpoints/admin_functions_spec.rb | 13 ++++ .../admin_workflows_collaborators_spec.rb | 24 ++++++++ .../admin_workflows_permissions_spec.rb | 13 ++++ .../web/api/endpoints/admin_workflows_spec.rb | 13 ++++ 29 files changed, 566 insertions(+), 13 deletions(-) create mode 100644 bin/commands/admin_apps_config.rb create mode 100644 bin/commands/admin_functions.rb create mode 100644 bin/commands/admin_functions_permissions.rb create mode 100644 bin/commands/admin_workflows.rb create mode 100644 bin/commands/admin_workflows_collaborators.rb create mode 100644 bin/commands/admin_workflows_permissions.rb create mode 100644 lib/slack/web/api/endpoints/admin_apps_config.rb create mode 100644 lib/slack/web/api/endpoints/admin_functions.rb create mode 100644 lib/slack/web/api/endpoints/admin_functions_permissions.rb create mode 100644 lib/slack/web/api/endpoints/admin_workflows.rb create mode 100644 lib/slack/web/api/endpoints/admin_workflows_collaborators.rb create mode 100644 lib/slack/web/api/endpoints/admin_workflows_permissions.rb create mode 100644 spec/slack/web/api/endpoints/admin_apps_config_spec.rb create mode 100644 spec/slack/web/api/endpoints/admin_functions_permissions_spec.rb create mode 100644 spec/slack/web/api/endpoints/admin_functions_spec.rb create mode 100644 spec/slack/web/api/endpoints/admin_workflows_collaborators_spec.rb create mode 100644 spec/slack/web/api/endpoints/admin_workflows_permissions_spec.rb create mode 100644 spec/slack/web/api/endpoints/admin_workflows_spec.rb diff --git a/bin/commands/admin_apps_activities.rb b/bin/commands/admin_apps_activities.rb index 65cd0e18..4a4da63a 100644 --- a/bin/commands/admin_apps_activities.rb +++ b/bin/commands/admin_apps_activities.rb @@ -9,8 +9,8 @@ class App g.desc 'Get logs for a specified team/org' g.long_desc %( Get logs for a specified team/org ) g.command 'list' do |c| - c.flag 'app_id', desc: 'The id of the app to get activities from.' - c.flag 'component_id', desc: "The component id of log events to be returned. Will be 'FnXXXXXX' for functions, and 'WfXXXXXX' for worflows." + c.flag 'app_id', desc: 'The ID of the app to get activities from.' + c.flag 'component_id', desc: "The component ID of log events to be returned. Will be 'FnXXXXXX' for functions, and 'WfXXXXXX' for worflows." c.flag 'component_type', desc: "The component type of log events to be returned. Acceptable values are ('events_api', 'workflows', 'functions', 'tables')." 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. See pagination for more detail." c.flag 'limit', desc: 'The maximum number of items to return.' @@ -21,7 +21,7 @@ class App c.flag 'sort_direction', desc: 'The direction you want the data sorted by (always by timestamp).' c.flag 'source', desc: "The source of log events to be returned. Acceptable values are ('slack', 'developer')." c.flag 'team_id', desc: 'The team who owns this log.' - c.flag 'trace_id', desc: 'The trace id of log events to be returned.' + c.flag 'trace_id', desc: 'The trace ID of log events to be returned.' c.action do |_global_options, options, _args| puts JSON.dump(@client.admin_apps_activities_list(options)) end diff --git a/bin/commands/admin_apps_config.rb b/bin/commands/admin_apps_config.rb new file mode 100644 index 00000000..dd6b912f --- /dev/null +++ b/bin/commands/admin_apps_config.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Cli + class App + desc 'AdminAppsConfig methods.' + command 'admin_apps_config' do |g| + g.desc 'Look up the app config for connectors by their IDs' + g.long_desc %( Look up the app config for connectors by their IDs ) + g.command 'lookup' do |c| + c.flag 'app_ids', desc: 'An array of app IDs to get app configs for.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_apps_config_lookup(options)) + end + end + + g.desc 'Set the app config for a connector' + g.long_desc %( Set the app config for a connector ) + g.command 'set' do |c| + c.flag 'app_id', desc: 'The encoded app ID to set the app config for.' + c.flag 'domain_restrictions', desc: 'Domain restrictions for the app.' + c.flag 'workflow_auth_strategy', desc: 'The workflow auth permission.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_apps_config_set(options)) + end + end + end + end + end +end diff --git a/bin/commands/admin_functions.rb b/bin/commands/admin_functions.rb new file mode 100644 index 00000000..98d0edbe --- /dev/null +++ b/bin/commands/admin_functions.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Cli + class App + desc 'AdminFunctions methods.' + command 'admin_functions' do |g| + g.desc 'Look up functions by a set of apps' + g.long_desc %( Look up functions by a set of apps ) + g.command 'list' do |c| + c.flag 'app_ids', desc: 'Comma-separated array of app IDs to get functions for; max 50.' + c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.' + c.flag 'limit', desc: 'The number of results that will be returned by the API on each invocation. Must be between 1 and 1000, both inclusive.' + c.flag 'team_id', desc: 'The team context to retrieve functions from.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_functions_list(options)) + end + end + end + end + end +end diff --git a/bin/commands/admin_functions_permissions.rb b/bin/commands/admin_functions_permissions.rb new file mode 100644 index 00000000..7f4ea3fd --- /dev/null +++ b/bin/commands/admin_functions_permissions.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Cli + class App + desc 'AdminFunctionsPermissions methods.' + command 'admin_functions_permissions' do |g| + g.desc 'Lookup the visibility of multiple Slack functions and include the users if it is limited to particular named entities.' + g.long_desc %( Lookup the visibility of multiple Slack functions and include the users if it is limited to particular named entities. ) + g.command 'lookup' do |c| + c.flag 'function_ids', desc: 'An array of function IDs to get permissions for.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_functions_permissions_lookup(options)) + end + end + + g.desc 'Set the visibility of a Slack function and define the users or workspaces if it is set to named_entities' + g.long_desc %( Set the visibility of a Slack function and define the users or workspaces if it is set to named_entities ) + g.command 'set' do |c| + c.flag 'function_id', desc: 'The function ID to set permissions for.' + c.flag 'visibility', desc: 'The function visibility.' + c.flag 'user_ids', desc: 'List of user IDs to allow for named_entities visibility.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_functions_permissions_set(options)) + end + end + end + end + end +end diff --git a/bin/commands/admin_teams.rb b/bin/commands/admin_teams.rb index 654c3860..bcb9ef82 100644 --- a/bin/commands/admin_teams.rb +++ b/bin/commands/admin_teams.rb @@ -22,7 +22,7 @@ class App g.long_desc %( List all teams on an Enterprise organization ) g.command 'list' do |c| c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.' - c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 100 both inclusive.' + c.flag 'limit', desc: 'The maximum number of items to return. Must be a positive integer no larger than 1000.' c.action do |_global_options, options, _args| puts JSON.dump(@client.admin_teams_list(options)) end diff --git a/bin/commands/admin_users.rb b/bin/commands/admin_users.rb index 4515cbbb..a3a50ec1 100644 --- a/bin/commands/admin_users.rb +++ b/bin/commands/admin_users.rb @@ -71,7 +71,7 @@ class App g.desc 'Set an expiration for a guest user' g.long_desc %( Set an expiration for a guest user ) g.command 'setExpiration' do |c| - c.flag 'expiration_ts', desc: 'Timestamp when guest account should be disabled.' + c.flag 'expiration_ts', desc: 'Epoch timestamp in seconds when guest account should be disabled.' c.flag 'user_id', desc: 'The ID of the user to set an expiration for.' c.flag 'team_id', desc: 'The ID (T1234) of the workspace.' c.action do |_global_options, options, _args| diff --git a/bin/commands/admin_workflows.rb b/bin/commands/admin_workflows.rb new file mode 100644 index 00000000..71d5dc8e --- /dev/null +++ b/bin/commands/admin_workflows.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Cli + class App + desc 'AdminWorkflows methods.' + command 'admin_workflows' do |g| + g.desc 'Search workflows within the team or enterprise' + g.long_desc %( Search workflows within the team or enterprise ) + g.command 'search' do |c| + c.flag 'app_id', desc: 'The parent app ID for which to return workflows.' + c.flag 'collaborator_ids', desc: 'Only include workflows by the collaborators inputted.' + c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.' + c.flag 'limit', desc: 'The number of results that will be returned by the API on each invocation.' + c.flag 'no_collaborators', desc: 'Only include workflows with no collaborators in the result; default is false.' + c.flag 'num_trigger_ids', desc: 'Number of trigger IDs to fetch for each workflow; default is 0.' + c.flag 'query', desc: 'A search query to filter for workflow name or description.' + c.flag 'sort', desc: 'The field used to sort the returned workflows.' + c.flag 'sort_dir', desc: '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).' + c.flag 'source', desc: 'Source of workflow creation, either from code or workflow builder.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_workflows_search(options)) + end + end + + g.desc 'Unpublish workflows within the team or enterprise' + g.long_desc %( Unpublish workflows within the team or enterprise ) + g.command 'unpublish' do |c| + c.flag 'workflow_ids', desc: 'Array of workflow IDs to unpublish.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_workflows_unpublish(options)) + end + end + end + end + end +end diff --git a/bin/commands/admin_workflows_collaborators.rb b/bin/commands/admin_workflows_collaborators.rb new file mode 100644 index 00000000..aa54c23e --- /dev/null +++ b/bin/commands/admin_workflows_collaborators.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Cli + class App + desc 'AdminWorkflowsCollaborators methods.' + command 'admin_workflows_collaborators' do |g| + g.desc 'Add collaborators to workflows within the team or enterprise' + g.long_desc %( Add collaborators to workflows within the team or enterprise ) + g.command 'add' do |c| + c.flag 'collaborator_ids', desc: 'Array of collaborators (encoded user IDs) to add; max 50.' + c.flag 'workflow_ids', desc: 'Array of workflow IDs to edit; max 50.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_workflows_collaborators_add(options)) + end + end + + g.desc 'Remove collaborators from workflows within the team or enterprise' + g.long_desc %( Remove collaborators from workflows within the team or enterprise ) + g.command 'remove' do |c| + c.flag 'collaborator_ids', desc: 'Array of collaborators (encoded user IDs) to remove; max 50.' + c.flag 'workflow_ids', desc: 'Array of workflow IDs to edit; max 50.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_workflows_collaborators_remove(options)) + end + end + end + end + end +end diff --git a/bin/commands/admin_workflows_permissions.rb b/bin/commands/admin_workflows_permissions.rb new file mode 100644 index 00000000..982c3c6a --- /dev/null +++ b/bin/commands/admin_workflows_permissions.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Cli + class App + desc 'AdminWorkflowsPermissions methods.' + command 'admin_workflows_permissions' do |g| + g.desc 'Look up the permissions for a set of workflows' + g.long_desc %( Look up the permissions for a set of workflows ) + g.command 'lookup' do |c| + c.flag 'workflow_ids', desc: 'An array of workflow IDs to look up permissions for.' + c.flag 'max_workflow_triggers', desc: 'Maximum number of triggers to fetch for each workflow when determining overall run permissions; max 1000.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_workflows_permissions_lookup(options)) + end + end + end + end + end +end diff --git a/bin/commands/dnd.rb b/bin/commands/dnd.rb index 41f904a6..6c00aaa0 100644 --- a/bin/commands/dnd.rb +++ b/bin/commands/dnd.rb @@ -35,7 +35,7 @@ class App g.desc 'Turns on Do Not Disturb mode for the current user, or changes its duration.' g.long_desc %( Turns on Do Not Disturb mode for the current user, or changes its duration. ) g.command 'setSnooze' do |c| - c.flag 'num_minutes', desc: 'Number of minutes, from now, to snooze until.' + c.flag 'num_minutes', desc: 'This argument is required. Number of minutes, from now, to snooze until.' c.action do |_global_options, options, _args| puts JSON.dump(@client.dnd_setSnooze(options)) end diff --git a/lib/slack/web/api/endpoints.rb b/lib/slack/web/api/endpoints.rb index e49387a7..47bf6af0 100644 --- a/lib/slack/web/api/endpoints.rb +++ b/lib/slack/web/api/endpoints.rb @@ -5,6 +5,7 @@ require_relative 'endpoints/admin_apps' require_relative 'endpoints/admin_apps_activities' require_relative 'endpoints/admin_apps_approved' +require_relative 'endpoints/admin_apps_config' require_relative 'endpoints/admin_apps_requests' require_relative 'endpoints/admin_apps_restricted' require_relative 'endpoints/admin_audit_anomaly_allow' @@ -14,6 +15,8 @@ require_relative 'endpoints/admin_conversations_ekm' require_relative 'endpoints/admin_conversations_restrictAccess' require_relative 'endpoints/admin_emoji' +require_relative 'endpoints/admin_functions' +require_relative 'endpoints/admin_functions_permissions' require_relative 'endpoints/admin_inviteRequests' require_relative 'endpoints/admin_inviteRequests_approved' require_relative 'endpoints/admin_inviteRequests_denied' @@ -26,6 +29,9 @@ require_relative 'endpoints/admin_users' require_relative 'endpoints/admin_users_session' require_relative 'endpoints/admin_users_unsupportedVersions' +require_relative 'endpoints/admin_workflows' +require_relative 'endpoints/admin_workflows_collaborators' +require_relative 'endpoints/admin_workflows_permissions' require_relative 'endpoints/api' require_relative 'endpoints/apps' require_relative 'endpoints/apps_activities' @@ -86,6 +92,7 @@ module Endpoints include AdminApps include AdminAppsActivities include AdminAppsApproved + include AdminAppsConfig include AdminAppsRequests include AdminAppsRestricted include AdminAuditAnomalyAllow @@ -95,6 +102,8 @@ module Endpoints include AdminConversationsEkm include AdminConversationsRestrictaccess include AdminEmoji + include AdminFunctions + include AdminFunctionsPermissions include AdminInviterequests include AdminInviterequestsApproved include AdminInviterequestsDenied @@ -107,6 +116,9 @@ module Endpoints include AdminUsers include AdminUsersSession include AdminUsersUnsupportedversions + include AdminWorkflows + include AdminWorkflowsCollaborators + include AdminWorkflowsPermissions include Api include Apps include AppsActivities diff --git a/lib/slack/web/api/endpoints/admin_apps_activities.rb b/lib/slack/web/api/endpoints/admin_apps_activities.rb index fb9909b4..99f9870e 100644 --- a/lib/slack/web/api/endpoints/admin_apps_activities.rb +++ b/lib/slack/web/api/endpoints/admin_apps_activities.rb @@ -10,9 +10,9 @@ module AdminAppsActivities # Get logs for a specified team/org # # @option options [Object] :app_id - # The id of the app to get activities from. + # The ID of the app to get activities from. # @option options [string] :component_id - # The component id of log events to be returned. Will be 'FnXXXXXX' for functions, and 'WfXXXXXX' for worflows. + # The component ID of log events to be returned. Will be 'FnXXXXXX' for functions, and 'WfXXXXXX' for worflows. # @option options [string] :component_type # The component type of log events to be returned. Acceptable values are ('events_api', 'workflows', 'functions', 'tables'). # @option options [string] :cursor @@ -34,7 +34,7 @@ module AdminAppsActivities # @option options [string] :team_id # The team who owns this log. # @option options [string] :trace_id - # The trace id of log events to be returned. + # The trace ID of log events to be returned. # @see https://api.slack.com/methods/admin.apps.activities.list # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.apps.activities/admin.apps.activities.list.json def admin_apps_activities_list(options = {}) diff --git a/lib/slack/web/api/endpoints/admin_apps_config.rb b/lib/slack/web/api/endpoints/admin_apps_config.rb new file mode 100644 index 00000000..a1cb382f --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_apps_config.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AdminAppsConfig + # + # Look up the app config for connectors by their IDs + # + # @option options [array] :app_ids + # An array of app IDs to get app configs for. + # @see https://api.slack.com/methods/admin.apps.config.lookup + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.apps.config/admin.apps.config.lookup.json + def admin_apps_config_lookup(options = {}) + raise ArgumentError, 'Required arguments :app_ids missing' if options[:app_ids].nil? + post('admin.apps.config.lookup', options) + end + + # + # Set the app config for a connector + # + # @option options [Object] :app_id + # The encoded app ID to set the app config for. + # @option options [object] :domain_restrictions + # Domain restrictions for the app. + # @option options [string] :workflow_auth_strategy + # The workflow auth permission. + # @see https://api.slack.com/methods/admin.apps.config.set + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.apps.config/admin.apps.config.set.json + def admin_apps_config_set(options = {}) + raise ArgumentError, 'Required arguments :app_id missing' if options[:app_id].nil? + post('admin.apps.config.set', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_functions.rb b/lib/slack/web/api/endpoints/admin_functions.rb new file mode 100644 index 00000000..82878835 --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_functions.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AdminFunctions + # + # Look up functions by a set of apps + # + # @option options [array] :app_ids + # Comma-separated array of app IDs to get functions for; max 50. + # @option options [string] :cursor + # Set cursor to next_cursor returned by the previous call to list items in the next page. + # @option options [integer] :limit + # The number of results that will be returned by the API on each invocation. Must be between 1 and 1000, both inclusive. + # @option options [Object] :team_id + # The team context to retrieve functions from. + # @see https://api.slack.com/methods/admin.functions.list + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.functions/admin.functions.list.json + def admin_functions_list(options = {}) + raise ArgumentError, 'Required arguments :app_ids missing' if options[:app_ids].nil? + if block_given? + Pagination::Cursor.new(self, :admin_functions_list, options).each do |page| + yield page + end + else + post('admin.functions.list', options) + end + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_functions_permissions.rb b/lib/slack/web/api/endpoints/admin_functions_permissions.rb new file mode 100644 index 00000000..56a06175 --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_functions_permissions.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AdminFunctionsPermissions + # + # Lookup the visibility of multiple Slack functions and include the users if it is limited to particular named entities. + # + # @option options [array] :function_ids + # An array of function IDs to get permissions for. + # @see https://api.slack.com/methods/admin.functions.permissions.lookup + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.functions.permissions/admin.functions.permissions.lookup.json + def admin_functions_permissions_lookup(options = {}) + raise ArgumentError, 'Required arguments :function_ids missing' if options[:function_ids].nil? + post('admin.functions.permissions.lookup', options) + end + + # + # Set the visibility of a Slack function and define the users or workspaces if it is set to named_entities + # + # @option options [string] :function_id + # The function ID to set permissions for. + # @option options [string] :visibility + # The function visibility. + # @option options [array] :user_ids + # List of user IDs to allow for named_entities visibility. + # @see https://api.slack.com/methods/admin.functions.permissions.set + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.functions.permissions/admin.functions.permissions.set.json + def admin_functions_permissions_set(options = {}) + raise ArgumentError, 'Required arguments :function_id missing' if options[:function_id].nil? + raise ArgumentError, 'Required arguments :visibility missing' if options[:visibility].nil? + post('admin.functions.permissions.set', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_teams.rb b/lib/slack/web/api/endpoints/admin_teams.rb index 93d68e4e..bb363204 100644 --- a/lib/slack/web/api/endpoints/admin_teams.rb +++ b/lib/slack/web/api/endpoints/admin_teams.rb @@ -31,7 +31,7 @@ def admin_teams_create(options = {}) # @option options [string] :cursor # Set cursor to next_cursor returned by the previous call to list items in the next page. # @option options [integer] :limit - # The maximum number of items to return. Must be between 1 - 100 both inclusive. + # The maximum number of items to return. Must be a positive integer no larger than 1000. # @see https://api.slack.com/methods/admin.teams.list # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.teams/admin.teams.list.json def admin_teams_list(options = {}) diff --git a/lib/slack/web/api/endpoints/admin_users.rb b/lib/slack/web/api/endpoints/admin_users.rb index b5f2eaad..7ff147b6 100644 --- a/lib/slack/web/api/endpoints/admin_users.rb +++ b/lib/slack/web/api/endpoints/admin_users.rb @@ -114,7 +114,7 @@ def admin_users_setAdmin(options = {}) # Set an expiration for a guest user # # @option options [integer] :expiration_ts - # Timestamp when guest account should be disabled. + # Epoch timestamp in seconds when guest account should be disabled. # @option options [string] :user_id # The ID of the user to set an expiration for. # @option options [Object] :team_id diff --git a/lib/slack/web/api/endpoints/admin_workflows.rb b/lib/slack/web/api/endpoints/admin_workflows.rb new file mode 100644 index 00000000..7ebd1338 --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_workflows.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AdminWorkflows + # + # Search workflows within the team or enterprise + # + # @option options [Object] :app_id + # The parent app ID for which to return workflows. + # @option options [array] :collaborator_ids + # Only include workflows by the collaborators inputted. + # @option options [string] :cursor + # Set cursor to next_cursor returned by the previous call to list items in the next page. + # @option options [integer] :limit + # The number of results that will be returned by the API on each invocation. + # @option options [boolean] :no_collaborators + # Only include workflows with no collaborators in the result; default is false. + # @option options [integer] :num_trigger_ids + # Number of trigger IDs to fetch for each workflow; default is 0. + # @option options [string] :query + # A search query to filter for workflow name or description. + # @option options [string] :sort + # The field used to sort the returned workflows. + # @option options [string] :sort_dir + # 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). + # @option options [string] :source + # Source of workflow creation, either from code or workflow builder. + # @see https://api.slack.com/methods/admin.workflows.search + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.workflows/admin.workflows.search.json + def admin_workflows_search(options = {}) + if block_given? + Pagination::Cursor.new(self, :admin_workflows_search, options).each do |page| + yield page + end + else + post('admin.workflows.search', options) + end + end + + # + # Unpublish workflows within the team or enterprise + # + # @option options [array] :workflow_ids + # Array of workflow IDs to unpublish. + # @see https://api.slack.com/methods/admin.workflows.unpublish + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.workflows/admin.workflows.unpublish.json + def admin_workflows_unpublish(options = {}) + raise ArgumentError, 'Required arguments :workflow_ids missing' if options[:workflow_ids].nil? + post('admin.workflows.unpublish', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_workflows_collaborators.rb b/lib/slack/web/api/endpoints/admin_workflows_collaborators.rb new file mode 100644 index 00000000..9dd42f3b --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_workflows_collaborators.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AdminWorkflowsCollaborators + # + # Add collaborators to workflows within the team or enterprise + # + # @option options [array] :collaborator_ids + # Array of collaborators (encoded user IDs) to add; max 50. + # @option options [array] :workflow_ids + # Array of workflow IDs to edit; max 50. + # @see https://api.slack.com/methods/admin.workflows.collaborators.add + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.workflows.collaborators/admin.workflows.collaborators.add.json + def admin_workflows_collaborators_add(options = {}) + raise ArgumentError, 'Required arguments :collaborator_ids missing' if options[:collaborator_ids].nil? + raise ArgumentError, 'Required arguments :workflow_ids missing' if options[:workflow_ids].nil? + post('admin.workflows.collaborators.add', options) + end + + # + # Remove collaborators from workflows within the team or enterprise + # + # @option options [array] :collaborator_ids + # Array of collaborators (encoded user IDs) to remove; max 50. + # @option options [array] :workflow_ids + # Array of workflow IDs to edit; max 50. + # @see https://api.slack.com/methods/admin.workflows.collaborators.remove + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.workflows.collaborators/admin.workflows.collaborators.remove.json + def admin_workflows_collaborators_remove(options = {}) + raise ArgumentError, 'Required arguments :collaborator_ids missing' if options[:collaborator_ids].nil? + raise ArgumentError, 'Required arguments :workflow_ids missing' if options[:workflow_ids].nil? + post('admin.workflows.collaborators.remove', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_workflows_permissions.rb b/lib/slack/web/api/endpoints/admin_workflows_permissions.rb new file mode 100644 index 00000000..6224b8b2 --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_workflows_permissions.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AdminWorkflowsPermissions + # + # Look up the permissions for a set of workflows + # + # @option options [array] :workflow_ids + # An array of workflow IDs to look up permissions for. + # @option options [integer] :max_workflow_triggers + # Maximum number of triggers to fetch for each workflow when determining overall run permissions; max 1000. + # @see https://api.slack.com/methods/admin.workflows.permissions.lookup + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.workflows.permissions/admin.workflows.permissions.lookup.json + def admin_workflows_permissions_lookup(options = {}) + raise ArgumentError, 'Required arguments :workflow_ids missing' if options[:workflow_ids].nil? + post('admin.workflows.permissions.lookup', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/dnd.rb b/lib/slack/web/api/endpoints/dnd.rb index 13ed42b8..0b1229d7 100644 --- a/lib/slack/web/api/endpoints/dnd.rb +++ b/lib/slack/web/api/endpoints/dnd.rb @@ -42,7 +42,7 @@ def dnd_info(options = {}) # Turns on Do Not Disturb mode for the current user, or changes its duration. # # @option options [string] :num_minutes - # Number of minutes, from now, to snooze until. + # This argument is required. Number of minutes, from now, to snooze until. # @see https://api.slack.com/methods/dnd.setSnooze # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.setSnooze.json def dnd_setSnooze(options = {}) diff --git a/lib/slack/web/api/errors.rb b/lib/slack/web/api/errors.rb index 34c2306d..b8ede5b7 100644 --- a/lib/slack/web/api/errors.rb +++ b/lib/slack/web/api/errors.rb @@ -159,6 +159,7 @@ class EndpointUnavailable < SlackError; end class EnterpriseIsRestricted < SlackError; end class EnterpriseNotFound < SlackError; end class EntityNotFound < SlackError; end + class ErrorAddingCollaborators < SlackError; end class ErrorBadFormat < SlackError; end class ErrorBadNameI18n < SlackError; end class ErrorBadUpload < SlackError; end @@ -169,7 +170,9 @@ class ErrorMissingName < SlackError; end class ErrorNameTaken < SlackError; end class ErrorNameTakenI18n < SlackError; end class ErrorNoImage < SlackError; end + class ErrorRemovingCollaborators < SlackError; end class ErrorTooBig < SlackError; end + class ErrorUnpublishingWorkflows < SlackError; end class ExchangedTriggerId < SlackError; end class ExpiredTriggerId < SlackError; end class ExternalChannelMigrating < SlackError; end @@ -228,6 +231,7 @@ class FileUploadsDisabled < SlackError; end class ForbiddenHandle < SlackError; end class ForbiddenTeam < SlackError; end class FreeTeamNotAllowed < SlackError; end + class FunctionNotFound < SlackError; end class GroupAlreadyLinkedToChannel < SlackError; end class GroupMustNotBeEmpty < SlackError; end class GroupNotFound < SlackError; end @@ -265,6 +269,7 @@ class InvalidCreatedBy < SlackError; end class InvalidCursor < SlackError; end class InvalidDatastore < SlackError; end class InvalidDate < SlackError; end + class InvalidDomains < SlackError; end class InvalidDuration < SlackError; end class InvalidEmail < SlackError; end class InvalidEmoji < SlackError; end @@ -308,6 +313,7 @@ class InvalidRoleId < SlackError; end class InvalidScheduledMessageId < SlackError; end class InvalidScopes < SlackError; end class InvalidSearchChannelType < SlackError; end + class InvalidSetting < SlackError; end class InvalidSort < SlackError; end class InvalidSortDir < SlackError; end class InvalidSource < SlackError; end @@ -336,6 +342,7 @@ class InvalidUserCombination < SlackError; end class InvalidUserId < SlackError; end class InvalidUsers < SlackError; end class InvalidValue < SlackError; end + class InvalidWorkflowAuthStrategy < SlackError; end class InviteFromSameOrg < SlackError; end class InviteLookupError < SlackError; end class InviteNotFound < SlackError; end @@ -405,6 +412,7 @@ class NoAliasSelected < SlackError; end class NoBotUserForApp < SlackError; end class NoChannel < SlackError; end class NoChannelMemberships < SlackError; end + class NoDomainsProvided < SlackError; end class NoDualBroadcastContentUpdate < SlackError; end class NoImageUploaded < SlackError; end class NoItemSpecified < SlackError; end @@ -543,6 +551,7 @@ class TooManyBookmarks < SlackError; end class TooManyContactCards < SlackError; end class TooManyConvosForAppOnTeam < SlackError; end class TooManyConvosForTeam < SlackError; end + class TooManyDomainsProvided < SlackError; end class TooManyEmails < SlackError; end class TooManyEmoji < SlackError; end class TooManyEntities < SlackError; end @@ -583,6 +592,7 @@ class UnsupportedTeamType < SlackError; end class UpdateFailed < SlackError; end class UraMaxChannels < SlackError; end class UrlInMessage < SlackError; end + class UrlRestrictionNotSupported < SlackError; end class UserAlreadyDeleted < SlackError; end class UserAlreadyTeamMember < SlackError; end class UserCannotCreateChannel < SlackError; end @@ -764,6 +774,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'enterprise_is_restricted' => EnterpriseIsRestricted, 'enterprise_not_found' => EnterpriseNotFound, 'entity_not_found' => EntityNotFound, + 'error_adding_collaborators' => ErrorAddingCollaborators, 'error_bad_format' => ErrorBadFormat, 'error_bad_name_i18n' => ErrorBadNameI18n, 'error_bad_upload' => ErrorBadUpload, @@ -774,7 +785,9 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'error_name_taken' => ErrorNameTaken, 'error_name_taken_i18n' => ErrorNameTakenI18n, 'error_no_image' => ErrorNoImage, + 'error_removing_collaborators' => ErrorRemovingCollaborators, 'error_too_big' => ErrorTooBig, + 'error_unpublishing_workflows' => ErrorUnpublishingWorkflows, 'exchanged_trigger_id' => ExchangedTriggerId, 'expired_trigger_id' => ExpiredTriggerId, 'external_channel_migrating' => ExternalChannelMigrating, @@ -833,6 +846,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'forbidden_handle' => ForbiddenHandle, 'forbidden_team' => ForbiddenTeam, 'free_team_not_allowed' => FreeTeamNotAllowed, + 'function_not_found' => FunctionNotFound, 'group_already_linked_to_channel' => GroupAlreadyLinkedToChannel, 'group_must_not_be_empty' => GroupMustNotBeEmpty, 'group_not_found' => GroupNotFound, @@ -870,6 +884,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invalid_cursor' => InvalidCursor, 'invalid_datastore' => InvalidDatastore, 'invalid_date' => InvalidDate, + 'invalid_domains' => InvalidDomains, 'invalid_duration' => InvalidDuration, 'invalid_email' => InvalidEmail, 'invalid_emoji' => InvalidEmoji, @@ -913,6 +928,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invalid_scheduled_message_id' => InvalidScheduledMessageId, 'invalid_scopes' => InvalidScopes, 'invalid_search_channel_type' => InvalidSearchChannelType, + 'invalid_setting' => InvalidSetting, 'invalid_sort' => InvalidSort, 'invalid_sort_dir' => InvalidSortDir, 'invalid_source' => InvalidSource, @@ -941,6 +957,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invalid_user_id' => InvalidUserId, 'invalid_users' => InvalidUsers, 'invalid_value' => InvalidValue, + 'invalid_workflow_auth_strategy' => InvalidWorkflowAuthStrategy, 'invite_from_same_org' => InviteFromSameOrg, 'invite_lookup_error' => InviteLookupError, 'invite_not_found' => InviteNotFound, @@ -1010,6 +1027,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'no_bot_user_for_app' => NoBotUserForApp, 'no_channel' => NoChannel, 'no_channel_memberships' => NoChannelMemberships, + 'no_domains_provided' => NoDomainsProvided, 'no_dual_broadcast_content_update' => NoDualBroadcastContentUpdate, 'no_image_uploaded' => NoImageUploaded, 'no_item_specified' => NoItemSpecified, @@ -1148,6 +1166,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'too_many_contact_cards' => TooManyContactCards, 'too_many_convos_for_app_on_team' => TooManyConvosForAppOnTeam, 'too_many_convos_for_team' => TooManyConvosForTeam, + 'too_many_domains_provided' => TooManyDomainsProvided, 'too_many_emails' => TooManyEmails, 'too_many_emoji' => TooManyEmoji, 'too_many_entities' => TooManyEntities, @@ -1188,6 +1207,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'update_failed' => UpdateFailed, 'ura_max_channels' => UraMaxChannels, 'url_in_message' => UrlInMessage, + 'url_restriction_not_supported' => UrlRestrictionNotSupported, 'user_already_deleted' => UserAlreadyDeleted, 'user_already_team_member' => UserAlreadyTeamMember, 'user_cannot_create_channel' => UserCannotCreateChannel, diff --git a/lib/slack/web/api/slack-api-ref b/lib/slack/web/api/slack-api-ref index f2e768a8..da66683f 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit f2e768a8c3e1d5106a600ce2414b48e986b7d39a +Subproject commit da66683fe4c9f3586a9e587c869b95aa4bbb5eb7 diff --git a/spec/slack/web/api/endpoints/admin_apps_config_spec.rb b/spec/slack/web/api/endpoints/admin_apps_config_spec.rb new file mode 100644 index 00000000..9ff37e46 --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_apps_config_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::AdminAppsConfig do + let(:client) { Slack::Web::Client.new } + context 'admin.apps.config_lookup' do + it 'requires app_ids' do + expect { client.admin_apps_config_lookup }.to raise_error ArgumentError, /Required arguments :app_ids missing/ + end + end + context 'admin.apps.config_set' do + it 'requires app_id' do + expect { client.admin_apps_config_set }.to raise_error ArgumentError, /Required arguments :app_id missing/ + end + end +end diff --git a/spec/slack/web/api/endpoints/admin_functions_permissions_spec.rb b/spec/slack/web/api/endpoints/admin_functions_permissions_spec.rb new file mode 100644 index 00000000..0209eda4 --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_functions_permissions_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::AdminFunctionsPermissions do + let(:client) { Slack::Web::Client.new } + context 'admin.functions.permissions_lookup' do + it 'requires function_ids' do + expect { client.admin_functions_permissions_lookup }.to raise_error ArgumentError, /Required arguments :function_ids missing/ + end + end + context 'admin.functions.permissions_set' do + it 'requires function_id' do + expect { client.admin_functions_permissions_set(visibility: %q[]) }.to raise_error ArgumentError, /Required arguments :function_id missing/ + end + it 'requires visibility' do + expect { client.admin_functions_permissions_set(function_id: %q[]) }.to raise_error ArgumentError, /Required arguments :visibility missing/ + end + end +end diff --git a/spec/slack/web/api/endpoints/admin_functions_spec.rb b/spec/slack/web/api/endpoints/admin_functions_spec.rb new file mode 100644 index 00000000..6874870c --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_functions_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::AdminFunctions do + let(:client) { Slack::Web::Client.new } + context 'admin.functions_list' do + it 'requires app_ids' do + expect { client.admin_functions_list }.to raise_error ArgumentError, /Required arguments :app_ids missing/ + end + end +end diff --git a/spec/slack/web/api/endpoints/admin_workflows_collaborators_spec.rb b/spec/slack/web/api/endpoints/admin_workflows_collaborators_spec.rb new file mode 100644 index 00000000..fabd131a --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_workflows_collaborators_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::AdminWorkflowsCollaborators do + let(:client) { Slack::Web::Client.new } + context 'admin.workflows.collaborators_add' do + it 'requires collaborator_ids' do + expect { client.admin_workflows_collaborators_add(workflow_ids: %q[]) }.to raise_error ArgumentError, /Required arguments :collaborator_ids missing/ + end + it 'requires workflow_ids' do + expect { client.admin_workflows_collaborators_add(collaborator_ids: %q[]) }.to raise_error ArgumentError, /Required arguments :workflow_ids missing/ + end + end + context 'admin.workflows.collaborators_remove' do + it 'requires collaborator_ids' do + expect { client.admin_workflows_collaborators_remove(workflow_ids: %q[]) }.to raise_error ArgumentError, /Required arguments :collaborator_ids missing/ + end + it 'requires workflow_ids' do + expect { client.admin_workflows_collaborators_remove(collaborator_ids: %q[]) }.to raise_error ArgumentError, /Required arguments :workflow_ids missing/ + end + end +end diff --git a/spec/slack/web/api/endpoints/admin_workflows_permissions_spec.rb b/spec/slack/web/api/endpoints/admin_workflows_permissions_spec.rb new file mode 100644 index 00000000..caeb9480 --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_workflows_permissions_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::AdminWorkflowsPermissions do + let(:client) { Slack::Web::Client.new } + context 'admin.workflows.permissions_lookup' do + it 'requires workflow_ids' do + expect { client.admin_workflows_permissions_lookup }.to raise_error ArgumentError, /Required arguments :workflow_ids missing/ + end + end +end diff --git a/spec/slack/web/api/endpoints/admin_workflows_spec.rb b/spec/slack/web/api/endpoints/admin_workflows_spec.rb new file mode 100644 index 00000000..df694977 --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_workflows_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::AdminWorkflows do + let(:client) { Slack::Web::Client.new } + context 'admin.workflows_unpublish' do + it 'requires workflow_ids' do + expect { client.admin_workflows_unpublish }.to raise_error ArgumentError, /Required arguments :workflow_ids missing/ + end + end +end