diff --git a/CHANGELOG.md b/CHANGELOG.md index f6e6ab2f..69827b6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### 2.3.1 (Next) +* [#509](https://github.com/slack-ruby-client/pulls/509): Update API from [slack-api-ref@8a22e57](https://github.com/slack-ruby/slack-api-ref/commit/8a22e57) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot). * Your contribution here. ### 2.3.0 (2024/01/31) diff --git a/bin/commands/admin_workflows_triggers_types_permissions.rb b/bin/commands/admin_workflows_triggers_types_permissions.rb new file mode 100644 index 00000000..1fe7f0de --- /dev/null +++ b/bin/commands/admin_workflows_triggers_types_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 'AdminWorkflowsTriggersTypesPermissions methods.' + command 'admin_workflows_triggers_types_permissions' do |g| + g.desc 'list the permissions for using each trigger type in workflow builder' + g.long_desc %( list the permissions for using each trigger type in workflow builder ) + g.command 'lookup' do |c| + c.flag 'trigger_type_ids', desc: 'The trigger types IDs for which to get the permissions.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_workflows_triggers_types_permissions_lookup(options)) + end + end + + g.desc 'Set the permissions for using a trigger type in workflow builder' + g.long_desc %( Set the permissions for using a trigger type in workflow builder ) + g.command 'set' do |c| + c.flag 'id', desc: 'The trigger type ID for which to set the permissions.' + 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_workflows_triggers_types_permissions_set(options)) + end + end + end + end + end +end diff --git a/bin/commands/apps_datastore.rb b/bin/commands/apps_datastore.rb index fc1cfcef..ce708fb6 100644 --- a/bin/commands/apps_datastore.rb +++ b/bin/commands/apps_datastore.rb @@ -6,6 +6,39 @@ module Cli class App desc 'AppsDatastore methods.' command 'apps_datastore' do |g| + g.desc 'Delete items from a datastore in bulk' + g.long_desc %( Delete items from a datastore in bulk ) + g.command 'bulkDelete' do |c| + c.flag 'datastore', desc: 'name of the datastore.' + c.flag 'ids', desc: 'IDs of items to be deleted.' + c.flag 'app_id', desc: '.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.apps_datastore_bulkDelete(options)) + end + end + + g.desc 'Get items from a datastore in bulk' + g.long_desc %( Get items from a datastore in bulk ) + g.command 'bulkGet' do |c| + c.flag 'datastore', desc: 'name of the datastore.' + c.flag 'ids', desc: "items' ids." + c.flag 'app_id', desc: '.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.apps_datastore_bulkGet(options)) + end + end + + g.desc 'Creates or replaces existing items in bulk' + g.long_desc %( Creates or replaces existing items in bulk ) + g.command 'bulkPut' do |c| + c.flag 'datastore', desc: 'name of the datastore.' + c.flag 'items', desc: 'attribute names and values of the items.' + c.flag 'app_id', desc: '.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.apps_datastore_bulkPut(options)) + end + end + g.desc 'Delete an item from a datastore' g.long_desc %( Delete an item from a datastore ) g.command 'delete' do |c| diff --git a/bin/commands/oauth.rb b/bin/commands/oauth.rb index 57eda82d..d7b79de7 100644 --- a/bin/commands/oauth.rb +++ b/bin/commands/oauth.rb @@ -9,8 +9,8 @@ class App g.desc 'Exchanges a temporary OAuth verifier code for an access token.' g.long_desc %( Exchanges a temporary OAuth verifier code for an access token. ) g.command 'access' do |c| - c.flag 'client_id', desc: 'Issued when you created your application.' - c.flag 'client_secret', desc: 'Issued when you created your application.' + 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.' + 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.' c.flag 'code', desc: 'The code param returned via the OAuth callback.' c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).' c.flag 'single_channel', desc: 'Request the user to add your app only to a single channel. Only valid with a legacy workspace app.' diff --git a/bin/commands/oauth_v2.rb b/bin/commands/oauth_v2.rb index ff9bb5c9..af40e722 100644 --- a/bin/commands/oauth_v2.rb +++ b/bin/commands/oauth_v2.rb @@ -9,8 +9,8 @@ class App g.desc 'Exchanges a temporary OAuth verifier code for an access token.' g.long_desc %( Exchanges a temporary OAuth verifier code for an access token. ) g.command 'access' do |c| - c.flag 'client_id', desc: 'Issued when you created your application.' - c.flag 'client_secret', desc: 'Issued when you created your application.' + 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.' + 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.' c.flag 'code', desc: 'The code param returned via the OAuth callback.' c.flag 'grant_type', desc: 'The grant_type param as described in the OAuth spec.' c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).' diff --git a/lib/slack/web/api/endpoints.rb b/lib/slack/web/api/endpoints.rb index ca7dfc33..a2bac5f2 100644 --- a/lib/slack/web/api/endpoints.rb +++ b/lib/slack/web/api/endpoints.rb @@ -32,6 +32,7 @@ require_relative 'endpoints/admin_workflows' require_relative 'endpoints/admin_workflows_collaborators' require_relative 'endpoints/admin_workflows_permissions' +require_relative 'endpoints/admin_workflows_triggers_types_permissions' require_relative 'endpoints/api' require_relative 'endpoints/apps' require_relative 'endpoints/apps_activities' @@ -120,6 +121,7 @@ module Endpoints include AdminWorkflows include AdminWorkflowsCollaborators include AdminWorkflowsPermissions + include AdminWorkflowsTriggersTypesPermissions include Api include Apps include AppsActivities diff --git a/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb b/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb new file mode 100644 index 00000000..e613d05b --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_workflows_triggers_types_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 AdminWorkflowsTriggersTypesPermissions + # + # list the permissions for using each trigger type in workflow builder + # + # @option options [array] :trigger_type_ids + # The trigger types IDs for which to get the permissions. + # @see https://api.slack.com/methods/admin.workflows.triggers.types.permissions.lookup + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.workflows.triggers.types.permissions/admin.workflows.triggers.types.permissions.lookup.json + def admin_workflows_triggers_types_permissions_lookup(options = {}) + raise ArgumentError, 'Required arguments :trigger_type_ids missing' if options[:trigger_type_ids].nil? + post('admin.workflows.triggers.types.permissions.lookup', options) + end + + # + # Set the permissions for using a trigger type in workflow builder + # + # @option options [Object] :id + # The trigger type ID for which to set the permissions. + # @option options [enum] :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.workflows.triggers.types.permissions.set + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.workflows.triggers.types.permissions/admin.workflows.triggers.types.permissions.set.json + def admin_workflows_triggers_types_permissions_set(options = {}) + raise ArgumentError, 'Required arguments :id missing' if options[:id].nil? + raise ArgumentError, 'Required arguments :visibility missing' if options[:visibility].nil? + post('admin.workflows.triggers.types.permissions.set', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/apps_datastore.rb b/lib/slack/web/api/endpoints/apps_datastore.rb index bba1df50..a6aaaf2a 100644 --- a/lib/slack/web/api/endpoints/apps_datastore.rb +++ b/lib/slack/web/api/endpoints/apps_datastore.rb @@ -6,6 +6,57 @@ module Web module Api module Endpoints module AppsDatastore + # + # Delete items from a datastore in bulk + # + # @option options [string] :datastore + # name of the datastore. + # @option options [array] :ids + # IDs of items to be deleted. + # @option options [Object] :app_id + # . + # @see https://api.slack.com/methods/apps.datastore.bulkDelete + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.bulkDelete.json + def apps_datastore_bulkDelete(options = {}) + raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil? + raise ArgumentError, 'Required arguments :ids missing' if options[:ids].nil? + post('apps.datastore.bulkDelete', options) + end + + # + # Get items from a datastore in bulk + # + # @option options [string] :datastore + # name of the datastore. + # @option options [array] :ids + # items' ids. + # @option options [Object] :app_id + # . + # @see https://api.slack.com/methods/apps.datastore.bulkGet + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.bulkGet.json + def apps_datastore_bulkGet(options = {}) + raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil? + raise ArgumentError, 'Required arguments :ids missing' if options[:ids].nil? + post('apps.datastore.bulkGet', options) + end + + # + # Creates or replaces existing items in bulk + # + # @option options [string] :datastore + # name of the datastore. + # @option options [array] :items + # attribute names and values of the items. + # @option options [Object] :app_id + # . + # @see https://api.slack.com/methods/apps.datastore.bulkPut + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.bulkPut.json + def apps_datastore_bulkPut(options = {}) + raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil? + raise ArgumentError, 'Required arguments :items missing' if options[:items].nil? + post('apps.datastore.bulkPut', options) + end + # # Delete an item from a datastore # diff --git a/lib/slack/web/api/endpoints/oauth.rb b/lib/slack/web/api/endpoints/oauth.rb index 0106c658..cf1a8083 100644 --- a/lib/slack/web/api/endpoints/oauth.rb +++ b/lib/slack/web/api/endpoints/oauth.rb @@ -10,9 +10,9 @@ module Oauth # Exchanges a temporary OAuth verifier code for an access token. # # @option options [string] :client_id - # Issued when you created your application. + # 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. # @option options [string] :client_secret - # Issued when you created your application. + # 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. # @option options [string] :code # The code param returned via the OAuth callback. # @option options [string] :redirect_uri diff --git a/lib/slack/web/api/endpoints/oauth_v2.rb b/lib/slack/web/api/endpoints/oauth_v2.rb index d666918a..2f1f3f1e 100644 --- a/lib/slack/web/api/endpoints/oauth_v2.rb +++ b/lib/slack/web/api/endpoints/oauth_v2.rb @@ -10,9 +10,9 @@ module OauthV2 # Exchanges a temporary OAuth verifier code for an access token. # # @option options [string] :client_id - # Issued when you created your application. + # 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. # @option options [string] :client_secret - # Issued when you created your application. + # 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. # @option options [string] :code # The code param returned via the OAuth callback. # @option options [string] :grant_type diff --git a/lib/slack/web/api/errors.rb b/lib/slack/web/api/errors.rb index 24aec502..98f1b636 100644 --- a/lib/slack/web/api/errors.rb +++ b/lib/slack/web/api/errors.rb @@ -68,6 +68,7 @@ class CannotCompleteOthers < SlackError; end class CannotCompleteRecurring < SlackError; end class CannotCreateChannel < SlackError; end class CannotCreateDialog < SlackError; end + class CannotFetchVersions < SlackError; end class CannotFindChannel < SlackError; end class CannotFindMessage < SlackError; end class CannotFindService < SlackError; end @@ -184,6 +185,7 @@ class ExternallySharedOrDisconnectedChannel < SlackError; end class FailToGetTeamsForRestrictedUser < SlackError; end class FailedAddingCollaborator < SlackError; end class FailedCreatingApp < SlackError; end + class FailedDatastoreOperation < SlackError; end class FailedExport < SlackError; end class FailedForSomeEntities < SlackError; end class FailedForSomeUsers < SlackError; end @@ -481,6 +483,7 @@ class PaidTeamsOnly < SlackError; end class ParameterValidationFailed < SlackError; end class ParentBookmarkDisabled < SlackError; end class ParentWithLink < SlackError; end + class PartialFailure < SlackError; end class PartialProfileSetFailed < SlackError; end class PermissionDenied < SlackError; end class PlanUpgradeRequired < SlackError; end @@ -575,6 +578,7 @@ class TooManyTeamsProvided < SlackError; end class TooManyUsers < SlackError; end class TriggerExchanged < SlackError; end class TriggerExpired < SlackError; end + class TriggerTypeIdNotFound < SlackError; end class TwoFactorSetupRequired < SlackError; end class UnableToDelete < SlackError; end class UnableToFetchCustomEmojis < SlackError; end @@ -624,6 +628,7 @@ class UsersListNotSupplied < SlackError; end class UsersNotFound < SlackError; end class ValidationErrors < SlackError; end class ViewTooLarge < SlackError; end + class VisibilityIsNotNamedEntities < SlackError; end class WorkflowsExportCsvNotEnabled < SlackError; end ERROR_CLASSES = { @@ -690,6 +695,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'cannot_complete_recurring' => CannotCompleteRecurring, 'cannot_create_channel' => CannotCreateChannel, 'cannot_create_dialog' => CannotCreateDialog, + 'cannot_fetch_versions' => CannotFetchVersions, 'cannot_find_channel' => CannotFindChannel, 'cannot_find_message' => CannotFindMessage, 'cannot_find_service' => CannotFindService, @@ -806,6 +812,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'fail_to_get_teams_for_restricted_user' => FailToGetTeamsForRestrictedUser, 'failed_adding_collaborator' => FailedAddingCollaborator, 'failed_creating_app' => FailedCreatingApp, + 'failed_datastore_operation' => FailedDatastoreOperation, 'failed_export' => FailedExport, 'failed_for_some_entities' => FailedForSomeEntities, 'failed_for_some_users' => FailedForSomeUsers, @@ -1103,6 +1110,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'parameter_validation_failed' => ParameterValidationFailed, 'parent_bookmark_disabled' => ParentBookmarkDisabled, 'parent_with_link' => ParentWithLink, + 'partial_failure' => PartialFailure, 'partial_profile_set_failed' => PartialProfileSetFailed, 'permission_denied' => PermissionDenied, 'plan_upgrade_required' => PlanUpgradeRequired, @@ -1197,6 +1205,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'too_many_users' => TooManyUsers, 'trigger_exchanged' => TriggerExchanged, 'trigger_expired' => TriggerExpired, + 'trigger_type_id_not_found' => TriggerTypeIdNotFound, 'two_factor_setup_required' => TwoFactorSetupRequired, 'unable_to_delete' => UnableToDelete, 'unable_to_fetch_custom_emojis' => UnableToFetchCustomEmojis, @@ -1246,6 +1255,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'users_not_found' => UsersNotFound, 'validation_errors' => ValidationErrors, 'view_too_large' => ViewTooLarge, + 'visibility_is_not_named_entities' => VisibilityIsNotNamedEntities, 'workflows_export_csv_not_enabled' => WorkflowsExportCsvNotEnabled, }.freeze end diff --git a/lib/slack/web/api/slack-api-ref b/lib/slack/web/api/slack-api-ref index 8a22e575..29e19cec 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit 8a22e575eefeb220a5a06426ff7319e6ef46dd42 +Subproject commit 29e19cecf537ba4cebc27b483c06f6f55aa36d36 diff --git a/spec/slack/web/api/endpoints/admin_workflows_triggers_types_permissions_spec.rb b/spec/slack/web/api/endpoints/admin_workflows_triggers_types_permissions_spec.rb new file mode 100644 index 00000000..4dd119a6 --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_workflows_triggers_types_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::AdminWorkflowsTriggersTypesPermissions do + let(:client) { Slack::Web::Client.new } + context 'admin.workflows.triggers.types.permissions_lookup' do + it 'requires trigger_type_ids' do + expect { client.admin_workflows_triggers_types_permissions_lookup }.to raise_error ArgumentError, /Required arguments :trigger_type_ids missing/ + end + end + context 'admin.workflows.triggers.types.permissions_set' do + it 'requires id' do + expect { client.admin_workflows_triggers_types_permissions_set(visibility: %q[]) }.to raise_error ArgumentError, /Required arguments :id missing/ + end + it 'requires visibility' do + expect { client.admin_workflows_triggers_types_permissions_set(id: %q[['FTT01', 'FTT02', 'FTT03']]) }.to raise_error ArgumentError, /Required arguments :visibility missing/ + end + end +end diff --git a/spec/slack/web/api/endpoints/apps_datastore_spec.rb b/spec/slack/web/api/endpoints/apps_datastore_spec.rb index 7cd8e66f..4e756c6b 100644 --- a/spec/slack/web/api/endpoints/apps_datastore_spec.rb +++ b/spec/slack/web/api/endpoints/apps_datastore_spec.rb @@ -5,6 +5,30 @@ RSpec.describe Slack::Web::Api::Endpoints::AppsDatastore do let(:client) { Slack::Web::Client.new } + context 'apps.datastore_bulkDelete' do + it 'requires datastore' do + expect { client.apps_datastore_bulkDelete(ids: %q[["7c6dd137", "c7d6d731"]]) }.to raise_error ArgumentError, /Required arguments :datastore missing/ + end + it 'requires ids' do + expect { client.apps_datastore_bulkDelete(datastore: %q[]) }.to raise_error ArgumentError, /Required arguments :ids missing/ + end + end + context 'apps.datastore_bulkGet' do + it 'requires datastore' do + expect { client.apps_datastore_bulkGet(ids: %q[["7c6dd137", "c7d6d731"]]) }.to raise_error ArgumentError, /Required arguments :datastore missing/ + end + it 'requires ids' do + expect { client.apps_datastore_bulkGet(datastore: %q[]) }.to raise_error ArgumentError, /Required arguments :ids missing/ + end + end + context 'apps.datastore_bulkPut' do + it 'requires datastore' do + expect { client.apps_datastore_bulkPut(items: %q[[{"id": "7c6dd137", "favourite_meal": "Shawarma", "reason": "Who doesn't like Shawarma?"}]]) }.to raise_error ArgumentError, /Required arguments :datastore missing/ + end + it 'requires items' do + expect { client.apps_datastore_bulkPut(datastore: %q[]) }.to raise_error ArgumentError, /Required arguments :items missing/ + end + end context 'apps.datastore_delete' do it 'requires datastore' do expect { client.apps_datastore_delete(id: %q[]) }.to raise_error ArgumentError, /Required arguments :datastore missing/