diff --git a/CHANGELOG.md b/CHANGELOG.md index 76baad48..c1b7b98d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### 2.5.3 (Next) * [#549](https://github.com/slack-ruby/slack-ruby-client/pull/549): Add group ID formatting support for message mentions - [@n0h0](https://github.com/n0h0). +* [#547](https://github.com/slack-ruby/slack-ruby-client/pull/547): Update API from [slack-api-ref@1ee282e](https://github.com/slack-ruby/slack-api-ref/commit/1ee282e) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot). * Your contribution here. ### 2.5.2 (2025/02/19) diff --git a/bin/commands/admin_conversations.rb b/bin/commands/admin_conversations.rb index eeaa1575..d831d8cd 100644 --- a/bin/commands/admin_conversations.rb +++ b/bin/commands/admin_conversations.rb @@ -219,7 +219,7 @@ class App c.flag 'channel_id', desc: 'The encoded channel_id to add or remove to workspaces.' c.flag 'org_channel', desc: 'True if channel has to be converted to an org channel.' c.flag 'target_team_ids', desc: 'A comma-separated list of workspaces to which the channel should be shared. Not required if the channel is being shared org-wide.' - c.flag 'team_id', desc: 'The workspace to which the channel belongs. Omit this argument if the channel is a cross-workspace shared channel.' + c.flag 'team_id', desc: 'The workspace to which the channel belongs if the channel is a local workspace channel. Omit this argument if the channel is a cross-workspace or org-wide shared channel.' c.action do |_global_options, options, _args| puts JSON.dump(@client.admin_conversations_setTeams(options)) end diff --git a/bin/commands/assistant_search.rb b/bin/commands/assistant_search.rb new file mode 100644 index 00000000..b8a933fd --- /dev/null +++ b/bin/commands/assistant_search.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Cli + class App + desc 'AssistantSearch methods.' + command 'assistant_search' do |g| + g.desc 'Searches messages across your Slack organization—perfect for broad, specific, and real-time data retrieval.' + g.long_desc %( Searches messages across your Slack organization—perfect for broad, specific, and real-time data retrieval. ) + g.command 'context' do |c| + c.flag 'query', desc: 'User prompt or search query.' + c.flag 'action_token', desc: 'Send action_token as received in a message event.' + c.flag 'channel_types', desc: 'Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.' + c.flag 'content_types', desc: 'Content types to include, a comma-separated list of any combination of messages, files.' + c.flag 'context_channel_id', desc: 'Context channel ID to support scoping the search when applicable.' + c.flag 'cursor', desc: 'The cursor returned by the API. Leave this blank for the first request, and use this to get the next page of results.' + c.flag 'include_bots', desc: 'If you want the results to include bots.' + c.flag 'limit', desc: 'Number of results to return, up to a max of 20. Defaults to 20.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.assistant_search_context(options)) + end + end + end + end + end +end diff --git a/bin/commands/functions_distributions_permissions.rb b/bin/commands/functions_distributions_permissions.rb index a13e1c40..1bde98f8 100644 --- a/bin/commands/functions_distributions_permissions.rb +++ b/bin/commands/functions_distributions_permissions.rb @@ -18,8 +18,8 @@ class App end end - 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' - 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 ) + g.desc 'List the access type of a custom slack function and include the users or team or org ids with access if its permission_type is set to named_entities' + g.long_desc %( List the access type of a custom slack function and include the users or team or org ids with access if its permission_type is set to named_entities ) g.command 'list' do |c| c.flag 'function_app_id', desc: 'The encoded ID of the app.' c.flag 'function_callback_id', desc: "The callback ID defined in the function's definition file." @@ -41,13 +41,15 @@ class App end end - 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' - 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 ) + g.desc 'Set the access type of a custom slack function and define the users or team or org ids to be granted access if permission_type is set to named_entities' + g.long_desc %( Set the access type of a custom slack function and define the users or team or org ids to be granted access if permission_type is set to named_entities ) g.command 'set' do |c| c.flag 'permission_type', desc: 'The type of permission that defines how the function can be distributed.' c.flag 'function_app_id', desc: 'The encoded ID of the app.' c.flag 'function_callback_id', desc: "The callback ID defined in the function's definition file." c.flag 'function_id', desc: 'The encoded ID of the function.' + c.flag 'org_ids', desc: 'List of org IDs to allow for named_entities permission.' + c.flag 'team_ids', desc: 'List of team IDs to allow for named_entities permission.' c.flag 'user_ids', desc: 'List of encoded user IDs.' c.action do |_global_options, options, _args| puts JSON.dump(@client.functions_distributions_permissions_set(options)) diff --git a/bin/commands/usergroups.rb b/bin/commands/usergroups.rb index 0c0c838a..4da2f5b2 100644 --- a/bin/commands/usergroups.rb +++ b/bin/commands/usergroups.rb @@ -51,7 +51,6 @@ class App c.flag 'include_disabled', desc: 'Include disabled User Groups.' c.flag 'include_users', desc: 'Include the list of users for each User Group.' c.flag 'team_id', desc: 'encoded team id to list user groups in, required if org token is used.' - c.flag 'usergroup_id', desc: 'The id of the usergroup you would like to filter the results down to.' c.action do |_global_options, options, _args| puts JSON.dump(@client.usergroups_list(options)) end diff --git a/lib/slack/web/api/endpoints.rb b/lib/slack/web/api/endpoints.rb index 0a782a55..10ed467b 100644 --- a/lib/slack/web/api/endpoints.rb +++ b/lib/slack/web/api/endpoints.rb @@ -41,6 +41,7 @@ require_relative 'endpoints/apps_datastore' require_relative 'endpoints/apps_event_authorizations' require_relative 'endpoints/apps_manifest' +require_relative 'endpoints/assistant_search' require_relative 'endpoints/assistant_threads' require_relative 'endpoints/auth' require_relative 'endpoints/auth_teams' @@ -141,6 +142,7 @@ module Endpoints include AppsDatastore include AppsEventAuthorizations include AppsManifest + include AssistantSearch include AssistantThreads include Auth include AuthTeams diff --git a/lib/slack/web/api/endpoints/admin_conversations.rb b/lib/slack/web/api/endpoints/admin_conversations.rb index a9478eae..cc35916d 100644 --- a/lib/slack/web/api/endpoints/admin_conversations.rb +++ b/lib/slack/web/api/endpoints/admin_conversations.rb @@ -338,7 +338,7 @@ def admin_conversations_setCustomRetention(options = {}) # @option options [array] :target_team_ids # A comma-separated list of workspaces to which the channel should be shared. Not required if the channel is being shared org-wide. # @option options [Object] :team_id - # The workspace to which the channel belongs. Omit this argument if the channel is a cross-workspace shared channel. + # The workspace to which the channel belongs if the channel is a local workspace channel. Omit this argument if the channel is a cross-workspace or org-wide shared channel. # @see https://api.slack.com/methods/admin.conversations.setTeams # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.setTeams.json def admin_conversations_setTeams(options = {}) diff --git a/lib/slack/web/api/endpoints/assistant_search.rb b/lib/slack/web/api/endpoints/assistant_search.rb new file mode 100644 index 00000000..3bc33dce --- /dev/null +++ b/lib/slack/web/api/endpoints/assistant_search.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AssistantSearch + # + # Searches messages across your Slack organization—perfect for broad, specific, and real-time data retrieval. + # + # @option options [string] :query + # User prompt or search query. + # @option options [string] :action_token + # Send action_token as received in a message event. + # @option options [array] :channel_types + # Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im. + # @option options [array] :content_types + # Content types to include, a comma-separated list of any combination of messages, files. + # @option options [Object] :context_channel_id + # Context channel ID to support scoping the search when applicable. + # @option options [string] :cursor + # The cursor returned by the API. Leave this blank for the first request, and use this to get the next page of results. + # @option options [boolean] :include_bots + # If you want the results to include bots. + # @option options [integer] :limit + # Number of results to return, up to a max of 20. Defaults to 20. + # @see https://api.slack.com/methods/assistant.search.context + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/assistant.search/assistant.search.context.json + def assistant_search_context(options = {}) + raise ArgumentError, 'Required arguments :query missing' if options[:query].nil? + if block_given? + Pagination::Cursor.new(self, :assistant_search_context, options).each do |page| + yield page + end + else + post('assistant.search.context', options) + end + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/conversations.rb b/lib/slack/web/api/endpoints/conversations.rb index a0e93095..a7d346a0 100644 --- a/lib/slack/web/api/endpoints/conversations.rb +++ b/lib/slack/web/api/endpoints/conversations.rb @@ -207,7 +207,6 @@ def conversations_join(options = {}) # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.kick.json def conversations_kick(options = {}) raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil? - raise ArgumentError, 'Required arguments :user missing' if options[:user].nil? options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] options = options.merge(user: users_id(options)['user']['id']) if options[:user] post('conversations.kick', options) diff --git a/lib/slack/web/api/endpoints/functions_distributions_permissions.rb b/lib/slack/web/api/endpoints/functions_distributions_permissions.rb index 0436e599..028181b2 100644 --- a/lib/slack/web/api/endpoints/functions_distributions_permissions.rb +++ b/lib/slack/web/api/endpoints/functions_distributions_permissions.rb @@ -24,7 +24,7 @@ def functions_distributions_permissions_add(options = {}) end # - # List the access type of a custom slack function and include the users with access if its permission_type is set to named_entities + # List the access type of a custom slack function and include the users or team or org ids with access if its permission_type is set to named_entities # # @option options [string] :function_app_id # The encoded ID of the app. @@ -56,7 +56,7 @@ def functions_distributions_permissions_remove(options = {}) end # - # 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 + # Set the access type of a custom slack function and define the users or team or org ids to be granted access if permission_type is set to named_entities # # @option options [enum] :permission_type # The type of permission that defines how the function can be distributed. @@ -66,6 +66,10 @@ def functions_distributions_permissions_remove(options = {}) # The callback ID defined in the function's definition file. # @option options [string] :function_id # The encoded ID of the function. + # @option options [array] :org_ids + # List of org IDs to allow for named_entities permission. + # @option options [array] :team_ids + # List of team IDs to allow for named_entities permission. # @option options [array] :user_ids # List of encoded user IDs. # @see https://api.slack.com/methods/functions.distributions.permissions.set diff --git a/lib/slack/web/api/endpoints/usergroups.rb b/lib/slack/web/api/endpoints/usergroups.rb index 90cfc6b8..5521408a 100644 --- a/lib/slack/web/api/endpoints/usergroups.rb +++ b/lib/slack/web/api/endpoints/usergroups.rb @@ -75,8 +75,6 @@ def usergroups_enable(options = {}) # Include the list of users for each User Group. # @option options [string] :team_id # encoded team id to list user groups in, required if org token is used. - # @option options [Object] :usergroup_id - # The id of the usergroup you would like to filter the results down to. # @see https://api.slack.com/methods/usergroups.list # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups/usergroups.list.json def usergroups_list(options = {}) diff --git a/lib/slack/web/api/errors.rb b/lib/slack/web/api/errors.rb index ae9267d9..d00c191f 100644 --- a/lib/slack/web/api/errors.rb +++ b/lib/slack/web/api/errors.rb @@ -137,6 +137,7 @@ class ConnectedTeamPassedInIsNotTopLevelTeam < SlackError; end class ConnectedUserDenied < SlackError; end class ConnectionLimitExceeded < SlackError; end class ConnectionLimitExceededPending < SlackError; end + class ContextChannelNotFound < SlackError; end class CouldNotArchiveChannel < SlackError; end class CouldNotConvertChannel < SlackError; end class CouldNotCreateChannel < SlackError; end @@ -272,6 +273,7 @@ class IncludeDeactivatedUserWorkspacesInvalid < SlackError; end class InsecureRequest < SlackError; end class InternalError < SlackError; end class InvalidAction < SlackError; end + class InvalidActionToken < SlackError; end class InvalidActor < SlackError; end class InvalidApp < SlackError; end class InvalidAppActionType < SlackError; end @@ -427,6 +429,7 @@ class MissingDuration < SlackError; end class MissingFileData < SlackError; end class MissingPostType < SlackError; end class MissingProfileId < SlackError; end + class MissingQuery < SlackError; end class MissingResource < SlackError; end class MissingScope < SlackError; end class MissingSource < SlackError; end @@ -539,6 +542,7 @@ class ProvidersNotFound < SlackError; end class PublicVideoNotAllowed < SlackError; end class PublishedAppOnly < SlackError; end class PushLimitReached < SlackError; end + class QueryTooLong < SlackError; end class RateLimited < SlackError; end class Ratelimit < SlackError; end class Ratelimited < SlackError; end @@ -814,6 +818,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'connected_user_denied' => ConnectedUserDenied, 'connection_limit_exceeded' => ConnectionLimitExceeded, 'connection_limit_exceeded_pending' => ConnectionLimitExceededPending, + 'context_channel_not_found' => ContextChannelNotFound, 'could_not_archive_channel' => CouldNotArchiveChannel, 'could_not_convert_channel' => CouldNotConvertChannel, 'could_not_create_channel' => CouldNotCreateChannel, @@ -949,6 +954,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'insecure_request' => InsecureRequest, 'internal_error' => InternalError, 'invalid_action' => InvalidAction, + 'invalid_action_token' => InvalidActionToken, 'invalid_actor' => InvalidActor, 'invalid_app' => InvalidApp, 'invalid_app_action_type' => InvalidAppActionType, @@ -1104,6 +1110,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'missing_file_data' => MissingFileData, 'missing_post_type' => MissingPostType, 'missing_profile_id' => MissingProfileId, + 'missing_query' => MissingQuery, 'missing_resource' => MissingResource, 'missing_scope' => MissingScope, 'missing_source' => MissingSource, @@ -1216,6 +1223,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'public_video_not_allowed' => PublicVideoNotAllowed, 'published_app_only' => PublishedAppOnly, 'push_limit_reached' => PushLimitReached, + 'query_too_long' => QueryTooLong, 'rate_limited' => RateLimited, 'ratelimit' => Ratelimit, 'ratelimited' => Ratelimited, diff --git a/lib/slack/web/api/slack-api-ref b/lib/slack/web/api/slack-api-ref index 1ee282e7..62f1fb50 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit 1ee282e7152690f8b138ad1f7b0bffe22f677cf7 +Subproject commit 62f1fb500c9df2f2811baead4264037eaab6039b diff --git a/spec/slack/web/api/endpoints/assistant_search_spec.rb b/spec/slack/web/api/endpoints/assistant_search_spec.rb new file mode 100644 index 00000000..732925b8 --- /dev/null +++ b/spec/slack/web/api/endpoints/assistant_search_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::AssistantSearch do + let(:client) { Slack::Web::Client.new } + context 'assistant.search_context' do + it 'requires query' do + expect { client.assistant_search_context }.to raise_error ArgumentError, /Required arguments :query missing/ + end + end +end diff --git a/spec/slack/web/api/endpoints/conversations_spec.rb b/spec/slack/web/api/endpoints/conversations_spec.rb index 609bdce7..09935596 100644 --- a/spec/slack/web/api/endpoints/conversations_spec.rb +++ b/spec/slack/web/api/endpoints/conversations_spec.rb @@ -65,10 +65,7 @@ end context 'conversations_kick' do it 'requires channel' do - expect { client.conversations_kick(user: %q[W1234567890]) }.to raise_error ArgumentError, /Required arguments :channel missing/ - end - it 'requires user' do - expect { client.conversations_kick(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :user missing/ + expect { client.conversations_kick }.to raise_error ArgumentError, /Required arguments :channel missing/ end end context 'conversations_leave' do