From d97a3be39193004477008c134be6c34eba818b80 Mon Sep 17 00:00:00 2001 From: slack-ruby-ci-bot Date: Wed, 16 Aug 2023 23:19:07 +0000 Subject: [PATCH] Update API from slack-api-ref@0d3f0b6 (2023-08-16) --- CHANGELOG.md | 1 + bin/commands/admin_apps_activities.rb | 32 +++++++++++ bin/commands/admin_users.rb | 2 +- bin/commands/conversations.rb | 6 +-- bin/commands/team.rb | 2 +- lib/slack/web/api/endpoints.rb | 2 + .../api/endpoints/admin_apps_activities.rb | 53 +++++++++++++++++++ lib/slack/web/api/endpoints/admin_users.rb | 2 +- lib/slack/web/api/endpoints/conversations.rb | 6 +-- lib/slack/web/api/endpoints/team.rb | 2 +- lib/slack/web/api/errors.rb | 4 +- lib/slack/web/api/slack-api-ref | 2 +- .../endpoints/admin_apps_activities_spec.rb | 8 +++ 13 files changed, 109 insertions(+), 13 deletions(-) create mode 100644 bin/commands/admin_apps_activities.rb create mode 100644 lib/slack/web/api/endpoints/admin_apps_activities.rb create mode 100644 spec/slack/web/api/endpoints/admin_apps_activities_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 8365bd9e..4b2632b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * [#490](https://github.com/slack-ruby/slack-ruby-client/pull/490): Add changelog uri to gemspec - [@MatheusRich](https://github.com/MatheusRich). * [#491](https://github.com/slack-ruby/slack-ruby-client/pull/491): Added code coverage - [@dblock](https://github.com/dblock). * [#486](https://github.com/slack-ruby/slack-ruby-client/pull/486): Async handler support for Slack::RealTime::Config and Client - [@milestruecar](https://github.com/milestruecar). +* [#489](https://github.com/slack-ruby-client/pulls/489): Update API from [slack-api-ref@0d3f0b6](https://github.com/slack-ruby/slack-api-ref/commit/0d3f0b6) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot). * Your contribution here. ### 2.1.0 (2023/03/17) diff --git a/bin/commands/admin_apps_activities.rb b/bin/commands/admin_apps_activities.rb new file mode 100644 index 00000000..65cd0e18 --- /dev/null +++ b/bin/commands/admin_apps_activities.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Cli + class App + desc 'AdminAppsActivities methods.' + command 'admin_apps_activities' do |g| + 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 '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.' + c.flag 'log_event_type', desc: 'The event type of log events to be returned.' + c.flag 'max_date_created', desc: 'The latest timestamp of the log to retrieve (epoch microseconds).' + c.flag 'min_date_created', desc: 'The earliest timestamp of the log to retrieve (epoch microseconds).' + c.flag 'min_log_level', desc: "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')." + 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.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_apps_activities_list(options)) + end + end + end + end + end +end diff --git a/bin/commands/admin_users.rb b/bin/commands/admin_users.rb index 036b003a..4515cbbb 100644 --- a/bin/commands/admin_users.rb +++ b/bin/commands/admin_users.rb @@ -31,7 +31,7 @@ class App c.flag 'is_restricted', desc: 'Is this user a multi-channel guest user? (default: false).' c.flag 'is_ultra_restricted', desc: 'Is this user a single channel guest user? (default: false).' c.flag 'real_name', desc: 'Full name of the user.' - c.flag 'resend', desc: 'Allow this invite to be resent in the future if a user has not signed up yet. (default: false).' + c.flag 'resend', desc: 'Allow this invite to be resent in the future if a user has not signed up yet. Resending can only be done via the UI and has no expiration. (default: false).' c.action do |_global_options, options, _args| puts JSON.dump(@client.admin_users_invite(options)) end diff --git a/bin/commands/conversations.rb b/bin/commands/conversations.rb index 3b5ef377..59ee34c0 100644 --- a/bin/commands/conversations.rb +++ b/bin/commands/conversations.rb @@ -12,7 +12,7 @@ class App c.flag 'channel_name', desc: 'Name of the channel. If the channel does not exist already in your workspace, this name is the one that the channel will take.' c.flag 'channel_id', desc: "ID of the channel that you'd like to accept. Must provide either invite_id or channel_id." c.flag 'free_trial_accepted', desc: "Whether you'd like to use your workspace's free trial to begin using Slack Connect." - c.flag 'invite_id', desc: 'See the shared_channel_invite_received event payload for more details on how to retrieve the ID of the invitation.' + c.flag 'invite_id', desc: "ID of the invite that you'd like to accept. Must provide either invite_id or channel_id. See the shared_channel_invite_received event payload for more details on how to retrieve the ID of the invitation." c.flag 'is_private', desc: 'Whether the channel should be private.' c.flag 'team_id', desc: 'The ID of the workspace to accept the channel in. If an org-level token is used to call this method, the team_id argument is required.' c.action do |_global_options, options, _args| @@ -109,9 +109,9 @@ class App g.long_desc %( Sends an invitation to a Slack Connect channel ) g.command 'inviteShared' do |c| c.flag 'channel', desc: "ID of the channel on your team that you'd like to share." - c.flag 'emails', desc: 'Optional email to receive this invite. Either emails or user_ids must be provided.' + c.flag 'emails', desc: 'Optional email to receive this invite. Either emails or user_ids must be provided. Only one email or one user ID may be invited at a time.' c.flag 'external_limited', desc: 'Optional boolean on whether invite is to a external limited member. Defaults to true.' - c.flag 'user_ids', desc: 'Optional user_id to receive this invite. Either emails or user_ids must be provided.' + c.flag 'user_ids', desc: 'Optional user_id to receive this invite. Either emails or user_ids must be provided. Only one email or one user ID may be invited at a time.' c.action do |_global_options, options, _args| puts JSON.dump(@client.conversations_inviteShared(options)) end diff --git a/bin/commands/team.rb b/bin/commands/team.rb index db0727b6..902ade74 100644 --- a/bin/commands/team.rb +++ b/bin/commands/team.rb @@ -34,7 +34,7 @@ class App g.long_desc %( Gets information about the current team. ) g.command 'info' do |c| 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.' - c.flag 'team', desc: 'Team to get info on, if omitted, will return information about the current team. Will only return team that the authenticated token is allowed to see through external shared channels.' + c.flag 'team', desc: 'Team to get info about; if omitted, will return information about the current team.' c.action do |_global_options, options, _args| puts JSON.dump(@client.team_info(options)) end diff --git a/lib/slack/web/api/endpoints.rb b/lib/slack/web/api/endpoints.rb index 6a9c2b23..e49387a7 100644 --- a/lib/slack/web/api/endpoints.rb +++ b/lib/slack/web/api/endpoints.rb @@ -3,6 +3,7 @@ require_relative 'endpoints/admin_analytics' require_relative 'endpoints/admin_apps' +require_relative 'endpoints/admin_apps_activities' require_relative 'endpoints/admin_apps_approved' require_relative 'endpoints/admin_apps_requests' require_relative 'endpoints/admin_apps_restricted' @@ -83,6 +84,7 @@ module Endpoints include AdminAnalytics include AdminApps + include AdminAppsActivities include AdminAppsApproved include AdminAppsRequests include AdminAppsRestricted diff --git a/lib/slack/web/api/endpoints/admin_apps_activities.rb b/lib/slack/web/api/endpoints/admin_apps_activities.rb new file mode 100644 index 00000000..fb9909b4 --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_apps_activities.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AdminAppsActivities + # + # Get logs for a specified team/org + # + # @option options [Object] :app_id + # 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. + # @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 + # 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. + # @option options [integer] :limit + # The maximum number of items to return. + # @option options [string] :log_event_type + # The event type of log events to be returned. + # @option options [integer] :max_date_created + # The latest timestamp of the log to retrieve (epoch microseconds). + # @option options [integer] :min_date_created + # The earliest timestamp of the log to retrieve (epoch microseconds). + # @option options [string] :min_log_level + # 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'). + # @option options [string] :sort_direction + # The direction you want the data sorted by (always by timestamp). + # @option options [string] :source + # The source of log events to be returned. Acceptable values are ('slack', 'developer'). + # @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. + # @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 = {}) + if block_given? + Pagination::Cursor.new(self, :admin_apps_activities_list, options).each do |page| + yield page + end + else + post('admin.apps.activities.list', options) + end + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_users.rb b/lib/slack/web/api/endpoints/admin_users.rb index ba22e893..b5f2eaad 100644 --- a/lib/slack/web/api/endpoints/admin_users.rb +++ b/lib/slack/web/api/endpoints/admin_users.rb @@ -49,7 +49,7 @@ def admin_users_assign(options = {}) # @option options [string] :real_name # Full name of the user. # @option options [boolean] :resend - # Allow this invite to be resent in the future if a user has not signed up yet. (default: false). + # Allow this invite to be resent in the future if a user has not signed up yet. Resending can only be done via the UI and has no expiration. (default: false). # @see https://api.slack.com/methods/admin.users.invite # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.invite.json def admin_users_invite(options = {}) diff --git a/lib/slack/web/api/endpoints/conversations.rb b/lib/slack/web/api/endpoints/conversations.rb index 314da8e1..0011ff13 100644 --- a/lib/slack/web/api/endpoints/conversations.rb +++ b/lib/slack/web/api/endpoints/conversations.rb @@ -16,7 +16,7 @@ module Conversations # @option options [boolean] :free_trial_accepted # Whether you'd like to use your workspace's free trial to begin using Slack Connect. # @option options [Object] :invite_id - # See the shared_channel_invite_received event payload for more details on how to retrieve the ID of the invitation. + # ID of the invite that you'd like to accept. Must provide either invite_id or channel_id. See the shared_channel_invite_received event payload for more details on how to retrieve the ID of the invitation. # @option options [boolean] :is_private # Whether the channel should be private. # @option options [Object] :team_id @@ -168,11 +168,11 @@ def conversations_invite(options = {}) # @option options [channel] :channel # ID of the channel on your team that you'd like to share. # @option options [array] :emails - # Optional email to receive this invite. Either emails or user_ids must be provided. + # Optional email to receive this invite. Either emails or user_ids must be provided. Only one email or one user ID may be invited at a time. # @option options [boolean] :external_limited # Optional boolean on whether invite is to a external limited member. Defaults to true. # @option options [array] :user_ids - # Optional user_id to receive this invite. Either emails or user_ids must be provided. + # Optional user_id to receive this invite. Either emails or user_ids must be provided. Only one email or one user ID may be invited at a time. # @see https://api.slack.com/methods/conversations.inviteShared # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.inviteShared.json def conversations_inviteShared(options = {}) diff --git a/lib/slack/web/api/endpoints/team.rb b/lib/slack/web/api/endpoints/team.rb index df2c67ff..214ad0b9 100644 --- a/lib/slack/web/api/endpoints/team.rb +++ b/lib/slack/web/api/endpoints/team.rb @@ -59,7 +59,7 @@ def team_billableInfo(options = {}) # @option options [string] :domain # 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. # @option options [string] :team - # Team to get info on, if omitted, will return information about the current team. Will only return team that the authenticated token is allowed to see through external shared channels. + # Team to get info about; if omitted, will return information about the current team. # @see https://api.slack.com/methods/team.info # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/team/team.info.json def team_info(options = {}) diff --git a/lib/slack/web/api/errors.rb b/lib/slack/web/api/errors.rb index 5d3ff3fd..34c2306d 100644 --- a/lib/slack/web/api/errors.rb +++ b/lib/slack/web/api/errors.rb @@ -6,6 +6,7 @@ module Web module Api module Errors class AccessDenied < SlackError; end + class AccessTokenExchangeFailed < SlackError; end class Accesslimited < SlackError; end class AccountInactive < SlackError; end class ActionAlreadyInProgress < SlackError; end @@ -594,7 +595,6 @@ class UserIsRestricted < SlackError; end class UserIsUltraRestricted < SlackError; end class UserMustBeAdmin < SlackError; end class UserMustBeInWorkspace < SlackError; end - class UserNotAMemberOfThisWorkspace < SlackError; end class UserNotFound < SlackError; end class UserNotInChannel < SlackError; end class UserNotVisible < SlackError; end @@ -611,6 +611,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end ERROR_CLASSES = { 'access_denied' => AccessDenied, + 'access_token_exchange_failed' => AccessTokenExchangeFailed, 'accesslimited' => Accesslimited, 'account_inactive' => AccountInactive, 'action_already_in_progress' => ActionAlreadyInProgress, @@ -1199,7 +1200,6 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'user_is_ultra_restricted' => UserIsUltraRestricted, 'user_must_be_admin' => UserMustBeAdmin, 'user_must_be_in_workspace' => UserMustBeInWorkspace, - 'user_not_a_member_of_this_workspace' => UserNotAMemberOfThisWorkspace, 'user_not_found' => UserNotFound, 'user_not_in_channel' => UserNotInChannel, 'user_not_visible' => UserNotVisible, diff --git a/lib/slack/web/api/slack-api-ref b/lib/slack/web/api/slack-api-ref index 0d3f0b66..aec297a9 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit 0d3f0b6629e1a13722604dcdfae53ad1b7a7f59e +Subproject commit aec297a9b165df73bf6ab22c30fd2576139ef511 diff --git a/spec/slack/web/api/endpoints/admin_apps_activities_spec.rb b/spec/slack/web/api/endpoints/admin_apps_activities_spec.rb new file mode 100644 index 00000000..4afcfaa3 --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_apps_activities_spec.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::AdminAppsActivities do + let(:client) { Slack::Web::Client.new } +end