From 401a2b4e1cda57793aae5407a18ebd7d360b4554 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Wed, 7 Oct 2020 20:58:42 +0800 Subject: [PATCH] Update APIs (#348) --- CHANGELOG.md | 1 + bin/commands.rb | 3 + bin/commands/admin_conversations.rb | 128 +++++++++++- bin/commands/admin_conversations_ekm.rb | 17 ++ .../admin_conversations_restrictAccess.rb | 6 +- bin/commands/admin_users_session.rb | 10 + bin/commands/apps_event_authorizations.rb | 16 ++ bin/commands/conversations.rb | 12 +- bin/commands/files.rb | 8 +- bin/commands/files_remote.rb | 4 +- bin/commands/migration.rb | 1 + bin/commands/users.rb | 4 +- bin/commands/views.rb | 2 +- bin/commands/workflows.rb | 38 ++++ lib/slack/web/api/endpoints.rb | 6 + .../web/api/endpoints/admin_conversations.rb | 193 +++++++++++++++++- .../api/endpoints/admin_conversations_ekm.rb | 35 ++++ .../admin_conversations_restrictAccess.rb | 6 +- .../admin_conversations_whitelist.rb | 6 +- .../web/api/endpoints/admin_users_session.rb | 15 ++ .../endpoints/apps_event_authorizations.rb | 34 +++ lib/slack/web/api/endpoints/channels.rb | 2 +- lib/slack/web/api/endpoints/conversations.rb | 18 +- lib/slack/web/api/endpoints/files.rb | 4 +- lib/slack/web/api/endpoints/files_remote.rb | 4 +- lib/slack/web/api/endpoints/groups.rb | 2 +- lib/slack/web/api/endpoints/im.rb | 2 +- lib/slack/web/api/endpoints/migration.rb | 2 + lib/slack/web/api/endpoints/mpim.rb | 2 +- lib/slack/web/api/endpoints/pins.rb | 1 - lib/slack/web/api/endpoints/users.rb | 8 +- lib/slack/web/api/endpoints/views.rb | 2 +- lib/slack/web/api/endpoints/workflows.rb | 61 ++++++ lib/slack/web/api/errors.rb | 130 ++++++++++++ lib/slack/web/api/slack-api-ref | 2 +- lib/slack/web/api/templates/endpoints.erb | 1 + lib/slack/web/api/templates/method_spec.erb | 2 +- .../endpoints/admin_conversations_ekm_spec.rb | 8 + .../api/endpoints/admin_conversations_spec.rb | 67 ++++++ .../api/endpoints/admin_users_session_spec.rb | 8 + .../apps_event_authorizations_spec.rb | 13 ++ .../web/api/endpoints/conversations_spec.rb | 8 + spec/slack/web/api/endpoints/pins_spec.rb | 5 +- .../slack/web/api/endpoints/workflows_spec.rb | 26 +++ 44 files changed, 879 insertions(+), 44 deletions(-) create mode 100644 bin/commands/admin_conversations_ekm.rb create mode 100644 bin/commands/apps_event_authorizations.rb create mode 100644 bin/commands/workflows.rb create mode 100644 lib/slack/web/api/endpoints/admin_conversations_ekm.rb create mode 100644 lib/slack/web/api/endpoints/apps_event_authorizations.rb create mode 100644 lib/slack/web/api/endpoints/workflows.rb create mode 100644 spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb create mode 100644 spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb create mode 100644 spec/slack/web/api/endpoints/workflows_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ee31b09..8a22476a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### 0.15.2 (Next) +* [#348](https://github.com/slack-ruby/slack-ruby-client/pull/348): Added `admin_conversations_archive`, `admin_conversations_convertToPrivate`, `admin_conversations_create`, `admin_conversations_delete`, `admin_conversations_disconnectShared`, `admin_conversations_getConversationPrefs`, `admin_conversations_getTeams`, `admin_conversations_invite`, `admin_conversations_rename`, `admin_conversations_search`, `admin_conversations_setConversationPrefs`, `admin_conversations_unarchive`, `admin_conversations_ekm_listOriginalConnectedChannelInfo`, `admin_users_session_invalidate`, `apps_event_authorizations_list`, `conversations_mark`, `workflows_stepCompleted`, `workflows_stepFailed`, `workflows_updateStep` endpoints - [@wasabigeek](https://github.com/wasabigeek). * Your contribution here. ### 0.15.1 (2020/9/3) diff --git a/bin/commands.rb b/bin/commands.rb index f5a33aef..1a6c0b62 100644 --- a/bin/commands.rb +++ b/bin/commands.rb @@ -6,6 +6,7 @@ require 'commands/admin_apps_requests' require 'commands/admin_apps_restricted' require 'commands/admin_conversations' +require 'commands/admin_conversations_ekm' require 'commands/admin_conversations_restrictAccess' require 'commands/admin_conversations_whitelist' require 'commands/admin_emoji' @@ -21,6 +22,7 @@ require 'commands/admin_users_session' require 'commands/api' require 'commands/apps' +require 'commands/apps_event_authorizations' require 'commands/apps_permissions' require 'commands/apps_permissions_resources' require 'commands/apps_permissions_scopes' @@ -60,3 +62,4 @@ require 'commands/users_prefs' require 'commands/users_profile' require 'commands/views' +require 'commands/workflows' diff --git a/bin/commands/admin_conversations.rb b/bin/commands/admin_conversations.rb index 341ac6c9..b59b5ed1 100644 --- a/bin/commands/admin_conversations.rb +++ b/bin/commands/admin_conversations.rb @@ -3,8 +3,123 @@ desc 'AdminConversations methods.' command 'admin_conversations' do |g| - g.desc 'Set the workspaces in an Enterprise grid org that connect to a channel.' - g.long_desc %( Set the workspaces in an Enterprise grid org that connect to a channel. ) + g.desc 'Archive a public or private channel.' + g.long_desc %( Archive a public or private channel. ) + g.command 'archive' do |c| + c.flag 'channel_id', desc: 'The channel to archive.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_archive(options)) + end + end + + g.desc 'Convert a public channel to a private channel.' + g.long_desc %( Convert a public channel to a private channel. ) + g.command 'convertToPrivate' do |c| + c.flag 'channel_id', desc: 'The channel to convert to private.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_convertToPrivate(options)) + end + end + + g.desc 'Create a public or private channel-based conversation.' + g.long_desc %( Create a public or private channel-based conversation. ) + g.command 'create' do |c| + c.flag 'is_private', desc: 'When true, creates a private channel instead of a public channel.' + c.flag 'name', desc: 'Name of the public or private channel to create.' + c.flag 'description', desc: 'Description of the public or private channel to create.' + c.flag 'org_wide', desc: 'When true, the channel will be available org-wide. Note: if the channel is not org_wide=true, you must specify a team_id for this channel.' + c.flag 'team_id', desc: 'The workspace to create the channel in. Note: this argument is required unless you set org_wide=true.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_create(options)) + end + end + + g.desc 'Delete a public or private channel.' + g.long_desc %( Delete a public or private channel. ) + g.command 'delete' do |c| + c.flag 'channel_id', desc: 'The channel to delete.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_delete(options)) + end + end + + g.desc 'Disconnect a connected channel from one or more workspaces.' + g.long_desc %( Disconnect a connected channel from one or more workspaces. ) + g.command 'disconnectShared' do |c| + c.flag 'channel_id', desc: 'The channel to be disconnected from some workspaces.' + c.flag 'leaving_team_ids', desc: 'The team to be removed from the channel. Currently only a single team id can be specified.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_disconnectShared(options)) + end + end + + g.desc 'Get conversation preferences for a public or private channel.' + g.long_desc %( Get conversation preferences for a public or private channel. ) + g.command 'getConversationPrefs' do |c| + c.flag 'channel_id', desc: 'The channel to get preferences for.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_getConversationPrefs(options)) + end + end + + g.desc 'Get all the workspaces a given public or private channel is connected to within this Enterprise org.' + g.long_desc %( Get all the workspaces a given public or private channel is connected to within this Enterprise org. ) + g.command 'getTeams' do |c| + c.flag 'channel_id', desc: 'The channel to determine connected workspaces within the organization for.' + c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.' + c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_getTeams(options)) + end + end + + g.desc 'Invite a user to a public or private channel.' + g.long_desc %( Invite a user to a public or private channel. ) + g.command 'invite' do |c| + c.flag 'channel_id', desc: 'The channel that the users will be invited to.' + c.flag 'user_ids', desc: 'The users to invite.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_invite(options)) + end + end + + g.desc 'Rename a public or private channel.' + g.long_desc %( Rename a public or private channel. ) + g.command 'rename' do |c| + c.flag 'channel_id', desc: 'The channel to rename.' + c.flag 'name', desc: '.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_rename(options)) + end + end + + g.desc 'Search for public or private channels in an Enterprise organization.' + g.long_desc %( Search for public or private channels in an Enterprise organization. ) + g.command 'search' do |c| + c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.' + c.flag 'limit', desc: 'Maximum number of items to be returned. Must be between 1 - 20 both inclusive. Default is 10.' + c.flag 'query', desc: 'Name of the the channel to query by.' + c.flag 'search_channel_types', desc: 'The type of channel to include or exclude in the search. For example private will search private channels, while private_exclude will exclude them. For a full list of types, check the Types section.' + c.flag 'sort', desc: 'Possible values are relevant (search ranking based on what we think is closest), name (alphabetical), member_count (number of users in the channel), and created (date channel was created). You can optionally pair this with the sort_dir arg to change how it is sorted.' + c.flag 'sort_dir', desc: 'Sort direction. Possible values are asc for ascending order like (1, 2, 3) or (a, b, c), and desc for descending order like (3, 2, 1) or (c, b, a).' + c.flag 'team_ids', desc: 'Comma separated string of team IDs, signifying the workspaces to search through.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_search(options)) + end + end + + g.desc 'Set the posting permissions for a public or private channel.' + g.long_desc %( Set the posting permissions for a public or private channel. ) + g.command 'setConversationPrefs' do |c| + c.flag 'channel_id', desc: 'The channel to set the prefs for.' + c.flag 'prefs', desc: 'The prefs for this channel in a stringified JSON format.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_setConversationPrefs(options)) + end + end + + g.desc 'Set the workspaces in an Enterprise grid org that connect to a public or private channel.' + g.long_desc %( Set the workspaces in an Enterprise grid org that connect to a public or private channel. ) g.command 'setTeams' do |c| 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.' @@ -14,4 +129,13 @@ puts JSON.dump($client.admin_conversations_setTeams(options)) end end + + g.desc 'Unarchive a public or private channel.' + g.long_desc %( Unarchive a public or private channel. ) + g.command 'unarchive' do |c| + c.flag 'channel_id', desc: 'The channel to unarchive.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_unarchive(options)) + end + end end diff --git a/bin/commands/admin_conversations_ekm.rb b/bin/commands/admin_conversations_ekm.rb new file mode 100644 index 00000000..e3667855 --- /dev/null +++ b/bin/commands/admin_conversations_ekm.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +desc 'AdminConversationsEkm methods.' +command 'admin_conversations_ekm' do |g| + g.desc 'List all disconnected channels—i.e., channels that were once connected to other workspaces and then disconnected—and the corresponding original channel IDs for key revocation with EKM.' + g.long_desc %( List all disconnected channels—i.e., channels that were once connected to other workspaces and then disconnected—and the corresponding original channel IDs for key revocation with EKM. ) + g.command 'listOriginalConnectedChannelInfo' do |c| + c.flag 'channel_ids', desc: 'A comma-separated list of channels to filter to.' + c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.' + c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.' + c.flag 'team_ids', desc: 'A comma-separated list of the workspaces to which the channels you would like returned belong.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_ekm_listOriginalConnectedChannelInfo(options)) + end + end +end diff --git a/bin/commands/admin_conversations_restrictAccess.rb b/bin/commands/admin_conversations_restrictAccess.rb index 920e353b..1c142f7b 100644 --- a/bin/commands/admin_conversations_restrictAccess.rb +++ b/bin/commands/admin_conversations_restrictAccess.rb @@ -8,7 +8,7 @@ g.command 'addGroup' do |c| c.flag 'channel_id', desc: 'The channel to link this group to.' c.flag 'group_id', desc: 'The IDP Group ID to be an allowlist for the private channel.' - c.flag 'team_id', desc: 'The workspace where the IDP Group and channel exist.' + c.flag 'team_id', desc: 'The workspace where the channel exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization.' c.action do |_global_options, options, _args| puts JSON.dump($client.admin_conversations_restrictAccess_addGroup(options)) end @@ -18,7 +18,7 @@ g.long_desc %( List all IDP Groups linked to a channel ) g.command 'listGroups' do |c| c.flag 'channel_id', desc: '.' - c.flag 'team_id', desc: 'The workspace where the channele exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization.' + c.flag 'team_id', desc: 'The workspace where the channel exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization.' c.action do |_global_options, options, _args| puts JSON.dump($client.admin_conversations_restrictAccess_listGroups(options)) end @@ -29,7 +29,7 @@ g.command 'removeGroup' do |c| c.flag 'channel_id', desc: 'The channel to remove the linked group from.' c.flag 'group_id', desc: 'The IDP Group ID to remove from the private channel.' - c.flag 'team_id', desc: 'The workspace where the IDP Group and channel exist.' + c.flag 'team_id', desc: 'The workspace where the channel exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization.' c.action do |_global_options, options, _args| puts JSON.dump($client.admin_conversations_restrictAccess_removeGroup(options)) end diff --git a/bin/commands/admin_users_session.rb b/bin/commands/admin_users_session.rb index a03302fd..dde35eb8 100644 --- a/bin/commands/admin_users_session.rb +++ b/bin/commands/admin_users_session.rb @@ -3,6 +3,16 @@ desc 'AdminUsersSession methods.' command 'admin_users_session' do |g| + g.desc 'Invalidate a single session for a user by session_id' + g.long_desc %( Invalidate a single session for a user by session_id ) + g.command 'invalidate' do |c| + c.flag 'session_id', desc: '.' + c.flag 'team_id', desc: 'ID of the team that the session belongs to.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_users_session_invalidate(options)) + end + end + g.desc 'Wipes all valid sessions on all devices for a given user' g.long_desc %( Wipes all valid sessions on all devices for a given user ) g.command 'reset' do |c| diff --git a/bin/commands/apps_event_authorizations.rb b/bin/commands/apps_event_authorizations.rb new file mode 100644 index 00000000..697b9bff --- /dev/null +++ b/bin/commands/apps_event_authorizations.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +desc 'AppsEventAuthorizations methods.' +command 'apps_event_authorizations' do |g| + g.desc 'Get a list of authorizations for the given event context. Each authorization represents an app installation that the event is visible to.' + g.long_desc %( Get a list of authorizations for the given event context. Each authorization represents an app installation that the event is visible to. ) + g.command 'list' do |c| + c.flag 'event_context', desc: '.' + c.flag 'cursor', desc: '.' + c.flag 'limit', desc: '.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.apps_event_authorizations_list(options)) + end + end +end diff --git a/bin/commands/conversations.rb b/bin/commands/conversations.rb index 99b01db8..1283b3a8 100644 --- a/bin/commands/conversations.rb +++ b/bin/commands/conversations.rb @@ -106,6 +106,16 @@ end end + g.desc 'Sets the read cursor in a channel.' + g.long_desc %( Sets the read cursor in a channel. ) + g.command 'mark' do |c| + c.flag 'channel', desc: 'Channel or conversation to set the read cursor for.' + c.flag 'ts', desc: 'Unique identifier of message you want marked as most recently seen in this conversation.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.conversations_mark(options)) + end + end + g.desc 'Retrieve members of a conversation.' g.long_desc %( Retrieve members of a conversation. ) g.command 'members' do |c| @@ -142,7 +152,7 @@ g.long_desc %( Retrieve a thread of messages posted to a conversation ) g.command 'replies' do |c| c.flag 'channel', desc: 'Conversation ID to fetch thread from.' - c.flag 'ts', desc: "Unique identifier of a thread's parent message." + c.flag 'ts', desc: "Unique identifier of a thread's parent message. ts must be the timestamp of an existing message with 0 or more replies. If there are no replies then just the single message referenced by ts will return - it is just an ordinary, unthreaded message." 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. Default value fetches the first 'page' of the collection. See pagination for more detail." c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results only when either timestamp is specified.' c.flag 'latest', desc: 'End of time range of messages to include in results.' diff --git a/bin/commands/files.rb b/bin/commands/files.rb index 52d4be92..afef9229 100644 --- a/bin/commands/files.rb +++ b/bin/commands/files.rb @@ -23,8 +23,8 @@ end end - g.desc 'Gets information about a team file.' - g.long_desc %( Gets information about a team file. ) + g.desc 'Gets information about a file.' + g.long_desc %( Gets information about a file. ) g.command 'info' do |c| c.flag 'file', desc: 'Specify a file by providing its ID.' c.flag 'cursor', desc: "Parameter for pagination. File comments are paginated for a single file. 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 of comments. See pagination for more details." @@ -34,8 +34,8 @@ end end - g.desc 'Lists & filters team files.' - g.long_desc %( Lists & filters team files. ) + g.desc 'List for a team, in a channel, or from a user with applied filters.' + g.long_desc %( List for a team, in a channel, or from a user with applied filters. ) g.command 'list' do |c| c.flag 'channel', desc: 'Filter files appearing in a specific channel, indicated by its ID.' c.flag 'show_files_hidden_by_limit', desc: 'Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit.' diff --git a/bin/commands/files_remote.rb b/bin/commands/files_remote.rb index 15c689fd..fd7f406d 100644 --- a/bin/commands/files_remote.rb +++ b/bin/commands/files_remote.rb @@ -54,8 +54,8 @@ g.long_desc %( Share a remote file into a channel. ) g.command 'share' do |c| c.flag 'channels', desc: 'Comma-separated list of channel IDs where the file will be shared.' - c.flag 'external_id', desc: 'Creator defined GUID for the file.' - c.flag 'file', desc: 'Specify a file by providing its ID.' + c.flag 'external_id', desc: 'The globally unique identifier (GUID) for the file, as set by the app registering the file with Slack. Either this field or file or both are required.' + c.flag 'file', desc: 'Specify a file registered with Slack by providing its ID. Either this field or external_id or both are required.' c.action do |_global_options, options, _args| puts JSON.dump($client.files_remote_share(options)) end diff --git a/bin/commands/migration.rb b/bin/commands/migration.rb index 4f5c9d61..d90aa5ec 100644 --- a/bin/commands/migration.rb +++ b/bin/commands/migration.rb @@ -7,6 +7,7 @@ g.long_desc %( For Enterprise Grid workspaces, map local user IDs to global user IDs ) g.command 'exchange' do |c| c.flag 'users', desc: 'A comma-separated list of user ids, up to 400 per request.' + c.flag 'team_id', desc: 'Specify team_id starts with T in case of Org Token.' c.flag 'to_old', desc: 'Specify true to convert W global user IDs to workspace-specific U IDs. Defaults to false.' c.action do |_global_options, options, _args| puts JSON.dump($client.migration_exchange(options)) diff --git a/bin/commands/users.rb b/bin/commands/users.rb index cf751028..a0cbe486 100644 --- a/bin/commands/users.rb +++ b/bin/commands/users.rb @@ -65,7 +65,7 @@ g.command 'list' do |c| 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. Default value fetches the first 'page' of the collection. See pagination for more detail." c.flag 'include_locale', desc: 'Set this to true to receive the locale for users. Defaults to false.' - 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 users list hasn't been reached." + 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 users list hasn't been reached. Providing no limit value will result in Slack attempting to deliver you the entire result set. If the collection is too large you may experience limit_required or HTTP 500 errors." c.action do |_global_options, options, _args| puts JSON.dump($client.users_list(options)) end @@ -100,10 +100,10 @@ g.desc 'Set the user profile photo' g.long_desc %( Set the user profile photo ) g.command 'setPhoto' do |c| - c.flag 'image', desc: 'File contents via multipart/form-data.' c.flag 'crop_w', desc: 'Width/height of crop box (always square).' c.flag 'crop_x', desc: 'X coordinate of top-left corner of crop box.' c.flag 'crop_y', desc: 'Y coordinate of top-left corner of crop box.' + c.flag 'image', desc: 'File contents via multipart/form-data.' c.action do |_global_options, options, _args| puts JSON.dump($client.users_setPhoto(options)) end diff --git a/bin/commands/views.rb b/bin/commands/views.rb index 23ac8832..79429482 100644 --- a/bin/commands/views.rb +++ b/bin/commands/views.rb @@ -37,7 +37,7 @@ g.desc 'Update an existing view.' g.long_desc %( Update an existing view. ) g.command 'update' do |c| - c.flag 'view', desc: 'A view payload This must be a JSON-encoded string.' + c.flag 'view', desc: 'A view object. This must be a JSON-encoded string.' c.flag 'external_id', desc: 'A unique identifier of the view set by the developer. Must be unique for all views on a team. Max length of 255 characters. Either view_id or external_id is required.' c.flag 'hash', desc: 'A string that represents view state to protect against possible race conditions.' c.flag 'view_id', desc: 'A unique identifier of the view to be updated. Either view_id or external_id is required.' diff --git a/bin/commands/workflows.rb b/bin/commands/workflows.rb new file mode 100644 index 00000000..db918b6a --- /dev/null +++ b/bin/commands/workflows.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +desc 'Workflows methods.' +command 'workflows' do |g| + g.desc "Indicate that an app's step in a workflow completed execution." + g.long_desc %( Indicate that an app's step in a workflow completed execution. ) + g.command 'stepCompleted' do |c| + c.flag 'workflow_step_execute_id', desc: 'Context identifier that maps to the correct workflow step execution.' + c.flag 'outputs', desc: 'Key-value object of outputs from your step. Keys of this object reflect the configured key properties of your outputs array from your workflow_step object.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.workflows_stepCompleted(options)) + end + end + + g.desc "Indicate that an app's step in a workflow failed to execute." + g.long_desc %( Indicate that an app's step in a workflow failed to execute. ) + g.command 'stepFailed' do |c| + c.flag 'error', desc: 'A JSON-based object with a message property that should contain a human readable error message.' + c.flag 'workflow_step_execute_id', desc: 'Context identifier that maps to the correct workflow step execution.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.workflows_stepFailed(options)) + end + end + + g.desc 'Update the configuration for a workflow extension step.' + g.long_desc %( Update the configuration for a workflow extension step. ) + g.command 'updateStep' do |c| + c.flag 'workflow_step_edit_id', desc: 'A context identifier provided with view_submission payloads used to call back to workflows.updateStep.' + c.flag 'inputs', desc: 'A JSON key-value map of inputs required from a user during configuration. This is the data your app expects to receive when the workflow step starts. Please note: the embedded variable format is set and replaced by the workflow system. You cannot create custom variables that will be replaced at runtime. Read more about variables in workflow steps here.' + c.flag 'outputs', desc: 'An JSON array of output objects used during step execution. This is the data your app agrees to provide when your workflow step was executed.' + c.flag 'step_image_url', desc: 'An optional field that can be used to override app image that is shown in the Workflow Builder.' + c.flag 'step_name', desc: 'An optional field that can be used to override the step name that is shown in the Workflow Builder.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.workflows_updateStep(options)) + end + end +end diff --git a/lib/slack/web/api/endpoints.rb b/lib/slack/web/api/endpoints.rb index 2afd4b8f..eb00296b 100644 --- a/lib/slack/web/api/endpoints.rb +++ b/lib/slack/web/api/endpoints.rb @@ -6,6 +6,7 @@ require_relative 'endpoints/admin_apps_requests' require_relative 'endpoints/admin_apps_restricted' require_relative 'endpoints/admin_conversations' +require_relative 'endpoints/admin_conversations_ekm' require_relative 'endpoints/admin_conversations_restrictAccess' require_relative 'endpoints/admin_conversations_whitelist' require_relative 'endpoints/admin_emoji' @@ -21,6 +22,7 @@ require_relative 'endpoints/admin_users_session' require_relative 'endpoints/api' require_relative 'endpoints/apps' +require_relative 'endpoints/apps_event_authorizations' require_relative 'endpoints/apps_permissions' require_relative 'endpoints/apps_permissions_resources' require_relative 'endpoints/apps_permissions_scopes' @@ -60,6 +62,7 @@ require_relative 'endpoints/users_prefs' require_relative 'endpoints/users_profile' require_relative 'endpoints/views' +require_relative 'endpoints/workflows' module Slack module Web @@ -75,6 +78,7 @@ module Endpoints include AdminAppsRequests include AdminAppsRestricted include AdminConversations + include AdminConversationsEkm include AdminConversationsRestrictaccess include AdminConversationsWhitelist include AdminEmoji @@ -90,6 +94,7 @@ module Endpoints include AdminUsersSession include Api include Apps + include AppsEventAuthorizations include AppsPermissions include AppsPermissionsResources include AppsPermissionsScopes @@ -129,6 +134,7 @@ module Endpoints include UsersPrefs include UsersProfile include Views + include Workflows end end end diff --git a/lib/slack/web/api/endpoints/admin_conversations.rb b/lib/slack/web/api/endpoints/admin_conversations.rb index 0c5433d9..178208ee 100644 --- a/lib/slack/web/api/endpoints/admin_conversations.rb +++ b/lib/slack/web/api/endpoints/admin_conversations.rb @@ -7,7 +7,186 @@ module Api module Endpoints module AdminConversations # - # Set the workspaces in an Enterprise grid org that connect to a channel. + # Archive a public or private channel. + # + # @option options [Object] :channel_id + # The channel to archive. + # @see https://api.slack.com/methods/admin.conversations.archive + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.archive.json + def admin_conversations_archive(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + post('admin.conversations.archive', options) + end + + # + # Convert a public channel to a private channel. + # + # @option options [Object] :channel_id + # The channel to convert to private. + # @see https://api.slack.com/methods/admin.conversations.convertToPrivate + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.convertToPrivate.json + def admin_conversations_convertToPrivate(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + post('admin.conversations.convertToPrivate', options) + end + + # + # Create a public or private channel-based conversation. + # + # @option options [Object] :is_private + # When true, creates a private channel instead of a public channel. + # @option options [Object] :name + # Name of the public or private channel to create. + # @option options [Object] :description + # Description of the public or private channel to create. + # @option options [Object] :org_wide + # When true, the channel will be available org-wide. Note: if the channel is not org_wide=true, you must specify a team_id for this channel. + # @option options [Object] :team_id + # The workspace to create the channel in. Note: this argument is required unless you set org_wide=true. + # @see https://api.slack.com/methods/admin.conversations.create + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.create.json + def admin_conversations_create(options = {}) + throw ArgumentError.new('Required arguments :is_private missing') if options[:is_private].nil? + throw ArgumentError.new('Required arguments :name missing') if options[:name].nil? + post('admin.conversations.create', options) + end + + # + # Delete a public or private channel. + # + # @option options [Object] :channel_id + # The channel to delete. + # @see https://api.slack.com/methods/admin.conversations.delete + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.delete.json + def admin_conversations_delete(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + post('admin.conversations.delete', options) + end + + # + # Disconnect a connected channel from one or more workspaces. + # + # @option options [Object] :channel_id + # The channel to be disconnected from some workspaces. + # @option options [Object] :leaving_team_ids + # The team to be removed from the channel. Currently only a single team id can be specified. + # @see https://api.slack.com/methods/admin.conversations.disconnectShared + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.disconnectShared.json + def admin_conversations_disconnectShared(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + post('admin.conversations.disconnectShared', options) + end + + # + # Get conversation preferences for a public or private channel. + # + # @option options [Object] :channel_id + # The channel to get preferences for. + # @see https://api.slack.com/methods/admin.conversations.getConversationPrefs + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.getConversationPrefs.json + def admin_conversations_getConversationPrefs(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + post('admin.conversations.getConversationPrefs', options) + end + + # + # Get all the workspaces a given public or private channel is connected to within this Enterprise org. + # + # @option options [Object] :channel_id + # The channel to determine connected workspaces within the organization for. + # @option options [Object] :cursor + # Set cursor to next_cursor returned by the previous call to list items in the next page. + # @option options [Object] :limit + # The maximum number of items to return. Must be between 1 - 1000 both inclusive. + # @see https://api.slack.com/methods/admin.conversations.getTeams + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.getTeams.json + def admin_conversations_getTeams(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + if block_given? + Pagination::Cursor.new(self, :admin_conversations_getTeams, options).each do |page| + yield page + end + else + post('admin.conversations.getTeams', options) + end + end + + # + # Invite a user to a public or private channel. + # + # @option options [Object] :channel_id + # The channel that the users will be invited to. + # @option options [Object] :user_ids + # The users to invite. + # @see https://api.slack.com/methods/admin.conversations.invite + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.invite.json + def admin_conversations_invite(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + throw ArgumentError.new('Required arguments :user_ids missing') if options[:user_ids].nil? + post('admin.conversations.invite', options) + end + + # + # Rename a public or private channel. + # + # @option options [Object] :channel_id + # The channel to rename. + # @option options [Object] :name + # . + # @see https://api.slack.com/methods/admin.conversations.rename + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.rename.json + def admin_conversations_rename(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + throw ArgumentError.new('Required arguments :name missing') if options[:name].nil? + post('admin.conversations.rename', options) + end + + # + # Search for public or private channels in an Enterprise organization. + # + # @option options [Object] :cursor + # Set cursor to next_cursor returned by the previous call to list items in the next page. + # @option options [Object] :limit + # Maximum number of items to be returned. Must be between 1 - 20 both inclusive. Default is 10. + # @option options [Object] :query + # Name of the the channel to query by. + # @option options [Object] :search_channel_types + # The type of channel to include or exclude in the search. For example private will search private channels, while private_exclude will exclude them. For a full list of types, check the Types section. + # @option options [Object] :sort + # Possible values are relevant (search ranking based on what we think is closest), name (alphabetical), member_count (number of users in the channel), and created (date channel was created). You can optionally pair this with the sort_dir arg to change how it is sorted. + # @option options [Object] :sort_dir + # Sort direction. Possible values are asc for ascending order like (1, 2, 3) or (a, b, c), and desc for descending order like (3, 2, 1) or (c, b, a). + # @option options [Object] :team_ids + # Comma separated string of team IDs, signifying the workspaces to search through. + # @see https://api.slack.com/methods/admin.conversations.search + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.search.json + def admin_conversations_search(options = {}) + if block_given? + Pagination::Cursor.new(self, :admin_conversations_search, options).each do |page| + yield page + end + else + post('admin.conversations.search', options) + end + end + + # + # Set the posting permissions for a public or private channel. + # + # @option options [Object] :channel_id + # The channel to set the prefs for. + # @option options [Object] :prefs + # The prefs for this channel in a stringified JSON format. + # @see https://api.slack.com/methods/admin.conversations.setConversationPrefs + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.setConversationPrefs.json + def admin_conversations_setConversationPrefs(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + throw ArgumentError.new('Required arguments :prefs missing') if options[:prefs].nil? + post('admin.conversations.setConversationPrefs', options) + end + + # + # Set the workspaces in an Enterprise grid org that connect to a public or private channel. # # @option options [Object] :channel_id # The encoded channel_id to add or remove to workspaces. @@ -23,6 +202,18 @@ def admin_conversations_setTeams(options = {}) throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? post('admin.conversations.setTeams', options) end + + # + # Unarchive a public or private channel. + # + # @option options [Object] :channel_id + # The channel to unarchive. + # @see https://api.slack.com/methods/admin.conversations.unarchive + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.unarchive.json + def admin_conversations_unarchive(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + post('admin.conversations.unarchive', options) + end end end end diff --git a/lib/slack/web/api/endpoints/admin_conversations_ekm.rb b/lib/slack/web/api/endpoints/admin_conversations_ekm.rb new file mode 100644 index 00000000..c6ce5a2c --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_conversations_ekm.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AdminConversationsEkm + # + # List all disconnected channels—i.e., channels that were once connected to other workspaces and then disconnected—and the corresponding original channel IDs for key revocation with EKM. + # + # @option options [Object] :channel_ids + # A comma-separated list of channels to filter to. + # @option options [Object] :cursor + # Set cursor to next_cursor returned by the previous call to list items in the next page. + # @option options [Object] :limit + # The maximum number of items to return. Must be between 1 - 1000 both inclusive. + # @option options [Object] :team_ids + # A comma-separated list of the workspaces to which the channels you would like returned belong. + # @see https://api.slack.com/methods/admin.conversations.ekm.listOriginalConnectedChannelInfo + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.ekm/admin.conversations.ekm.listOriginalConnectedChannelInfo.json + def admin_conversations_ekm_listOriginalConnectedChannelInfo(options = {}) + if block_given? + Pagination::Cursor.new(self, :admin_conversations_ekm_listOriginalConnectedChannelInfo, options).each do |page| + yield page + end + else + post('admin.conversations.ekm.listOriginalConnectedChannelInfo', options) + end + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb b/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb index 77ffd616..445952fe 100644 --- a/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +++ b/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb @@ -14,7 +14,7 @@ module AdminConversationsRestrictaccess # @option options [Object] :group_id # The IDP Group ID to be an allowlist for the private channel. # @option options [Object] :team_id - # The workspace where the IDP Group and channel exist. + # The workspace where the channel exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization. # @see https://api.slack.com/methods/admin.conversations.restrictAccess.addGroup # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.restrictAccess/admin.conversations.restrictAccess.addGroup.json def admin_conversations_restrictAccess_addGroup(options = {}) @@ -29,7 +29,7 @@ def admin_conversations_restrictAccess_addGroup(options = {}) # @option options [Object] :channel_id # . # @option options [Object] :team_id - # The workspace where the channele exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization. + # The workspace where the channel exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization. # @see https://api.slack.com/methods/admin.conversations.restrictAccess.listGroups # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.restrictAccess/admin.conversations.restrictAccess.listGroups.json def admin_conversations_restrictAccess_listGroups(options = {}) @@ -45,7 +45,7 @@ def admin_conversations_restrictAccess_listGroups(options = {}) # @option options [Object] :group_id # The IDP Group ID to remove from the private channel. # @option options [Object] :team_id - # The workspace where the IDP Group and channel exist. + # The workspace where the channel exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization. # @see https://api.slack.com/methods/admin.conversations.restrictAccess.removeGroup # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.restrictAccess/admin.conversations.restrictAccess.removeGroup.json def admin_conversations_restrictAccess_removeGroup(options = {}) diff --git a/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb b/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb index 18ab4d84..07c6f5b3 100644 --- a/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +++ b/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb @@ -20,7 +20,7 @@ module AdminConversationsWhitelist def admin_conversations_whitelist_add(options = {}) throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? throw ArgumentError.new('Required arguments :group_id missing') if options[:group_id].nil? - logger.warn('admin.conversations.whitelist.add: Alternative methods: .') + logger.warn('admin.conversations.whitelist.add: This method is deprecated Alternative methods: .') post('admin.conversations.whitelist.add', options) end @@ -35,7 +35,7 @@ def admin_conversations_whitelist_add(options = {}) # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.whitelist/admin.conversations.whitelist.listGroupsLinkedToChannel.json def admin_conversations_whitelist_listGroupsLinkedToChannel(options = {}) throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? - logger.warn('admin.conversations.whitelist.listGroupsLinkedToChannel: Alternative methods: .') + logger.warn('admin.conversations.whitelist.listGroupsLinkedToChannel: This method is deprecated Alternative methods: .') post('admin.conversations.whitelist.listGroupsLinkedToChannel', options) end @@ -54,7 +54,7 @@ def admin_conversations_whitelist_remove(options = {}) throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? throw ArgumentError.new('Required arguments :group_id missing') if options[:group_id].nil? throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil? - logger.warn('admin.conversations.whitelist.remove: Alternative methods: .') + logger.warn('admin.conversations.whitelist.remove: This method is deprecated Alternative methods: .') post('admin.conversations.whitelist.remove', options) end end diff --git a/lib/slack/web/api/endpoints/admin_users_session.rb b/lib/slack/web/api/endpoints/admin_users_session.rb index 570de223..6d1a2d27 100644 --- a/lib/slack/web/api/endpoints/admin_users_session.rb +++ b/lib/slack/web/api/endpoints/admin_users_session.rb @@ -6,6 +6,21 @@ module Web module Api module Endpoints module AdminUsersSession + # + # Invalidate a single session for a user by session_id + # + # @option options [Object] :session_id + # . + # @option options [Object] :team_id + # ID of the team that the session belongs to. + # @see https://api.slack.com/methods/admin.users.session.invalidate + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users.session/admin.users.session.invalidate.json + def admin_users_session_invalidate(options = {}) + throw ArgumentError.new('Required arguments :session_id missing') if options[:session_id].nil? + throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil? + post('admin.users.session.invalidate', options) + end + # # Wipes all valid sessions on all devices for a given user # diff --git a/lib/slack/web/api/endpoints/apps_event_authorizations.rb b/lib/slack/web/api/endpoints/apps_event_authorizations.rb new file mode 100644 index 00000000..344d0222 --- /dev/null +++ b/lib/slack/web/api/endpoints/apps_event_authorizations.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AppsEventAuthorizations + # + # Get a list of authorizations for the given event context. Each authorization represents an app installation that the event is visible to. + # + # @option options [Object] :event_context + # . + # @option options [Object] :cursor + # . + # @option options [Object] :limit + # . + # @see https://api.slack.com/methods/apps.event.authorizations.list + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.event.authorizations/apps.event.authorizations.list.json + def apps_event_authorizations_list(options = {}) + throw ArgumentError.new('Required arguments :event_context missing') if options[:event_context].nil? + if block_given? + Pagination::Cursor.new(self, :apps_event_authorizations_list, options).each do |page| + yield page + end + else + post('apps.event.authorizations.list', options) + end + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/channels.rb b/lib/slack/web/api/endpoints/channels.rb index 3a1b4244..1c788e1b 100644 --- a/lib/slack/web/api/endpoints/channels.rb +++ b/lib/slack/web/api/endpoints/channels.rb @@ -188,7 +188,7 @@ def channels_mark(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil? options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] - logger.warn('channels.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: .') + logger.warn('channels.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.mark.') post('channels.mark', options) end diff --git a/lib/slack/web/api/endpoints/conversations.rb b/lib/slack/web/api/endpoints/conversations.rb index a43e959c..0a8cdbd7 100644 --- a/lib/slack/web/api/endpoints/conversations.rb +++ b/lib/slack/web/api/endpoints/conversations.rb @@ -174,6 +174,22 @@ def conversations_list(options = {}) end end + # + # Sets the read cursor in a channel. + # + # @option options [channel] :channel + # Channel or conversation to set the read cursor for. + # @option options [timestamp] :ts + # Unique identifier of message you want marked as most recently seen in this conversation. + # @see https://api.slack.com/methods/conversations.mark + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.mark.json + def conversations_mark(options = {}) + throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? + throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil? + options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] + post('conversations.mark', options) + end + # # Retrieve members of a conversation. # @@ -235,7 +251,7 @@ def conversations_rename(options = {}) # @option options [channel] :channel # Conversation ID to fetch thread from. # @option options [timestamp] :ts - # Unique identifier of a thread's parent message. + # Unique identifier of a thread's parent message. ts must be the timestamp of an existing message with 0 or more replies. If there are no replies then just the single message referenced by ts will return - it is just an ordinary, unthreaded message. # @option options [Object] :cursor # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. # @option options [Object] :inclusive diff --git a/lib/slack/web/api/endpoints/files.rb b/lib/slack/web/api/endpoints/files.rb index b91375f9..4fc73396 100644 --- a/lib/slack/web/api/endpoints/files.rb +++ b/lib/slack/web/api/endpoints/files.rb @@ -36,7 +36,7 @@ def files_edit(options = {}) end # - # Gets information about a team file. + # Gets information about a file. # # @option options [file] :file # Specify a file by providing its ID. @@ -58,7 +58,7 @@ def files_info(options = {}) end # - # Lists & filters team files. + # List for a team, in a channel, or from a user with applied filters. # # @option options [channel] :channel # Filter files appearing in a specific channel, indicated by its ID. diff --git a/lib/slack/web/api/endpoints/files_remote.rb b/lib/slack/web/api/endpoints/files_remote.rb index bc477785..95118afd 100644 --- a/lib/slack/web/api/endpoints/files_remote.rb +++ b/lib/slack/web/api/endpoints/files_remote.rb @@ -88,9 +88,9 @@ def files_remote_remove(options = {}) # @option options [Object] :channels # Comma-separated list of channel IDs where the file will be shared. # @option options [Object] :external_id - # Creator defined GUID for the file. + # The globally unique identifier (GUID) for the file, as set by the app registering the file with Slack. Either this field or file or both are required. # @option options [file] :file - # Specify a file by providing its ID. + # Specify a file registered with Slack by providing its ID. Either this field or external_id or both are required. # @see https://api.slack.com/methods/files.remote.share # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.remote/files.remote.share.json def files_remote_share(options = {}) diff --git a/lib/slack/web/api/endpoints/groups.rb b/lib/slack/web/api/endpoints/groups.rb index 31cd18d4..baafbd21 100644 --- a/lib/slack/web/api/endpoints/groups.rb +++ b/lib/slack/web/api/endpoints/groups.rb @@ -174,7 +174,7 @@ def groups_mark(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil? options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel] - logger.warn('groups.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: .') + logger.warn('groups.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.mark.') post('groups.mark', options) end diff --git a/lib/slack/web/api/endpoints/im.rb b/lib/slack/web/api/endpoints/im.rb index ad1f87da..a127d65d 100644 --- a/lib/slack/web/api/endpoints/im.rb +++ b/lib/slack/web/api/endpoints/im.rb @@ -75,7 +75,7 @@ def im_mark(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil? options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] - logger.warn('im.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: .') + logger.warn('im.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.mark.') post('im.mark', options) end diff --git a/lib/slack/web/api/endpoints/migration.rb b/lib/slack/web/api/endpoints/migration.rb index 718f2d12..ac0db7c6 100644 --- a/lib/slack/web/api/endpoints/migration.rb +++ b/lib/slack/web/api/endpoints/migration.rb @@ -11,6 +11,8 @@ module Migration # # @option options [Object] :users # A comma-separated list of user ids, up to 400 per request. + # @option options [Object] :team_id + # Specify team_id starts with T in case of Org Token. # @option options [Object] :to_old # Specify true to convert W global user IDs to workspace-specific U IDs. Defaults to false. # @see https://api.slack.com/methods/migration.exchange diff --git a/lib/slack/web/api/endpoints/mpim.rb b/lib/slack/web/api/endpoints/mpim.rb index 3a1d2be3..19f2b897 100644 --- a/lib/slack/web/api/endpoints/mpim.rb +++ b/lib/slack/web/api/endpoints/mpim.rb @@ -75,7 +75,7 @@ def mpim_mark(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil? options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] - logger.warn('mpim.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: .') + logger.warn('mpim.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.mark.') post('mpim.mark', options) end diff --git a/lib/slack/web/api/endpoints/pins.rb b/lib/slack/web/api/endpoints/pins.rb index d6c1c70b..641851ea 100644 --- a/lib/slack/web/api/endpoints/pins.rb +++ b/lib/slack/web/api/endpoints/pins.rb @@ -17,7 +17,6 @@ module Pins # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/pins/pins.add.json def pins_add(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? - throw ArgumentError.new('Required arguments :timestamp missing') if options[:timestamp].nil? options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] post('pins.add', options) end diff --git a/lib/slack/web/api/endpoints/users.rb b/lib/slack/web/api/endpoints/users.rb index c89cd803..7b7d7776 100644 --- a/lib/slack/web/api/endpoints/users.rb +++ b/lib/slack/web/api/endpoints/users.rb @@ -49,7 +49,6 @@ def users_deletePhoto(options = {}) # @see https://api.slack.com/methods/users.getPresence # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.getPresence.json def users_getPresence(options = {}) - throw ArgumentError.new('Required arguments :user missing') if options[:user].nil? options = options.merge(user: users_id(options)['user']['id']) if options[:user] post('users.getPresence', options) end @@ -86,7 +85,7 @@ def users_info(options = {}) # @option options [Object] :include_locale # Set this to true to receive the locale for users. Defaults to false. # @option options [Object] :limit - # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. + # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. Providing no limit value will result in Slack attempting to deliver you the entire result set. If the collection is too large you may experience limit_required or HTTP 500 errors. # @see https://api.slack.com/methods/users.list # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.list.json def users_list(options = {}) @@ -123,18 +122,17 @@ def users_setActive(options = {}) # # Set the user profile photo # - # @option options [Object] :image - # File contents via multipart/form-data. # @option options [Object] :crop_w # Width/height of crop box (always square). # @option options [Object] :crop_x # X coordinate of top-left corner of crop box. # @option options [Object] :crop_y # Y coordinate of top-left corner of crop box. + # @option options [Object] :image + # File contents via multipart/form-data. # @see https://api.slack.com/methods/users.setPhoto # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.setPhoto.json def users_setPhoto(options = {}) - throw ArgumentError.new('Required arguments :image missing') if options[:image].nil? post('users.setPhoto', options) end diff --git a/lib/slack/web/api/endpoints/views.rb b/lib/slack/web/api/endpoints/views.rb index 8182a9c7..ec328a2f 100644 --- a/lib/slack/web/api/endpoints/views.rb +++ b/lib/slack/web/api/endpoints/views.rb @@ -72,7 +72,7 @@ def views_push(options = {}) # Update an existing view. # # @option options [Object] :view - # A view payload This must be a JSON-encoded string. + # A view object. This must be a JSON-encoded string. # @option options [Object] :external_id # A unique identifier of the view set by the developer. Must be unique for all views on a team. Max length of 255 characters. Either view_id or external_id is required. # @option options [Object] :hash diff --git a/lib/slack/web/api/endpoints/workflows.rb b/lib/slack/web/api/endpoints/workflows.rb new file mode 100644 index 00000000..1efce2f5 --- /dev/null +++ b/lib/slack/web/api/endpoints/workflows.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module Workflows + # + # Indicate that an app's step in a workflow completed execution. + # + # @option options [Object] :workflow_step_execute_id + # Context identifier that maps to the correct workflow step execution. + # @option options [Object] :outputs + # Key-value object of outputs from your step. Keys of this object reflect the configured key properties of your outputs array from your workflow_step object. + # @see https://api.slack.com/methods/workflows.stepCompleted + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/workflows/workflows.stepCompleted.json + def workflows_stepCompleted(options = {}) + throw ArgumentError.new('Required arguments :workflow_step_execute_id missing') if options[:workflow_step_execute_id].nil? + post('workflows.stepCompleted', options) + end + + # + # Indicate that an app's step in a workflow failed to execute. + # + # @option options [Object] :error + # A JSON-based object with a message property that should contain a human readable error message. + # @option options [Object] :workflow_step_execute_id + # Context identifier that maps to the correct workflow step execution. + # @see https://api.slack.com/methods/workflows.stepFailed + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/workflows/workflows.stepFailed.json + def workflows_stepFailed(options = {}) + throw ArgumentError.new('Required arguments :error missing') if options[:error].nil? + throw ArgumentError.new('Required arguments :workflow_step_execute_id missing') if options[:workflow_step_execute_id].nil? + post('workflows.stepFailed', options) + end + + # + # Update the configuration for a workflow extension step. + # + # @option options [Object] :workflow_step_edit_id + # A context identifier provided with view_submission payloads used to call back to workflows.updateStep. + # @option options [Object] :inputs + # A JSON key-value map of inputs required from a user during configuration. This is the data your app expects to receive when the workflow step starts. Please note: the embedded variable format is set and replaced by the workflow system. You cannot create custom variables that will be replaced at runtime. Read more about variables in workflow steps here. + # @option options [Object] :outputs + # An JSON array of output objects used during step execution. This is the data your app agrees to provide when your workflow step was executed. + # @option options [Object] :step_image_url + # An optional field that can be used to override app image that is shown in the Workflow Builder. + # @option options [Object] :step_name + # An optional field that can be used to override the step name that is shown in the Workflow Builder. + # @see https://api.slack.com/methods/workflows.updateStep + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/workflows/workflows.updateStep.json + def workflows_updateStep(options = {}) + throw ArgumentError.new('Required arguments :workflow_step_edit_id missing') if options[:workflow_step_edit_id].nil? + post('workflows.updateStep', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/errors.rb b/lib/slack/web/api/errors.rb index 161f1fb5..75ed9c0e 100644 --- a/lib/slack/web/api/errors.rb +++ b/lib/slack/web/api/errors.rb @@ -5,7 +5,9 @@ module Slack module Web module Api module Errors + class Accesslimited < SlackError; end class AccountInactive < SlackError; end + class AdminUnauthorized < SlackError; end class AlreadyArchived < SlackError; end class AlreadyInChannel < SlackError; end class AlreadyInTeam < SlackError; end @@ -21,6 +23,7 @@ class AppRestrictedOrgWide < SlackError; end class AsUserNotSupported < SlackError; end class AutoProvisionFailure < SlackError; end class BadClientSecret < SlackError; end + class BadHandle < SlackError; end class BadImage < SlackError; end class BadRedirectUri < SlackError; end class BadTimestamp < SlackError; end @@ -29,6 +32,7 @@ class BadToken < SlackError; end class BadUrl < SlackError; end class BadUsers < SlackError; end class BotNotFound < SlackError; end + class BotsNotFound < SlackError; end class CannotAddBot < SlackError; end class CannotAddMoreChannelsToGroup < SlackError; end class CannotAddMoreGroupsToChannel < SlackError; end @@ -42,6 +46,9 @@ class CannotFindChannel < SlackError; end class CannotFindMessage < SlackError; end class CannotFindService < SlackError; end class CannotInstallAnOrgInstalledApp < SlackError; end + class CannotInvalidatePrimaryOwner < SlackError; end + class CannotKickHomeTeam < SlackError; end + class CannotKickTeam < SlackError; end class CannotModifyPrimaryOwner < SlackError; end class CannotMoveLocalChannel < SlackError; end class CannotParse < SlackError; end @@ -64,15 +71,27 @@ class CantLeaveGeneral < SlackError; end class CantUpdateMessage < SlackError; end class ChannelCannotBeUnshared < SlackError; end class ChannelIsNotPrivate < SlackError; end + class ChannelNotArchived < SlackError; end class ChannelNotFound < SlackError; end class ChannelTypeNotSupported < SlackError; end class ClientIdTokenMismatch < SlackError; end class CodeAlreadyUsed < SlackError; end class ComplianceExportsPreventDeletion < SlackError; end + class CouldNotArchiveChannel < SlackError; end + class CouldNotConvertChannel < SlackError; end + class CouldNotCreateChannel < SlackError; end class CouldNotCreateWorkspace < SlackError; end + class CouldNotDeleteChannel < SlackError; end + class CouldNotGetConversationPrefs < SlackError; end + class CouldNotGetTeams < SlackError; end + class CouldNotRenameChannel < SlackError; end + class CouldNotSetChannelPref < SlackError; end class CouldNotSetTeamsForChannel < SlackError; end + class CouldNotUnarchiveChannel < SlackError; end class DefaultChannelRestricted < SlackError; end class DefaultOrgWideChannel < SlackError; end + class DeprecatedEndpoint < SlackError; end + class DescriptionTooLong < SlackError; end class DiscoverabilitySettingInvalid < SlackError; end class DomainTaken < SlackError; end class DuplicateChannelNotFound < SlackError; end @@ -80,6 +99,8 @@ class DuplicateExternalId < SlackError; end class DuplicateMessageNotFound < SlackError; end class EditWindowClosed < SlackError; end class EkmAccessDenied < SlackError; end + class EmailTaken < SlackError; end + class EmojiLimitReached < SlackError; end class EmojiNotFound < SlackError; end class EnterpriseIsRestricted < SlackError; end class ErrorBadFormat < SlackError; end @@ -95,6 +116,7 @@ class ErrorNoImage < SlackError; end class ErrorTooBig < SlackError; end class ExternalChannelMigrating < SlackError; end class ExternallySharedOrDisconnectedChannel < SlackError; end + class FailedForSomeUsers < SlackError; end class FailedLookingUpUser < SlackError; end class FailedSendingDialog < SlackError; end class FailedToAddEmoji < SlackError; end @@ -126,20 +148,25 @@ class FeatureNotEnabled < SlackError; end class FetchMembersFailed < SlackError; end class FileCommentNotFound < SlackError; end class FileDeleted < SlackError; end + class FileDeletingDisabled < SlackError; end class FileNotFound < SlackError; end class FileNotShared < SlackError; end class FileUnderReview < SlackError; end + class ForbiddenHandle < SlackError; end class GroupAlreadyLinkedToChannel < SlackError; end class GroupContainsOthers < SlackError; end class GroupMustNotBeEmpty < SlackError; end class GroupNotFound < SlackError; end + class HandleAlreadyExists < SlackError; end class HashConflict < SlackError; end class InactiveCall < SlackError; end class InternalError < SlackError; end class InvalidActor < SlackError; end class InvalidAppId < SlackError; end class InvalidArgName < SlackError; end + class InvalidArgs < SlackError; end class InvalidArguments < SlackError; end + class InvalidArrayArg < SlackError; end class InvalidAttachments < SlackError; end class InvalidAuth < SlackError; end class InvalidBlocks < SlackError; end @@ -153,15 +180,20 @@ class InvalidCode < SlackError; end class InvalidCreatedBy < SlackError; end class InvalidCursor < SlackError; end class InvalidEmail < SlackError; end + class InvalidEventContext < SlackError; end class InvalidExternalId < SlackError; end + class InvalidForIsMpim < SlackError; end class InvalidFormData < SlackError; end class InvalidGrantType < SlackError; end + class InvalidInputs < SlackError; end class InvalidLimit < SlackError; end class InvalidName < SlackError; end class InvalidNameMaxlength < SlackError; end class InvalidNamePunctuation < SlackError; end class InvalidNameRequired < SlackError; end class InvalidNameSpecials < SlackError; end + class InvalidOutputs < SlackError; end + class InvalidPayload < SlackError; end class InvalidPermissions < SlackError; end class InvalidPostType < SlackError; end class InvalidPresence < SlackError; end @@ -171,11 +203,18 @@ class InvalidRequestId < SlackError; end class InvalidRoleForUser < SlackError; end class InvalidScheduledMessageId < SlackError; end class InvalidScope < SlackError; end + class InvalidScopes < SlackError; end + class InvalidSearchChannelType < SlackError; end + class InvalidSort < SlackError; end + class InvalidSortDir < SlackError; end class InvalidStartTime < SlackError; end + class InvalidStepStatus < SlackError; end class InvalidTargetTeam < SlackError; end + class InvalidTeam < SlackError; end class InvalidTeamIds < SlackError; end class InvalidTime < SlackError; end class InvalidTimestamp < SlackError; end + class InvalidToken < SlackError; end class InvalidTrigger < SlackError; end class InvalidTsLatest < SlackError; end class InvalidTsOldest < SlackError; end @@ -184,6 +223,7 @@ class InvalidUnfurlsFormat < SlackError; end class InvalidUrl < SlackError; end class InvalidUser < SlackError; end class InvalidUserCombination < SlackError; end + class InvalidUserId < SlackError; end class InvalidUsers < SlackError; end class InvitedUserNotCreated < SlackError; end class InvitedUserNotReactivated < SlackError; end @@ -192,6 +232,8 @@ class IsArchived < SlackError; end class IsBot < SlackError; end class IsInactive < SlackError; end class LastMember < SlackError; end + class LeavingTeamNotInChannel < SlackError; end + class LeavingTeamRequired < SlackError; end class LimitRequired < SlackError; end class LinkNotFound < SlackError; end class MessageNotFound < SlackError; end @@ -205,6 +247,7 @@ class MissingDuration < SlackError; end class MissingPostType < SlackError; end class MissingResource < SlackError; end class MissingScope < SlackError; end + class MissingSubteamName < SlackError; end class MissingTrigger < SlackError; end class MissingTs < SlackError; end class MissingUnfurls < SlackError; end @@ -212,6 +255,7 @@ class MixedScope < SlackError; end class MsgTooLong < SlackError; end class MustProvideTeamDomain < SlackError; end class MustProvideTeamName < SlackError; end + class NameAlreadyExists < SlackError; end class NameTaken < SlackError; end class NameTakenInOrg < SlackError; end class NoAliasSelected < SlackError; end @@ -219,13 +263,17 @@ class NoBotUserForApp < SlackError; end class NoChannel < SlackError; end class NoImageUploaded < SlackError; end class NoItemSpecified < SlackError; end + class NoLocalUserOnTeam < SlackError; end class NoPermission < SlackError; end class NoReaction < SlackError; end + class NoScopes < SlackError; end class NoSuchSubteam < SlackError; end class NoTeamIdsGiven < SlackError; end + class NoTeamsToDisconnect < SlackError; end class NoText < SlackError; end class NoUser < SlackError; end class NoUserProvided < SlackError; end + class NoUsersProvided < SlackError; end class NotAdmin < SlackError; end class NotAllowed < SlackError; end class NotAllowedTokenType < SlackError; end @@ -248,11 +296,14 @@ class NotPinnable < SlackError; end class NotPinned < SlackError; end class NotReactable < SlackError; end class NotStarred < SlackError; end + class NotSupported < SlackError; end class OauthAuthorizationUrlMismatch < SlackError; end class OrgLoginRequired < SlackError; end + class OrgUserNotInTeam < SlackError; end class OverPaginationLimit < SlackError; end class PaginationNotAvailable < SlackError; end class PaidOnly < SlackError; end + class PaidTeamsOnly < SlackError; end class PermissionDenied < SlackError; end class PlanUpgradeRequired < SlackError; end class PostingToGeneralChannelDenied < SlackError; end @@ -274,11 +325,18 @@ class RestrictedActionReadOnlyChannel < SlackError; end class RestrictedActionThreadOnlyChannel < SlackError; end class RtmConnectRequired < SlackError; end class SentRecently < SlackError; end + class ServiceUnavailable < SlackError; end + class SessionExpired < SlackError; end + class SessionInvalidationFailed < SlackError; end + class SessionNotFound < SlackError; end class SnoozeEndFailed < SlackError; end class SnoozeFailed < SlackError; end class SnoozeNotActive < SlackError; end + class SubteamMaxUsersExceeded < SlackError; end class TeamAddedToOrg < SlackError; end + class TeamIdOrOrgRequired < SlackError; end class TeamNotFound < SlackError; end + class TeamNotOnEnterprise < SlackError; end class ThreadNotFound < SlackError; end class TimeInPast < SlackError; end class TimeTooFar < SlackError; end @@ -292,18 +350,24 @@ class TooManyEmoji < SlackError; end class TooManyFrames < SlackError; end class TooManyIds < SlackError; end class TooManyIdsProvided < SlackError; end + class TooManyLinkedChannels < SlackError; end + class TooManyMembers < SlackError; end + class TooManyPins < SlackError; end class TooManyReactions < SlackError; end class TooManyTargetTeams < SlackError; end class TooManyTeamsProvided < SlackError; end class TooManyUsers < SlackError; end class TriggerExchanged < SlackError; end class TriggerExpired < SlackError; end + class TwoFactorSetupRequired < SlackError; end class UnableToLeaveLastTeam < SlackError; end class UnableToLinkIdpGroupAndChannel < SlackError; end class UnableToUnlinkIdpGroupAndChannel < SlackError; end class UnknownMethod < SlackError; end class UnknownType < SlackError; end class UnsupportedArguments < SlackError; end + class UnsupportedContextType < SlackError; end + class UnsupportedTeamType < SlackError; end class UpdateFailed < SlackError; end class UraMaxChannels < SlackError; end class UserAlreadyDeleted < SlackError; end @@ -315,6 +379,7 @@ class UserIsBot < SlackError; end class UserIsNotAGuest < SlackError; end class UserIsRestricted < SlackError; end class UserIsUltraRestricted < SlackError; end + class UserMustBeAdmin < SlackError; end class UserNotFound < SlackError; end class UserNotInChannel < SlackError; end class UserNotVisible < SlackError; end @@ -328,7 +393,9 @@ class ValidationErrors < SlackError; end class ViewTooLarge < SlackError; end ERROR_CLASSES = { + 'accesslimited' => Accesslimited, 'account_inactive' => AccountInactive, + 'admin_unauthorized' => AdminUnauthorized, 'already_archived' => AlreadyArchived, 'already_in_channel' => AlreadyInChannel, 'already_in_team' => AlreadyInTeam, @@ -344,6 +411,7 @@ class ViewTooLarge < SlackError; end 'as_user_not_supported' => AsUserNotSupported, 'auto_provision_failure' => AutoProvisionFailure, 'bad_client_secret' => BadClientSecret, + 'bad_handle' => BadHandle, 'bad_image' => BadImage, 'bad_redirect_uri' => BadRedirectUri, 'bad_timestamp' => BadTimestamp, @@ -352,6 +420,7 @@ class ViewTooLarge < SlackError; end 'bad_url' => BadUrl, 'bad_users' => BadUsers, 'bot_not_found' => BotNotFound, + 'bots_not_found' => BotsNotFound, 'cannot_add_bot' => CannotAddBot, 'cannot_add_more_channels_to_group' => CannotAddMoreChannelsToGroup, 'cannot_add_more_groups_to_channel' => CannotAddMoreGroupsToChannel, @@ -365,6 +434,9 @@ class ViewTooLarge < SlackError; end 'cannot_find_message' => CannotFindMessage, 'cannot_find_service' => CannotFindService, 'cannot_install_an_org_installed_app' => CannotInstallAnOrgInstalledApp, + 'cannot_invalidate_primary_owner' => CannotInvalidatePrimaryOwner, + 'cannot_kick_home_team' => CannotKickHomeTeam, + 'cannot_kick_team' => CannotKickTeam, 'cannot_modify_primary_owner' => CannotModifyPrimaryOwner, 'cannot_move_local_channel' => CannotMoveLocalChannel, 'cannot_parse' => CannotParse, @@ -387,15 +459,27 @@ class ViewTooLarge < SlackError; end 'cant_update_message' => CantUpdateMessage, 'channel_cannot_be_unshared' => ChannelCannotBeUnshared, 'channel_is_not_private' => ChannelIsNotPrivate, + 'channel_not_archived' => ChannelNotArchived, 'channel_not_found' => ChannelNotFound, 'channel_type_not_supported' => ChannelTypeNotSupported, 'client_id_token_mismatch' => ClientIdTokenMismatch, 'code_already_used' => CodeAlreadyUsed, 'compliance_exports_prevent_deletion' => ComplianceExportsPreventDeletion, + 'could_not_archive_channel' => CouldNotArchiveChannel, + 'could_not_convert_channel' => CouldNotConvertChannel, + 'could_not_create_channel' => CouldNotCreateChannel, 'could_not_create_workspace' => CouldNotCreateWorkspace, + 'could_not_delete_channel' => CouldNotDeleteChannel, + 'could_not_get_conversation_prefs' => CouldNotGetConversationPrefs, + 'could_not_get_teams' => CouldNotGetTeams, + 'could_not_rename_channel' => CouldNotRenameChannel, + 'could_not_set_channel_pref' => CouldNotSetChannelPref, 'could_not_set_teams_for_channel' => CouldNotSetTeamsForChannel, + 'could_not_unarchive_channel' => CouldNotUnarchiveChannel, 'default_channel_restricted' => DefaultChannelRestricted, 'default_org_wide_channel' => DefaultOrgWideChannel, + 'deprecated_endpoint' => DeprecatedEndpoint, + 'description_too_long' => DescriptionTooLong, 'discoverability_setting_invalid' => DiscoverabilitySettingInvalid, 'domain_taken' => DomainTaken, 'duplicate_channel_not_found' => DuplicateChannelNotFound, @@ -403,6 +487,8 @@ class ViewTooLarge < SlackError; end 'duplicate_message_not_found' => DuplicateMessageNotFound, 'edit_window_closed' => EditWindowClosed, 'ekm_access_denied' => EkmAccessDenied, + 'email_taken' => EmailTaken, + 'emoji_limit_reached' => EmojiLimitReached, 'emoji_not_found' => EmojiNotFound, 'enterprise_is_restricted' => EnterpriseIsRestricted, 'error_bad_format' => ErrorBadFormat, @@ -418,6 +504,7 @@ class ViewTooLarge < SlackError; end 'error_too_big' => ErrorTooBig, 'external_channel_migrating' => ExternalChannelMigrating, 'externally_shared_or_disconnected_channel' => ExternallySharedOrDisconnectedChannel, + 'failed_for_some_users' => FailedForSomeUsers, 'failed_looking_up_user' => FailedLookingUpUser, 'failed_sending_dialog' => FailedSendingDialog, 'failed_to_add_emoji' => FailedToAddEmoji, @@ -449,20 +536,25 @@ class ViewTooLarge < SlackError; end 'fetch_members_failed' => FetchMembersFailed, 'file_comment_not_found' => FileCommentNotFound, 'file_deleted' => FileDeleted, + 'file_deleting_disabled' => FileDeletingDisabled, 'file_not_found' => FileNotFound, 'file_not_shared' => FileNotShared, 'file_under_review' => FileUnderReview, + 'forbidden_handle' => ForbiddenHandle, 'group_already_linked_to_channel' => GroupAlreadyLinkedToChannel, 'group_contains_others' => GroupContainsOthers, 'group_must_not_be_empty' => GroupMustNotBeEmpty, 'group_not_found' => GroupNotFound, + 'handle_already_exists' => HandleAlreadyExists, 'hash_conflict' => HashConflict, 'inactive_call' => InactiveCall, 'internal_error' => InternalError, 'invalid_actor' => InvalidActor, 'invalid_app_id' => InvalidAppId, 'invalid_arg_name' => InvalidArgName, + 'invalid_args' => InvalidArgs, 'invalid_arguments' => InvalidArguments, + 'invalid_array_arg' => InvalidArrayArg, 'invalid_attachments' => InvalidAttachments, 'invalid_auth' => InvalidAuth, 'invalid_blocks' => InvalidBlocks, @@ -476,15 +568,20 @@ class ViewTooLarge < SlackError; end 'invalid_created_by' => InvalidCreatedBy, 'invalid_cursor' => InvalidCursor, 'invalid_email' => InvalidEmail, + 'invalid_event_context' => InvalidEventContext, 'invalid_external_id' => InvalidExternalId, + 'invalid_for_is_mpim' => InvalidForIsMpim, 'invalid_form_data' => InvalidFormData, 'invalid_grant_type' => InvalidGrantType, + 'invalid_inputs' => InvalidInputs, 'invalid_limit' => InvalidLimit, 'invalid_name' => InvalidName, 'invalid_name_maxlength' => InvalidNameMaxlength, 'invalid_name_punctuation' => InvalidNamePunctuation, 'invalid_name_required' => InvalidNameRequired, 'invalid_name_specials' => InvalidNameSpecials, + 'invalid_outputs' => InvalidOutputs, + 'invalid_payload' => InvalidPayload, 'invalid_permissions' => InvalidPermissions, 'invalid_post_type' => InvalidPostType, 'invalid_presence' => InvalidPresence, @@ -494,11 +591,18 @@ class ViewTooLarge < SlackError; end 'invalid_role_for_user' => InvalidRoleForUser, 'invalid_scheduled_message_id' => InvalidScheduledMessageId, 'invalid_scope' => InvalidScope, + 'invalid_scopes' => InvalidScopes, + 'invalid_search_channel_type' => InvalidSearchChannelType, + 'invalid_sort' => InvalidSort, + 'invalid_sort_dir' => InvalidSortDir, 'invalid_start_time' => InvalidStartTime, + 'invalid_step_status' => InvalidStepStatus, 'invalid_target_team' => InvalidTargetTeam, + 'invalid_team' => InvalidTeam, 'invalid_team_ids' => InvalidTeamIds, 'invalid_time' => InvalidTime, 'invalid_timestamp' => InvalidTimestamp, + 'invalid_token' => InvalidToken, 'invalid_trigger' => InvalidTrigger, 'invalid_ts_latest' => InvalidTsLatest, 'invalid_ts_oldest' => InvalidTsOldest, @@ -507,6 +611,7 @@ class ViewTooLarge < SlackError; end 'invalid_url' => InvalidUrl, 'invalid_user' => InvalidUser, 'invalid_user_combination' => InvalidUserCombination, + 'invalid_user_id' => InvalidUserId, 'invalid_users' => InvalidUsers, 'invited_user_not_created' => InvitedUserNotCreated, 'invited_user_not_reactivated' => InvitedUserNotReactivated, @@ -515,6 +620,8 @@ class ViewTooLarge < SlackError; end 'is_bot' => IsBot, 'is_inactive' => IsInactive, 'last_member' => LastMember, + 'leaving_team_not_in_channel' => LeavingTeamNotInChannel, + 'leaving_team_required' => LeavingTeamRequired, 'limit_required' => LimitRequired, 'link_not_found' => LinkNotFound, 'message_not_found' => MessageNotFound, @@ -528,6 +635,7 @@ class ViewTooLarge < SlackError; end 'missing_post_type' => MissingPostType, 'missing_resource' => MissingResource, 'missing_scope' => MissingScope, + 'missing_subteam_name' => MissingSubteamName, 'missing_trigger' => MissingTrigger, 'missing_ts' => MissingTs, 'missing_unfurls' => MissingUnfurls, @@ -535,6 +643,7 @@ class ViewTooLarge < SlackError; end 'msg_too_long' => MsgTooLong, 'must_provide_team_domain' => MustProvideTeamDomain, 'must_provide_team_name' => MustProvideTeamName, + 'name_already_exists' => NameAlreadyExists, 'name_taken' => NameTaken, 'name_taken_in_org' => NameTakenInOrg, 'no_alias_selected' => NoAliasSelected, @@ -542,13 +651,17 @@ class ViewTooLarge < SlackError; end 'no_channel' => NoChannel, 'no_image_uploaded' => NoImageUploaded, 'no_item_specified' => NoItemSpecified, + 'no_local_user_on_team' => NoLocalUserOnTeam, 'no_permission' => NoPermission, 'no_reaction' => NoReaction, + 'no_scopes' => NoScopes, 'no_such_subteam' => NoSuchSubteam, 'no_team_ids_given' => NoTeamIdsGiven, + 'no_teams_to_disconnect' => NoTeamsToDisconnect, 'no_text' => NoText, 'no_user' => NoUser, 'no_user_provided' => NoUserProvided, + 'no_users_provided' => NoUsersProvided, 'not_admin' => NotAdmin, 'not_allowed' => NotAllowed, 'not_allowed_token_type' => NotAllowedTokenType, @@ -571,11 +684,14 @@ class ViewTooLarge < SlackError; end 'not_pinned' => NotPinned, 'not_reactable' => NotReactable, 'not_starred' => NotStarred, + 'not_supported' => NotSupported, 'oauth_authorization_url_mismatch' => OauthAuthorizationUrlMismatch, 'org_login_required' => OrgLoginRequired, + 'org_user_not_in_team' => OrgUserNotInTeam, 'over_pagination_limit' => OverPaginationLimit, 'pagination_not_available' => PaginationNotAvailable, 'paid_only' => PaidOnly, + 'paid_teams_only' => PaidTeamsOnly, 'permission_denied' => PermissionDenied, 'plan_upgrade_required' => PlanUpgradeRequired, 'posting_to_general_channel_denied' => PostingToGeneralChannelDenied, @@ -597,11 +713,18 @@ class ViewTooLarge < SlackError; end 'restricted_action_thread_only_channel' => RestrictedActionThreadOnlyChannel, 'rtm_connect_required' => RtmConnectRequired, 'sent_recently' => SentRecently, + 'service_unavailable' => ServiceUnavailable, + 'session_expired' => SessionExpired, + 'session_invalidation_failed' => SessionInvalidationFailed, + 'session_not_found' => SessionNotFound, 'snooze_end_failed' => SnoozeEndFailed, 'snooze_failed' => SnoozeFailed, 'snooze_not_active' => SnoozeNotActive, + 'subteam_max_users_exceeded' => SubteamMaxUsersExceeded, 'team_added_to_org' => TeamAddedToOrg, + 'team_id_or_org_required' => TeamIdOrOrgRequired, 'team_not_found' => TeamNotFound, + 'team_not_on_enterprise' => TeamNotOnEnterprise, 'thread_not_found' => ThreadNotFound, 'time_in_past' => TimeInPast, 'time_too_far' => TimeTooFar, @@ -615,18 +738,24 @@ class ViewTooLarge < SlackError; end 'too_many_frames' => TooManyFrames, 'too_many_ids' => TooManyIds, 'too_many_ids_provided' => TooManyIdsProvided, + 'too_many_linked_channels' => TooManyLinkedChannels, + 'too_many_members' => TooManyMembers, + 'too_many_pins' => TooManyPins, 'too_many_reactions' => TooManyReactions, 'too_many_target_teams' => TooManyTargetTeams, 'too_many_teams_provided' => TooManyTeamsProvided, 'too_many_users' => TooManyUsers, 'trigger_exchanged' => TriggerExchanged, 'trigger_expired' => TriggerExpired, + 'two_factor_setup_required' => TwoFactorSetupRequired, 'unable_to_leave_last_team' => UnableToLeaveLastTeam, 'unable_to_link_idp_group_and_channel' => UnableToLinkIdpGroupAndChannel, 'unable_to_unlink_idp_group_and_channel' => UnableToUnlinkIdpGroupAndChannel, 'unknown_method' => UnknownMethod, 'unknown_type' => UnknownType, 'unsupported_arguments' => UnsupportedArguments, + 'unsupported_context_type' => UnsupportedContextType, + 'unsupported_team_type' => UnsupportedTeamType, 'update_failed' => UpdateFailed, 'ura_max_channels' => UraMaxChannels, 'user_already_deleted' => UserAlreadyDeleted, @@ -638,6 +767,7 @@ class ViewTooLarge < SlackError; end 'user_is_not_a_guest' => UserIsNotAGuest, 'user_is_restricted' => UserIsRestricted, 'user_is_ultra_restricted' => UserIsUltraRestricted, + 'user_must_be_admin' => UserMustBeAdmin, '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 2202a30b..6ecf522b 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit 2202a30bbac4b55a755d1a15967b7eda743a546b +Subproject commit 6ecf522b1c5258bda74e3426646501f6956d2ce8 diff --git a/lib/slack/web/api/templates/endpoints.erb b/lib/slack/web/api/templates/endpoints.erb index 41952578..bf277c9d 100644 --- a/lib/slack/web/api/templates/endpoints.erb +++ b/lib/slack/web/api/templates/endpoints.erb @@ -9,6 +9,7 @@ module Slack module Web module Api module Endpoints + include Slack::Web::Api::Mixins::Conversations include Slack::Web::Api::Mixins::Channels include Slack::Web::Api::Mixins::Users include Slack::Web::Api::Mixins::Groups diff --git a/lib/slack/web/api/templates/method_spec.erb b/lib/slack/web/api/templates/method_spec.erb index ca19d525..89308207 100644 --- a/lib/slack/web/api/templates/method_spec.erb +++ b/lib/slack/web/api/templates/method_spec.erb @@ -12,7 +12,7 @@ RSpec.describe Slack::Web::Api::Endpoints::<%= group.gsub(".", "_").camelize %> context '<%= group %>_<%= name %>' do <% required_params.each do |arg_name, arg_v| %> it 'requires <%= arg_name %>' do -<% params_except_required = required_params.reject{ |name, _| name == arg_name }.map{|var, opts| "#{var}: '#{opts['example']}'"}.join(', ') %> +<% params_except_required = required_params.reject{ |name, _| name == arg_name }.map{|var, opts| "#{var}: '#{opts['example'].gsub("'", '"')}'"}.join(', ') %> expect { client.<%= group.gsub(".", "_") %>_<%= name %><%= params_except_required.empty? ? '' : "(#{params_except_required})" %> }.to raise_error ArgumentError, /Required arguments :<%= arg_name %> missing/ end <% end %> diff --git a/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb b/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb new file mode 100644 index 00000000..f147e56c --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_conversations_ekm_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::AdminConversationsEkm do + let(:client) { Slack::Web::Client.new } +end diff --git a/spec/slack/web/api/endpoints/admin_conversations_spec.rb b/spec/slack/web/api/endpoints/admin_conversations_spec.rb index 916fbbdb..02e0b0cc 100644 --- a/spec/slack/web/api/endpoints/admin_conversations_spec.rb +++ b/spec/slack/web/api/endpoints/admin_conversations_spec.rb @@ -5,9 +5,76 @@ RSpec.describe Slack::Web::Api::Endpoints::AdminConversations do let(:client) { Slack::Web::Client.new } + context 'admin.conversations_archive' do + it 'requires channel_id' do + expect { client.admin_conversations_archive }.to raise_error ArgumentError, /Required arguments :channel_id missing/ + end + end + context 'admin.conversations_convertToPrivate' do + it 'requires channel_id' do + expect { client.admin_conversations_convertToPrivate }.to raise_error ArgumentError, /Required arguments :channel_id missing/ + end + end + context 'admin.conversations_create' do + it 'requires is_private' do + expect { client.admin_conversations_create(name: 'mychannel') }.to raise_error ArgumentError, /Required arguments :is_private missing/ + end + it 'requires name' do + expect { client.admin_conversations_create(is_private: 'true') }.to raise_error ArgumentError, /Required arguments :name missing/ + end + end + context 'admin.conversations_delete' do + it 'requires channel_id' do + expect { client.admin_conversations_delete }.to raise_error ArgumentError, /Required arguments :channel_id missing/ + end + end + context 'admin.conversations_disconnectShared' do + it 'requires channel_id' do + expect { client.admin_conversations_disconnectShared }.to raise_error ArgumentError, /Required arguments :channel_id missing/ + end + end + context 'admin.conversations_getConversationPrefs' do + it 'requires channel_id' do + expect { client.admin_conversations_getConversationPrefs }.to raise_error ArgumentError, /Required arguments :channel_id missing/ + end + end + context 'admin.conversations_getTeams' do + it 'requires channel_id' do + expect { client.admin_conversations_getTeams }.to raise_error ArgumentError, /Required arguments :channel_id missing/ + end + end + context 'admin.conversations_invite' do + it 'requires channel_id' do + expect { client.admin_conversations_invite(user_ids: 'U1234,U2345,U3456') }.to raise_error ArgumentError, /Required arguments :channel_id missing/ + end + it 'requires user_ids' do + expect { client.admin_conversations_invite(channel_id: 'C12345') }.to raise_error ArgumentError, /Required arguments :user_ids missing/ + end + end + context 'admin.conversations_rename' do + it 'requires channel_id' do + expect { client.admin_conversations_rename(name: '') }.to raise_error ArgumentError, /Required arguments :channel_id missing/ + end + it 'requires name' do + expect { client.admin_conversations_rename(channel_id: 'C12345') }.to raise_error ArgumentError, /Required arguments :name missing/ + end + end + context 'admin.conversations_setConversationPrefs' do + it 'requires channel_id' do + expect { client.admin_conversations_setConversationPrefs(prefs: '{"who_can_post":"type:admin,user:U1234,subteam:S1234"}') }.to raise_error ArgumentError, /Required arguments :channel_id missing/ + end + it 'requires prefs' do + expect { client.admin_conversations_setConversationPrefs(channel_id: 'C1234') }.to raise_error ArgumentError, /Required arguments :prefs missing/ + end + end context 'admin.conversations_setTeams' do it 'requires channel_id' do expect { client.admin_conversations_setTeams }.to raise_error ArgumentError, /Required arguments :channel_id missing/ end end + context 'admin.conversations_unarchive' do + it 'requires channel_id' do + expect { client.admin_conversations_unarchive }.to raise_error ArgumentError, /Required arguments :channel_id missing/ + end + end end diff --git a/spec/slack/web/api/endpoints/admin_users_session_spec.rb b/spec/slack/web/api/endpoints/admin_users_session_spec.rb index 15f18571..c20b1da2 100644 --- a/spec/slack/web/api/endpoints/admin_users_session_spec.rb +++ b/spec/slack/web/api/endpoints/admin_users_session_spec.rb @@ -5,6 +5,14 @@ RSpec.describe Slack::Web::Api::Endpoints::AdminUsersSession do let(:client) { Slack::Web::Client.new } + context 'admin.users.session_invalidate' do + it 'requires session_id' do + expect { client.admin_users_session_invalidate(team_id: '') }.to raise_error ArgumentError, /Required arguments :session_id missing/ + end + it 'requires team_id' do + expect { client.admin_users_session_invalidate(session_id: '') }.to raise_error ArgumentError, /Required arguments :team_id missing/ + end + end context 'admin.users.session_reset' do it 'requires user_id' do expect { client.admin_users_session_reset }.to raise_error ArgumentError, /Required arguments :user_id missing/ diff --git a/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb b/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb new file mode 100644 index 00000000..bca87553 --- /dev/null +++ b/spec/slack/web/api/endpoints/apps_event_authorizations_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::AppsEventAuthorizations do + let(:client) { Slack::Web::Client.new } + context 'apps.event.authorizations_list' do + it 'requires event_context' do + expect { client.apps_event_authorizations_list }.to raise_error ArgumentError, /Required arguments :event_context 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 2ae44ea5..8ef3088d 100644 --- a/spec/slack/web/api/endpoints/conversations_spec.rb +++ b/spec/slack/web/api/endpoints/conversations_spec.rb @@ -56,6 +56,14 @@ expect { client.conversations_leave }.to raise_error ArgumentError, /Required arguments :channel missing/ end end + context 'conversations_mark' do + it 'requires channel' do + expect { client.conversations_mark(ts: '1593473566.000200') }.to raise_error ArgumentError, /Required arguments :channel missing/ + end + it 'requires ts' do + expect { client.conversations_mark(channel: 'C012345678') }.to raise_error ArgumentError, /Required arguments :ts missing/ + end + end context 'conversations_members' do it 'requires channel' do expect { client.conversations_members }.to raise_error ArgumentError, /Required arguments :channel missing/ diff --git a/spec/slack/web/api/endpoints/pins_spec.rb b/spec/slack/web/api/endpoints/pins_spec.rb index 364d1d9d..d29d0c60 100644 --- a/spec/slack/web/api/endpoints/pins_spec.rb +++ b/spec/slack/web/api/endpoints/pins_spec.rb @@ -7,10 +7,7 @@ let(:client) { Slack::Web::Client.new } context 'pins_add' do it 'requires channel' do - expect { client.pins_add(timestamp: '1234567890.123456') }.to raise_error ArgumentError, /Required arguments :channel missing/ - end - it 'requires timestamp' do - expect { client.pins_add(channel: 'C1234567890') }.to raise_error ArgumentError, /Required arguments :timestamp missing/ + expect { client.pins_add }.to raise_error ArgumentError, /Required arguments :channel missing/ end end context 'pins_list' do diff --git a/spec/slack/web/api/endpoints/workflows_spec.rb b/spec/slack/web/api/endpoints/workflows_spec.rb new file mode 100644 index 00000000..d76336bf --- /dev/null +++ b/spec/slack/web/api/endpoints/workflows_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::Workflows do + let(:client) { Slack::Web::Client.new } + context 'workflows_stepCompleted' do + it 'requires workflow_step_execute_id' do + expect { client.workflows_stepCompleted }.to raise_error ArgumentError, /Required arguments :workflow_step_execute_id missing/ + end + end + context 'workflows_stepFailed' do + it 'requires error' do + expect { client.workflows_stepFailed(workflow_step_execute_id: '') }.to raise_error ArgumentError, /Required arguments :error missing/ + end + it 'requires workflow_step_execute_id' do + expect { client.workflows_stepFailed(error: '') }.to raise_error ArgumentError, /Required arguments :workflow_step_execute_id missing/ + end + end + context 'workflows_updateStep' do + it 'requires workflow_step_edit_id' do + expect { client.workflows_updateStep }.to raise_error ArgumentError, /Required arguments :workflow_step_edit_id missing/ + end + end +end