diff --git a/CHANGELOG.md b/CHANGELOG.md index 017ba1b6..9fd79418 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * [#476](https://github.com/slack-ruby-client/pulls/476): Update API from [slack-api-ref@d0b2989](https://github.com/slack-ruby/slack-api-ref/commit/d0b2989) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot). * [#478](https://github.com/slack-ruby-client/pulls/478): Update API from [slack-api-ref@d797055](https://github.com/slack-ruby/slack-api-ref/commit/d797055) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot). * [#480](https://github.com/slack-ruby-client/pulls/480): Add common message formatting utilities - [@chrisbloom7](https://github.com/chrisbloom7). +* [#481](https://github.com/slack-ruby-client/pulls/481): Update API from [slack-api-ref@7c22d0b](https://github.com/slack-ruby/slack-api-ref/commit/7c22d0b) - [@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/apps_activities.rb b/bin/commands/apps_activities.rb new file mode 100644 index 00000000..af09d8f8 --- /dev/null +++ b/bin/commands/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 'AppsActivities methods.' + command 'apps_activities' do |g| + g.desc 'Get logs for a specified app' + g.long_desc %( Get logs for a specified app ) + 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.apps_activities_list(options)) + end + end + end + end + end +end diff --git a/bin/commands/reminders.rb b/bin/commands/reminders.rb index a7abc66d..9c3600da 100644 --- a/bin/commands/reminders.rb +++ b/bin/commands/reminders.rb @@ -13,7 +13,7 @@ class App c.flag 'time', desc: 'When this reminder should happen: the Unix timestamp (up to five years from now), the number of seconds until the reminder (if within 24 hours), or a natural language description (Ex. "in 15 minutes," or "every Thursday").' c.flag 'recurrence', desc: 'Specify the repeating behavior of a reminder. Available options: daily, weekly, monthly, or yearly. If weekly, may further specify the days of the week.' c.flag 'team_id', desc: 'Encoded team id, required if org token is used.' - c.flag 'user', desc: 'The user who will receive the reminder. If no user is specified, the reminder will go to user who created it.' + c.flag 'user', desc: 'No longer supported - reminders cannot be set for other users. Previously, was the user who would receive the reminder.' c.action do |_global_options, options, _args| puts JSON.dump(@client.reminders_add(options)) end diff --git a/bin/commands/stars.rb b/bin/commands/stars.rb index a4936018..b2cd1c2e 100644 --- a/bin/commands/stars.rb +++ b/bin/commands/stars.rb @@ -6,8 +6,8 @@ module Cli class App desc 'Stars methods.' command 'stars' do |g| - g.desc 'Save an item for later. Formerly known as _adding a star_.' - g.long_desc %( Save an item for later. Formerly known as _adding a star_. ) + g.desc 'Save an item for later. Formerly known as adding a star.' + g.long_desc %( Save an item for later. Formerly known as adding a star. ) g.command 'add' do |c| c.flag 'channel', desc: 'Channel to add star to, or channel where the message to add star to was posted (used with timestamp).' c.flag 'file', desc: 'File to add star to.' @@ -18,8 +18,8 @@ class App end end - g.desc "List a user's saved items, formerly known as stars." - g.long_desc %( List a user's saved items, formerly known as stars. ) + g.desc "Listed a user's saved items, formerly known as stars." + g.long_desc %( Listed a user's saved items, formerly known as stars. ) g.command 'list' do |c| c.flag 'cursor', desc: "Parameter for pagination. Set cursor equal to the next_cursor attribute returned by the previous request's response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first 'page' of the collection. See pagination for more details." c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached." diff --git a/lib/slack/real_time/stores/starter.rb b/lib/slack/real_time/stores/starter.rb index a343a2b3..3ddaba86 100644 --- a/lib/slack/real_time/stores/starter.rb +++ b/lib/slack/real_time/stores/starter.rb @@ -309,12 +309,12 @@ def initialize(attrs, _options = {}) # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/shared_channel_invite_received.json # on :shared_channel_invite_received do |data| - # A member has starred an item. + # A member has saved an item for later or starred an item. # @see https://api.slack.com/events/star_added # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/star_added.json # on :star_added do |data| - # A member removed a star. + # A member has removed an item saved for later or starred an item. # @see https://api.slack.com/events/star_removed # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/star_removed.json # on :star_removed do |data| diff --git a/lib/slack/real_time/stores/store.rb b/lib/slack/real_time/stores/store.rb index 34361922..3fb773b0 100644 --- a/lib/slack/real_time/stores/store.rb +++ b/lib/slack/real_time/stores/store.rb @@ -495,12 +495,12 @@ def team # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/shared_channel_invite_received.json # on :shared_channel_invite_received do |data| - # A member has starred an item. + # A member has saved an item for later or starred an item. # @see https://api.slack.com/events/star_added # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/star_added.json # on :star_added do |data| - # A member removed a star. + # A member has removed an item saved for later or starred an item. # @see https://api.slack.com/events/star_removed # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/star_removed.json # on :star_removed do |data| diff --git a/lib/slack/web/api/endpoints.rb b/lib/slack/web/api/endpoints.rb index baf3d22a..6a9c2b23 100644 --- a/lib/slack/web/api/endpoints.rb +++ b/lib/slack/web/api/endpoints.rb @@ -27,6 +27,7 @@ require_relative 'endpoints/admin_users_unsupportedVersions' require_relative 'endpoints/api' require_relative 'endpoints/apps' +require_relative 'endpoints/apps_activities' require_relative 'endpoints/apps_auth_external' require_relative 'endpoints/apps_connections' require_relative 'endpoints/apps_datastore' @@ -106,6 +107,7 @@ module Endpoints include AdminUsersUnsupportedversions include Api include Apps + include AppsActivities include AppsAuthExternal include AppsConnections include AppsDatastore diff --git a/lib/slack/web/api/endpoints/apps_activities.rb b/lib/slack/web/api/endpoints/apps_activities.rb new file mode 100644 index 00000000..0f271f66 --- /dev/null +++ b/lib/slack/web/api/endpoints/apps_activities.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AppsActivities + # + # Get logs for a specified app + # + # @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/apps.activities.list + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.activities/apps.activities.list.json + def apps_activities_list(options = {}) + raise ArgumentError, 'Required arguments :app_id missing' if options[:app_id].nil? + if block_given? + Pagination::Cursor.new(self, :apps_activities_list, options).each do |page| + yield page + end + else + post('apps.activities.list', options) + end + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/reminders.rb b/lib/slack/web/api/endpoints/reminders.rb index 3d4e5830..a24ba674 100644 --- a/lib/slack/web/api/endpoints/reminders.rb +++ b/lib/slack/web/api/endpoints/reminders.rb @@ -18,7 +18,7 @@ module Reminders # @option options [string] :team_id # Encoded team id, required if org token is used. # @option options [user] :user - # The user who will receive the reminder. If no user is specified, the reminder will go to user who created it. + # No longer supported - reminders cannot be set for other users. Previously, was the user who would receive the reminder. # @see https://api.slack.com/methods/reminders.add # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.add.json def reminders_add(options = {}) diff --git a/lib/slack/web/api/endpoints/stars.rb b/lib/slack/web/api/endpoints/stars.rb index 730503fa..bf131f2a 100644 --- a/lib/slack/web/api/endpoints/stars.rb +++ b/lib/slack/web/api/endpoints/stars.rb @@ -7,7 +7,7 @@ module Api module Endpoints module Stars # - # Save an item for later. Formerly known as _adding a star_. + # Save an item for later. Formerly known as adding a star. # # @option options [channel] :channel # Channel to add star to, or channel where the message to add star to was posted (used with timestamp). @@ -25,7 +25,7 @@ def stars_add(options = {}) end # - # List a user's saved items, formerly known as stars. + # Listed a user's saved items, formerly known as stars. # # @option options [string] :cursor # Parameter for pagination. Set cursor equal to the next_cursor attribute returned by the previous request's response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first "page" of the collection. See pagination for more details. diff --git a/lib/slack/web/api/errors.rb b/lib/slack/web/api/errors.rb index 9d75e038..c785dcfe 100644 --- a/lib/slack/web/api/errors.rb +++ b/lib/slack/web/api/errors.rb @@ -150,6 +150,7 @@ class DuplicateMessageNotFound < SlackError; end class EditWindowClosed < SlackError; end class EkmAccessDenied < SlackError; end class EmailDoesNotMatch < SlackError; end + class EmailNotVerified < SlackError; end class EmailTaken < SlackError; end class EmojiLimitReached < SlackError; end class EmojiNotFound < SlackError; end @@ -455,6 +456,7 @@ class OneOrMoreInvalidChannels < SlackError; end class OrgLevelEmailDisplayDisabled < SlackError; end class OrgLoginRequired < SlackError; end class OrgNotFound < SlackError; end + class OrgResolutionRequired < SlackError; end class OrgUserNotInTeam < SlackError; end class OverMaxEntityLimit < SlackError; end class OverPaginationLimit < SlackError; end @@ -523,6 +525,7 @@ class TeamNotFound < SlackError; end class TeamNotOnEnterprise < SlackError; end class TeamQuotaExceeded < SlackError; end class TeamsNotFound < SlackError; end + class TemplateNotVisible < SlackError; end class ThreadLocked < SlackError; end class ThreadNotFound < SlackError; end class TimeInPast < SlackError; end @@ -751,6 +754,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'edit_window_closed' => EditWindowClosed, 'ekm_access_denied' => EkmAccessDenied, 'email_does_not_match' => EmailDoesNotMatch, + 'email_not_verified' => EmailNotVerified, 'email_taken' => EmailTaken, 'emoji_limit_reached' => EmojiLimitReached, 'emoji_not_found' => EmojiNotFound, @@ -1056,6 +1060,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'org_level_email_display_disabled' => OrgLevelEmailDisplayDisabled, 'org_login_required' => OrgLoginRequired, 'org_not_found' => OrgNotFound, + 'org_resolution_required' => OrgResolutionRequired, 'org_user_not_in_team' => OrgUserNotInTeam, 'over_max_entity_limit' => OverMaxEntityLimit, 'over_pagination_limit' => OverPaginationLimit, @@ -1124,6 +1129,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'team_not_on_enterprise' => TeamNotOnEnterprise, 'team_quota_exceeded' => TeamQuotaExceeded, 'teams_not_found' => TeamsNotFound, + 'template_not_visible' => TemplateNotVisible, 'thread_locked' => ThreadLocked, 'thread_not_found' => ThreadNotFound, 'time_in_past' => TimeInPast, diff --git a/lib/slack/web/api/slack-api-ref b/lib/slack/web/api/slack-api-ref index 7c22d0bf..a45def2a 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit 7c22d0bf9325184ea40cfd4651aa9d6e67176d40 +Subproject commit a45def2a00beeabf9ab6cfb8f98015369dcfa295 diff --git a/spec/slack/web/api/endpoints/apps_activities_spec.rb b/spec/slack/web/api/endpoints/apps_activities_spec.rb new file mode 100644 index 00000000..dc0cea9f --- /dev/null +++ b/spec/slack/web/api/endpoints/apps_activities_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::AppsActivities do + let(:client) { Slack::Web::Client.new } + context 'apps.activities_list' do + it 'requires app_id' do + expect { client.apps_activities_list }.to raise_error ArgumentError, /Required arguments :app_id missing/ + end + end +end