Skip to content

Commit

Permalink
Update API from slack-api-ref
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow authored Apr 21, 2023
1 parent 637dfee commit d7b158c
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 9 deletions.
32 changes: 32 additions & 0 deletions bin/commands/apps_auth_external.rb
Original file line number Diff line number Diff line change
@@ -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 'AppsAuthExternal methods.'
command 'apps_auth_external' do |g|
g.desc 'Delete external auth tokens only on the Slack side'
g.long_desc %( Delete external auth tokens only on the Slack side )
g.command 'delete' do |c|
c.flag 'app_id', desc: 'The id of the app whose tokens you want to delete.'
c.flag 'external_token_id', desc: 'The id of the token that you want to delete.'
c.flag 'provider_key', desc: 'The provider key of the provider whose tokens you want to delete.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.apps_auth_external_delete(options))
end
end

g.desc 'Get the access token for the provided token ID'
g.long_desc %( Get the access token for the provided token ID )
g.command 'get' do |c|
c.flag 'external_token_id', desc: 'The id of the token you want to get the token for.'
c.flag 'force_refresh', desc: 'Always refresh existing token before returning even when the token has not expired.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.apps_auth_external_get(options))
end
end
end
end
end
end
3 changes: 2 additions & 1 deletion bin/commands/functions_workflows_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ class App
g.desc "List the steps of a specific function of a workflow's versions"
g.long_desc %( List the steps of a specific function of a workflow's versions )
g.command 'list' do |c|
c.flag 'function_id', desc: '.'
c.flag 'function_id', desc: 'The ID of the function to query.'
c.flag 'workflow', desc: 'The workflow encoded ID or workflow reference.'
c.flag 'workflow_app_id', desc: 'The app tied to the workflow reference.'
c.flag 'workflow_id', desc: 'The workflow ID, starts with Wf*.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.functions_workflows_steps_list(options))
Expand Down
3 changes: 2 additions & 1 deletion bin/commands/functions_workflows_steps_responses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ class App
g.desc 'Download form responses of a workflow'
g.long_desc %( Download form responses of a workflow )
g.command 'export' do |c|
c.flag 'step_id', desc: '.'
c.flag 'step_id', desc: 'The ID of the OpenForm step to export.'
c.flag 'workflow', desc: 'The workflow encoded ID or workflow reference.'
c.flag 'workflow_app_id', desc: 'The app tied to the workflow reference.'
c.flag 'workflow_id', desc: 'The workflow ID, starts with Wf*.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.functions_workflows_steps_responses_export(options))
Expand Down
2 changes: 2 additions & 0 deletions lib/slack/web/api/endpoints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
require_relative 'endpoints/admin_users_unsupportedVersions'
require_relative 'endpoints/api'
require_relative 'endpoints/apps'
require_relative 'endpoints/apps_auth_external'
require_relative 'endpoints/apps_connections'
require_relative 'endpoints/apps_datastore'
require_relative 'endpoints/apps_event_authorizations'
Expand Down Expand Up @@ -105,6 +106,7 @@ module Endpoints
include AdminUsersUnsupportedversions
include Api
include Apps
include AppsAuthExternal
include AppsConnections
include AppsDatastore
include AppsEventAuthorizations
Expand Down
41 changes: 41 additions & 0 deletions lib/slack/web/api/endpoints/apps_auth_external.rb
Original file line number Diff line number Diff line change
@@ -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 AppsAuthExternal
#
# Delete external auth tokens only on the Slack side
#
# @option options [string] :app_id
# The id of the app whose tokens you want to delete.
# @option options [string] :external_token_id
# The id of the token that you want to delete.
# @option options [string] :provider_key
# The provider key of the provider whose tokens you want to delete.
# @see https://api.slack.com/methods/apps.auth.external.delete
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.auth.external/apps.auth.external.delete.json
def apps_auth_external_delete(options = {})
post('apps.auth.external.delete', options)
end

#
# Get the access token for the provided token ID
#
# @option options [string] :external_token_id
# The id of the token you want to get the token for.
# @option options [boolean] :force_refresh
# Always refresh existing token before returning even when the token has not expired.
# @see https://api.slack.com/methods/apps.auth.external.get
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.auth.external/apps.auth.external.get.json
def apps_auth_external_get(options = {})
raise ArgumentError, 'Required arguments :external_token_id missing' if options[:external_token_id].nil?
post('apps.auth.external.get', options)
end
end
end
end
end
end
4 changes: 3 additions & 1 deletion lib/slack/web/api/endpoints/functions_workflows_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ module FunctionsWorkflowsSteps
# List the steps of a specific function of a workflow's versions
#
# @option options [string] :function_id
# .
# The ID of the function to query.
# @option options [string] :workflow
# The workflow encoded ID or workflow reference.
# @option options [string] :workflow_app_id
# The app tied to the workflow reference.
# @option options [string] :workflow_id
# The workflow ID, starts with Wf*.
# @see https://api.slack.com/methods/functions.workflows.steps.list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ module FunctionsWorkflowsStepsResponses
# Download form responses of a workflow
#
# @option options [string] :step_id
# .
# The ID of the OpenForm step to export.
# @option options [string] :workflow
# The workflow encoded ID or workflow reference.
# @option options [string] :workflow_app_id
# The app tied to the workflow reference.
# @option options [string] :workflow_id
# The workflow ID, starts with Wf*.
# @see https://api.slack.com/methods/functions.workflows.steps.responses.export
Expand Down
24 changes: 20 additions & 4 deletions lib/slack/web/api/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class CannotPrompt < SlackError; end
class CannotResetBot < SlackError; end
class CannotResetPrimaryOwner < SlackError; end
class CannotResolveAlias < SlackError; end
class CannotSetBothNumMinutesAndIsIndefinite < SlackError; end
class CannotSetThisGuestToRegularAtTeamLevel < SlackError; end
class CannotShareCrossWorkspaceChannel < SlackError; end
class CannotShareMandatoryChannel < SlackError; end
Expand All @@ -102,6 +101,7 @@ class CantLeaveGeneral < SlackError; end
class CantUpdateMessage < SlackError; end
class CanvasDisabledFileTeam < SlackError; end
class CanvasDisabledUserTeam < SlackError; end
class CanvasGloballyDisabled < SlackError; end
class ChannelArchived < SlackError; end
class ChannelCannotBeUnshared < SlackError; end
class ChannelCanvasDeleted < SlackError; end
Expand Down Expand Up @@ -314,6 +314,7 @@ class InvalidTargetTeam < SlackError; end
class InvalidTeam < SlackError; end
class InvalidTeamId < SlackError; end
class InvalidTeamIds < SlackError; end
class InvalidThreadTs < SlackError; end
class InvalidTime < SlackError; end
class InvalidTimestamp < SlackError; end
class InvalidTitle < SlackError; end
Expand Down Expand Up @@ -342,6 +343,7 @@ class InviteeCantSeeChannel < SlackError; end
class InvitorCannotSeeChannel < SlackError; end
class IsArchived < SlackError; end
class IsBot < SlackError; end
class IsIdpManaged < SlackError; end
class IsInactive < SlackError; end
class IsPendingConnectedToOrg < SlackError; end
class LastMember < SlackError; end
Expand All @@ -355,6 +357,7 @@ class MalwareDetected < SlackError; end
class ManagedChannelNotSupported < SlackError; end
class MemberAnalyticsDisabled < SlackError; end
class MemberLimitExceeded < SlackError; end
class MessageLimitExceeded < SlackError; end
class MessageNotFound < SlackError; end
class MessageTooLong < SlackError; end
class MessagesTabDisabled < SlackError; end
Expand All @@ -363,6 +366,7 @@ class MetadataNotAvailable < SlackError; end
class MetadataOnlyDoesNotSupportDate < SlackError; end
class MetadataTooLarge < SlackError; end
class MethodDeprecated < SlackError; end
class MethodNotSupported < SlackError; end
class MethodNotSupportedForChannelType < SlackError; end
class MigrationInProgress < SlackError; end
class MissingArgs < SlackError; end
Expand Down Expand Up @@ -404,12 +408,14 @@ class NoLocalUserOnTeam < SlackError; end
class NoPermission < SlackError; end
class NoPin < SlackError; end
class NoReaction < SlackError; end
class NoRefreshToken < SlackError; end
class NoResolutionFound < SlackError; end
class NoScopes < SlackError; end
class NoSuchSubteam < SlackError; end
class NoTeamIdsGiven < SlackError; end
class NoTeamsToDisconnect < SlackError; end
class NoText < SlackError; end
class NoTokensFound < SlackError; end
class NoUser < SlackError; end
class NoUsersProvided < SlackError; end
class NoValidChannels < SlackError; end
Expand Down Expand Up @@ -465,6 +471,7 @@ class PostingToGeneralChannelDenied < SlackError; end
class PreviewFeatureNotAvailable < SlackError; end
class PrimaryUsergroupNotFound < SlackError; end
class ProfileSetFailed < SlackError; end
class ProvidersNotFound < SlackError; end
class PublicVideoNotAllowed < SlackError; end
class PublishedAppOnly < SlackError; end
class PushLimitReached < SlackError; end
Expand Down Expand Up @@ -496,7 +503,6 @@ class SlackConnectCanvasSharingBlocked < SlackError; end
class SlackConnectClipSharingBlocked < SlackError; end
class SlackConnectFileLinkSharingBlocked < SlackError; end
class SlackConnectFileUploadSharingBlocked < SlackError; end
class SlackConnectTeamBlocked < SlackError; end
class SnippetTooLarge < SlackError; end
class SnoozeEndFailed < SlackError; end
class SnoozeFailed < SlackError; end
Expand All @@ -521,6 +527,7 @@ class TimeInPast < SlackError; end
class TimeTooFar < SlackError; end
class TokenAlreadyExchanged < SlackError; end
class TokenExpired < SlackError; end
class TokenNotFound < SlackError; end
class TokenRevoked < SlackError; end
class TokenRotationNotEnabled < SlackError; end
class TooLarge < SlackError; end
Expand All @@ -547,6 +554,7 @@ class TooManyUsers < SlackError; end
class TriggerExchanged < SlackError; end
class TriggerExpired < SlackError; end
class TwoFactorSetupRequired < SlackError; end
class UnableToDelete < SlackError; end
class UnableToFetchCustomEmojis < SlackError; end
class UnableToLinkIdpGroupAndChannel < SlackError; end
class UnableToProcessPostRequest < SlackError; end
Expand Down Expand Up @@ -671,7 +679,6 @@ class ViewTooLarge < SlackError; end
'cannot_reset_bot' => CannotResetBot,
'cannot_reset_primary_owner' => CannotResetPrimaryOwner,
'cannot_resolve_alias' => CannotResolveAlias,
'cannot_set_both_num_minutes_and_is_indefinite' => CannotSetBothNumMinutesAndIsIndefinite,
'cannot_set_this_guest_to_regular_at_team_level' => CannotSetThisGuestToRegularAtTeamLevel,
'cannot_share_cross_workspace_channel' => CannotShareCrossWorkspaceChannel,
'cannot_share_mandatory_channel' => CannotShareMandatoryChannel,
Expand All @@ -692,6 +699,7 @@ class ViewTooLarge < SlackError; end
'cant_update_message' => CantUpdateMessage,
'canvas_disabled_file_team' => CanvasDisabledFileTeam,
'canvas_disabled_user_team' => CanvasDisabledUserTeam,
'canvas_globally_disabled' => CanvasGloballyDisabled,
'channel_archived' => ChannelArchived,
'channel_cannot_be_unshared' => ChannelCannotBeUnshared,
'channel_canvas_deleted' => ChannelCanvasDeleted,
Expand Down Expand Up @@ -904,6 +912,7 @@ class ViewTooLarge < SlackError; end
'invalid_team' => InvalidTeam,
'invalid_team_id' => InvalidTeamId,
'invalid_team_ids' => InvalidTeamIds,
'invalid_thread_ts' => InvalidThreadTs,
'invalid_time' => InvalidTime,
'invalid_timestamp' => InvalidTimestamp,
'invalid_title' => InvalidTitle,
Expand Down Expand Up @@ -932,6 +941,7 @@ class ViewTooLarge < SlackError; end
'invitor_cannot_see_channel' => InvitorCannotSeeChannel,
'is_archived' => IsArchived,
'is_bot' => IsBot,
'is_idp_managed' => IsIdpManaged,
'is_inactive' => IsInactive,
'is_pending_connected_to_org' => IsPendingConnectedToOrg,
'last_member' => LastMember,
Expand All @@ -945,6 +955,7 @@ class ViewTooLarge < SlackError; end
'managed_channel_not_supported' => ManagedChannelNotSupported,
'member_analytics_disabled' => MemberAnalyticsDisabled,
'member_limit_exceeded' => MemberLimitExceeded,
'message_limit_exceeded' => MessageLimitExceeded,
'message_not_found' => MessageNotFound,
'message_too_long' => MessageTooLong,
'messages_tab_disabled' => MessagesTabDisabled,
Expand All @@ -953,6 +964,7 @@ class ViewTooLarge < SlackError; end
'metadata_only_does_not_support_date' => MetadataOnlyDoesNotSupportDate,
'metadata_too_large' => MetadataTooLarge,
'method_deprecated' => MethodDeprecated,
'method_not_supported' => MethodNotSupported,
'method_not_supported_for_channel_type' => MethodNotSupportedForChannelType,
'migration_in_progress' => MigrationInProgress,
'missing_args' => MissingArgs,
Expand Down Expand Up @@ -994,12 +1006,14 @@ class ViewTooLarge < SlackError; end
'no_permission' => NoPermission,
'no_pin' => NoPin,
'no_reaction' => NoReaction,
'no_refresh_token' => NoRefreshToken,
'no_resolution_found' => NoResolutionFound,
'no_scopes' => NoScopes,
'no_such_subteam' => NoSuchSubteam,
'no_team_ids_given' => NoTeamIdsGiven,
'no_teams_to_disconnect' => NoTeamsToDisconnect,
'no_text' => NoText,
'no_tokens_found' => NoTokensFound,
'no_user' => NoUser,
'no_users_provided' => NoUsersProvided,
'no_valid_channels' => NoValidChannels,
Expand Down Expand Up @@ -1055,6 +1069,7 @@ class ViewTooLarge < SlackError; end
'preview_feature_not_available' => PreviewFeatureNotAvailable,
'primary_usergroup_not_found' => PrimaryUsergroupNotFound,
'profile_set_failed' => ProfileSetFailed,
'providers_not_found' => ProvidersNotFound,
'public_video_not_allowed' => PublicVideoNotAllowed,
'published_app_only' => PublishedAppOnly,
'push_limit_reached' => PushLimitReached,
Expand Down Expand Up @@ -1086,7 +1101,6 @@ class ViewTooLarge < SlackError; end
'slack_connect_clip_sharing_blocked' => SlackConnectClipSharingBlocked,
'slack_connect_file_link_sharing_blocked' => SlackConnectFileLinkSharingBlocked,
'slack_connect_file_upload_sharing_blocked' => SlackConnectFileUploadSharingBlocked,
'slack_connect_team_blocked' => SlackConnectTeamBlocked,
'snippet_too_large' => SnippetTooLarge,
'snooze_end_failed' => SnoozeEndFailed,
'snooze_failed' => SnoozeFailed,
Expand All @@ -1111,6 +1125,7 @@ class ViewTooLarge < SlackError; end
'time_too_far' => TimeTooFar,
'token_already_exchanged' => TokenAlreadyExchanged,
'token_expired' => TokenExpired,
'token_not_found' => TokenNotFound,
'token_revoked' => TokenRevoked,
'token_rotation_not_enabled' => TokenRotationNotEnabled,
'too_large' => TooLarge,
Expand All @@ -1137,6 +1152,7 @@ class ViewTooLarge < SlackError; end
'trigger_exchanged' => TriggerExchanged,
'trigger_expired' => TriggerExpired,
'two_factor_setup_required' => TwoFactorSetupRequired,
'unable_to_delete' => UnableToDelete,
'unable_to_fetch_custom_emojis' => UnableToFetchCustomEmojis,
'unable_to_link_idp_group_and_channel' => UnableToLinkIdpGroupAndChannel,
'unable_to_process_post_request' => UnableToProcessPostRequest,
Expand Down
13 changes: 13 additions & 0 deletions spec/slack/web/api/endpoints/apps_auth_external_spec.rb
Original file line number Diff line number Diff line change
@@ -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::AppsAuthExternal do
let(:client) { Slack::Web::Client.new }
context 'apps.auth.external_get' do
it 'requires external_token_id' do
expect { client.apps_auth_external_get }.to raise_error ArgumentError, /Required arguments :external_token_id missing/
end
end
end

0 comments on commit d7b158c

Please sign in to comment.