From b839392663d62fd8a29729aba13c5ddba393d39a Mon Sep 17 00:00:00 2001 From: dblock Date: Sat, 14 Mar 2020 16:13:51 -0400 Subject: [PATCH] Added `admin_teams_settings_info`, `admin_users_list`, `admin_users_setExpiration`, `admin_apps_approved_list`, `admin_apps_restricted_list`, `admin_conversations_setTeams`, `admin_emoji_add`, `admin_emoji_addAlias`, `admin_emoji_list`, `admin_emoji_remove` and `admin_emoji_rename` endpoints. --- CHANGELOG.md | 7 +- bin/commands.rb | 4 + bin/commands/admin_apps_approved.rb | 17 ++++ bin/commands/admin_apps_restricted.rb | 17 ++++ bin/commands/admin_conversations.rb | 17 ++++ bin/commands/admin_emoji.rb | 54 ++++++++++++ bin/commands/admin_teams_settings.rb | 35 +++++++- bin/commands/admin_users.rb | 23 +++++ bin/commands/chat.rb | 16 ++-- bin/commands/files.rb | 1 + bin/commands/files_remote.rb | 2 +- bin/commands/oauth.rb | 2 +- lib/slack/web/api/endpoints.rb | 8 ++ .../web/api/endpoints/admin_apps_approved.rb | 35 ++++++++ .../api/endpoints/admin_apps_restricted.rb | 35 ++++++++ .../web/api/endpoints/admin_conversations.rb | 30 +++++++ lib/slack/web/api/endpoints/admin_emoji.rb | 88 +++++++++++++++++++ .../web/api/endpoints/admin_teams_settings.rb | 48 +++++++++- lib/slack/web/api/endpoints/admin_users.rb | 42 +++++++++ lib/slack/web/api/endpoints/chat.rb | 16 ++-- lib/slack/web/api/endpoints/files.rb | 2 + lib/slack/web/api/endpoints/files_remote.rb | 2 +- lib/slack/web/api/endpoints/oauth.rb | 2 +- lib/slack/web/api/errors.rb | 4 + lib/slack/web/api/slack-api-ref | 2 +- .../api/endpoints/admin_apps_approved_spec.rb | 8 ++ .../endpoints/admin_apps_restricted_spec.rb | 8 ++ .../api/endpoints/admin_conversations_spec.rb | 13 +++ .../web/api/endpoints/admin_emoji_spec.rb | 37 ++++++++ .../endpoints/admin_teams_settings_spec.rb | 31 +++++-- .../web/api/endpoints/admin_teams_spec.rb | 4 +- .../web/api/endpoints/admin_users_spec.rb | 34 +++++-- .../api/endpoints/apps_permissions_spec.rb | 4 +- .../endpoints/apps_permissions_users_spec.rb | 6 +- .../web/api/endpoints/conversations_spec.rb | 2 +- 35 files changed, 604 insertions(+), 52 deletions(-) create mode 100644 bin/commands/admin_apps_approved.rb create mode 100644 bin/commands/admin_apps_restricted.rb create mode 100644 bin/commands/admin_conversations.rb create mode 100644 bin/commands/admin_emoji.rb create mode 100644 lib/slack/web/api/endpoints/admin_apps_approved.rb create mode 100644 lib/slack/web/api/endpoints/admin_apps_restricted.rb create mode 100644 lib/slack/web/api/endpoints/admin_conversations.rb create mode 100644 lib/slack/web/api/endpoints/admin_emoji.rb create mode 100644 spec/slack/web/api/endpoints/admin_apps_approved_spec.rb create mode 100644 spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb create mode 100644 spec/slack/web/api/endpoints/admin_conversations_spec.rb create mode 100644 spec/slack/web/api/endpoints/admin_emoji_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index aca038dd..77f04e56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,17 @@ ### 0.14.6 (Next) -* [#305](https://github.com/slack-ruby/slack-ruby-client/pull/305): Added `admin.inviteRequests.approve`, `admin.inviteRequests.deny`, `admin.inviteRequests.list`, `admin.inviteRequests.approved.list`, `admin.inviteRequests.denied.list`, `admin.teams.create`, `admin.teams.list`, `admin.teams.admins.list`, `admin.teams.owners.list`, `admin.teams.settings`, `admin.teams.settings.setIcon`, `admin.teams.settings.setName`, `admin.teams.settings.setDescription`, `admin.users.assign`, `admin.users.invite`, `admin.users.remove`, `admin.users.setAdmin`, `admin.users.setOwner` and `admin.users.setRegular` endpoints - [@manuelmeurer](https://github.com/manuelmeurer). +* [#305](https://github.com/slack-ruby/slack-ruby-client/pull/305): Added `admin_inviteRequests_approve`, `admin_inviteRequests_deny`, `admin_inviteRequests_list`, `admin_inviteRequests_approved_list`, `admin_inviteRequests_denied_list`, `admin_teams_create`, `admin_teams_list`, `admin_teams_admins_list`, `admin_teams_owners_list`, `admin_teams_settings`, `admin_teams_settings_setIcon`, `admin_teams_settings_setName`, `admin_teams_settings_setDescription`, `admin_users_assign`, `admin_users_invite`, `admin_users_remove`, `admin_users_setAdmin`, `admin_users_setOwner` and `admin_users_setRegular` endpoints - [@manuelmeurer](https://github.com/manuelmeurer). * [#311](https://github.com/slack-ruby/slack-ruby-client/pull/311): Made Web API `response_metadata` more accessible in errors - [@jmanian](https://github.com/jmanian). * [#312](https://github.com/slack-ruby/slack-ruby-client/pull/312): Added specific error classes for Web API - [@jmanian](https://github.com/jmanian). +* [#313](https://github.com/slack-ruby/slack-ruby-client/pull/313): Added `admin_teams_settings_info`, `admin_users_list`, `admin_users_setExpiration`, `admin_apps_approved_list`, `admin_apps_restricted_list`, `admin_conversations_setTeams`, `admin_emoji_add`, `admin_emoji_addAlias`, `admin_emoji_list`, `admin_emoji_remove` and `admin_emoji_rename` endpoints - [@dblock](https://github.com/dblock). * Your contribution here. ### 0.14.5 (2019/12/23) * [#293](https://github.com/slack-ruby/slack-ruby-client/pull/293): Rubocop auto-correct and comprehensive todo - [@jcraigk](https://github.com/jcraigk). * [#297](https://github.com/slack-ruby/slack-ruby-client/pull/297): Various Rubocop fixes - [@jcraigk](https://github.com/jcraigk). -* [#298](https://github.com/slack-ruby/slack-ruby-client/pull/298): Added `admin.apps`, `admin.app.requests` and `views` endpoints - [@jmanian](https://github.com/jmanian). -* [#303](https://github.com/slack-ruby/slack-ruby-client/pull/303): Added `oauth.v2.access` and `views.publish` endpoints - [@jwright](https://github.com/jwright). +* [#298](https://github.com/slack-ruby/slack-ruby-client/pull/298): Added `admin_apps`, `admin_app_requests` and `views` endpoints - [@jmanian](https://github.com/jmanian). +* [#303](https://github.com/slack-ruby/slack-ruby-client/pull/303): Added `oauth_v2_access` and `views_publish` endpoints - [@jwright](https://github.com/jwright). * [#309](https://github.com/slack-ruby/slack-ruby-client/pull/309): Stop ping on `inactive_account` and `invalid_auth` - [@dblock](https://github.com/dblock). ### 0.14.4 (2019/7/28) diff --git a/bin/commands.rb b/bin/commands.rb index 36b2f214..ebb87f52 100644 --- a/bin/commands.rb +++ b/bin/commands.rb @@ -2,7 +2,11 @@ # This file was auto-generated by lib/tasks/web.rake require 'commands/admin_apps' +require 'commands/admin_apps_approved' require 'commands/admin_apps_requests' +require 'commands/admin_apps_restricted' +require 'commands/admin_conversations' +require 'commands/admin_emoji' require 'commands/admin_inviteRequests' require 'commands/admin_inviteRequests_approved' require 'commands/admin_inviteRequests_denied' diff --git a/bin/commands/admin_apps_approved.rb b/bin/commands/admin_apps_approved.rb new file mode 100644 index 00000000..5533a1f6 --- /dev/null +++ b/bin/commands/admin_apps_approved.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +desc 'AdminAppsApproved methods.' +command 'admin_apps_approved' do |g| + g.desc 'List approved apps for an org or workspace.' + g.long_desc %( List approved apps for an org or workspace. ) + g.command 'list' 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 'enterprise_id', desc: '.' + c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.' + c.flag 'team_id', desc: '.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_apps_approved_list(options)) + end + end +end diff --git a/bin/commands/admin_apps_restricted.rb b/bin/commands/admin_apps_restricted.rb new file mode 100644 index 00000000..bd758d0f --- /dev/null +++ b/bin/commands/admin_apps_restricted.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +desc 'AdminAppsRestricted methods.' +command 'admin_apps_restricted' do |g| + g.desc 'List restricted apps for an org or workspace.' + g.long_desc %( List restricted apps for an org or workspace. ) + g.command 'list' 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 'enterprise_id', desc: '.' + c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.' + c.flag 'team_id', desc: '.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_apps_restricted_list(options)) + end + end +end diff --git a/bin/commands/admin_conversations.rb b/bin/commands/admin_conversations.rb new file mode 100644 index 00000000..55d4909a --- /dev/null +++ b/bin/commands/admin_conversations.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +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.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.' + c.flag 'target_team_ids', desc: "The list of workspaces to which the channel should be shared. Not required if the channel is being shared orgwide. Example: ['T1234', 'T5678']." + c.flag 'team_id', desc: 'The workspace to which the channel belongs. Omit this argument if the channel is a cross-workspace shared channel.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_conversations_setTeams(options)) + end + end +end diff --git a/bin/commands/admin_emoji.rb b/bin/commands/admin_emoji.rb new file mode 100644 index 00000000..7cf9574d --- /dev/null +++ b/bin/commands/admin_emoji.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +desc 'AdminEmoji methods.' +command 'admin_emoji' do |g| + g.desc 'Add an emoji.' + g.long_desc %( Add an emoji. ) + g.command 'add' do |c| + c.flag 'name', desc: 'The name of the emoji to be removed. Colons (:myemoji:) around the value are not required, although they may be included.' + c.flag 'url', desc: 'The URL of a file to use as an image for the emoji. Square images under 128KB and with transparent backgrounds work best.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_emoji_add(options)) + end + end + + g.desc 'Add an emoji alias.' + g.long_desc %( Add an emoji alias. ) + g.command 'addAlias' do |c| + c.flag 'alias_for', desc: 'The alias of the emoji.' + c.flag 'name', desc: 'The name of the emoji to be aliased. Colons (:myemoji:) around the value are not required, although they may be included.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_emoji_addAlias(options)) + end + end + + g.desc 'List emoji for an Enterprise Grid organization.' + g.long_desc %( List emoji for an Enterprise Grid organization. ) + g.command 'list' 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: '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_emoji_list(options)) + end + end + + g.desc 'Remove an emoji across an Enterprise Grid organization' + g.long_desc %( Remove an emoji across an Enterprise Grid organization ) + g.command 'remove' do |c| + c.flag 'name', desc: 'The name of the emoji to be removed. Colons (:myemoji:) around the value are not required, although they may be included.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_emoji_remove(options)) + end + end + + g.desc 'Rename an emoji.' + g.long_desc %( Rename an emoji. ) + g.command 'rename' do |c| + c.flag 'name', desc: 'The name of the emoji to be renamed. Colons (:myemoji:) around the value are not required, although they may be included.' + c.flag 'new_name', desc: 'The new name of the emoji.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_emoji_rename(options)) + end + end +end diff --git a/bin/commands/admin_teams_settings.rb b/bin/commands/admin_teams_settings.rb index 3c1be3d7..6e6f8702 100644 --- a/bin/commands/admin_teams_settings.rb +++ b/bin/commands/admin_teams_settings.rb @@ -3,20 +3,49 @@ desc 'AdminTeamsSettings methods.' command 'admin_teams_settings' do |g| + g.desc 'Fetch information about settings in a workspace' + g.long_desc %( Fetch information about settings in a workspace ) + g.command 'info' do |c| + c.flag 'team_id', desc: '.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_teams_settings_info(options)) + end + end + + g.desc 'Set the default channels of a workspace.' + g.long_desc %( Set the default channels of a workspace. ) + g.command 'setDefaultChannels' do |c| + c.flag 'channel_ids', desc: 'An array of channel IDs.' + c.flag 'team_id', desc: 'ID for the workspace to set the default channel for.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_teams_settings_setDefaultChannels(options)) + end + end + g.desc 'Set the description of a given workspace.' g.long_desc %( Set the description of a given workspace. ) g.command 'setDescription' do |c| - c.flag 'description', desc: '.' + c.flag 'description', desc: 'The new description for the workspace.' c.flag 'team_id', desc: 'ID for the workspace to set the description for.' c.action do |_global_options, options, _args| puts JSON.dump($client.admin_teams_settings_setDescription(options)) end end + g.desc 'An API method that allows admins to set the discoverability of a given workspace' + g.long_desc %( An API method that allows admins to set the discoverability of a given workspace ) + g.command 'setDiscoverability' do |c| + c.flag 'discoverability', desc: "This workspace's discovery setting. It must be set to one of open, invite_only, closed, or unlisted." + c.flag 'team_id', desc: 'The ID of the workspace to set discoverability on.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_teams_settings_setDiscoverability(options)) + end + end + g.desc 'Sets the icon of a workspace.' g.long_desc %( Sets the icon of a workspace. ) g.command 'setIcon' do |c| - c.flag 'image_url', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.' + c.flag 'image_url', desc: 'Image URL for the icon.' c.flag 'team_id', desc: 'ID for the workspace to set the icon for.' c.action do |_global_options, options, _args| puts JSON.dump($client.admin_teams_settings_setIcon(options)) @@ -26,7 +55,7 @@ g.desc 'Set the name of a given workspace.' g.long_desc %( Set the name of a given workspace. ) g.command 'setName' do |c| - c.flag 'name', desc: '.' + c.flag 'name', desc: 'The new name of the workspace.' c.flag 'team_id', desc: 'ID for the workspace to set the name for.' c.action do |_global_options, options, _args| puts JSON.dump($client.admin_teams_settings_setName(options)) diff --git a/bin/commands/admin_users.rb b/bin/commands/admin_users.rb index c5adc30f..eec3c563 100644 --- a/bin/commands/admin_users.rb +++ b/bin/commands/admin_users.rb @@ -8,6 +8,7 @@ g.command 'assign' do |c| c.flag 'team_id', desc: 'The ID (T1234) of the workspace.' c.flag 'user_id', desc: 'The ID of the user to add to the workspace.' + c.flag 'channel_ids', desc: 'Comma separated values of channel IDs to add user in the new workspace.' c.flag 'is_restricted', desc: 'True if user should be added to the workspace as a guest.' c.flag 'is_ultra_restricted', desc: 'True if user should be added to the workspace as a single-channel guest.' c.action do |_global_options, options, _args| @@ -32,6 +33,17 @@ end end + g.desc 'List users on a workspace' + g.long_desc %( List users on a workspace ) + g.command 'list' do |c| + c.flag 'team_id', desc: 'The ID (T1234) of the workspace.' + 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: 'Limit for how many users to be retrieved per page.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_users_list(options)) + end + end + g.desc 'Remove a user from a workspace.' g.long_desc %( Remove a user from a workspace. ) g.command 'remove' do |c| @@ -52,6 +64,17 @@ end end + g.desc 'Set an expiration for a guest user' + g.long_desc %( Set an expiration for a guest user ) + g.command 'setExpiration' do |c| + c.flag 'expiration_ts', desc: 'Timestamp when guest account should be disabled.' + c.flag 'team_id', desc: 'The ID (T1234) of the workspace.' + c.flag 'user_id', desc: 'The ID of the user to set an expiration for.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.admin_users_setExpiration(options)) + end + end + g.desc 'Set an existing guest, regular user, or admin user to be a workspace owner.' g.long_desc %( Set an existing guest, regular user, or admin user to be a workspace owner. ) g.command 'setOwner' do |c| diff --git a/bin/commands/chat.rb b/bin/commands/chat.rb index 69900148..e727e4db 100644 --- a/bin/commands/chat.rb +++ b/bin/commands/chat.rb @@ -61,7 +61,7 @@ g.command 'postEphemeral' do |c| c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.' c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.' - c.flag 'text', desc: "Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead." + c.flag 'text', desc: 'How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.' c.flag 'user', desc: 'id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.' c.flag 'as_user', desc: 'Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false.' c.flag 'blocks', desc: 'A JSON-based array of structured blocks, presented as a URL-encoded string.' @@ -80,12 +80,12 @@ g.long_desc %( Sends a message to a channel. ) g.command 'postMessage' do |c| c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.' - c.flag 'text', desc: "Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation." - c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.' + c.flag 'text', desc: 'How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.' + c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below. This argument may not be used with newer bot tokens.' c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.' c.flag 'blocks', desc: 'A JSON-based array of structured blocks, presented as a URL-encoded string.' - c.flag 'icon_emoji', desc: 'Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.' - c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.' + c.flag 'icon_emoji', desc: 'Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below. This argument may not be used with newer bot tokens.' + c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below. This argument may not be used with newer bot tokens.' c.flag 'link_names', desc: 'Find and link channel names and usernames.' c.flag 'mrkdwn', desc: 'Disable Slack markup parsing by setting to false. Enabled by default.' c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.' @@ -104,12 +104,12 @@ g.command 'scheduleMessage' do |c| c.flag 'channel', desc: 'Channel, private group, or DM channel to send message to. Can be an encoded ID, or a name. See below for more details.' c.flag 'post_at', desc: 'Unix EPOCH timestamp of time in future to send the message.' - c.flag 'text', desc: "Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation." - c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.' + c.flag 'text', desc: 'How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.' + c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See chat.postMessage.' c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.' c.flag 'blocks', desc: 'A JSON-based array of structured blocks, presented as a URL-encoded string.' c.flag 'link_names', desc: 'Find and link channel names and usernames.' - c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.' + c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See chat.postMessage.' c.flag 'reply_broadcast', desc: 'Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.' c.flag 'thread_ts', desc: "Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead." c.flag 'unfurl_links', desc: 'Pass true to enable unfurling of primarily text-based content.' diff --git a/bin/commands/files.rb b/bin/commands/files.rb index 43afbaa5..52d4be92 100644 --- a/bin/commands/files.rb +++ b/bin/commands/files.rb @@ -38,6 +38,7 @@ g.long_desc %( Lists & filters team files. ) 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.' c.flag 'ts_from', desc: 'Filter files created after this timestamp (inclusive).' c.flag 'ts_to', desc: 'Filter files created before this timestamp (inclusive).' c.flag 'types', desc: 'Filter files by type (see below). You can pass multiple values in the types argument, like types=spaces,snippets.The default value is all, which does not filter the list.' diff --git a/bin/commands/files_remote.rb b/bin/commands/files_remote.rb index 7abd13ca..15c689fd 100644 --- a/bin/commands/files_remote.rb +++ b/bin/commands/files_remote.rb @@ -10,7 +10,7 @@ c.flag 'external_url', desc: 'URL of the remote file.' c.flag 'title', desc: 'Title of the file being shared.' c.flag 'filetype', desc: 'type of file.' - c.flag 'indexable_file_contents', desc: 'File containing contents that can be used to improve searchability for the remote file.' + c.flag 'indexable_file_contents', desc: 'A text file (txt, pdf, doc, etc.) containing textual search terms that are used to improve discovery of the remote file.' c.flag 'preview_image', desc: 'Preview of the document via multipart/form-data.' c.action do |_global_options, options, _args| puts JSON.dump($client.files_remote_add(options)) diff --git a/bin/commands/oauth.rb b/bin/commands/oauth.rb index 0f01902f..b429a87a 100644 --- a/bin/commands/oauth.rb +++ b/bin/commands/oauth.rb @@ -10,7 +10,7 @@ c.flag 'client_secret', desc: 'Issued when you created your application.' c.flag 'code', desc: 'The code param returned via the OAuth callback.' c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).' - c.flag 'single_channel', desc: 'Request the user to add your app only to a single channel.' + c.flag 'single_channel', desc: 'Request the user to add your app only to a single channel. Only valid with a legacy workspace app.' c.action do |_global_options, options, _args| puts JSON.dump($client.oauth_access(options)) end diff --git a/lib/slack/web/api/endpoints.rb b/lib/slack/web/api/endpoints.rb index f8da234f..c9930b7d 100644 --- a/lib/slack/web/api/endpoints.rb +++ b/lib/slack/web/api/endpoints.rb @@ -2,7 +2,11 @@ # This file was auto-generated by lib/tasks/web.rake require_relative 'endpoints/admin_apps' +require_relative 'endpoints/admin_apps_approved' require_relative 'endpoints/admin_apps_requests' +require_relative 'endpoints/admin_apps_restricted' +require_relative 'endpoints/admin_conversations' +require_relative 'endpoints/admin_emoji' require_relative 'endpoints/admin_inviteRequests' require_relative 'endpoints/admin_inviteRequests_approved' require_relative 'endpoints/admin_inviteRequests_denied' @@ -61,7 +65,11 @@ module Endpoints include Slack::Web::Api::Mixins::Groups include AdminApps + include AdminAppsApproved include AdminAppsRequests + include AdminAppsRestricted + include AdminConversations + include AdminEmoji include AdminInviterequests include AdminInviterequestsApproved include AdminInviterequestsDenied diff --git a/lib/slack/web/api/endpoints/admin_apps_approved.rb b/lib/slack/web/api/endpoints/admin_apps_approved.rb new file mode 100644 index 00000000..0dc56379 --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_apps_approved.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 AdminAppsApproved + # + # List approved apps for an org or workspace. + # + # @option options [Object] :cursor + # Set cursor to next_cursor returned by the previous call to list items in the next page. + # @option options [Object] :enterprise_id + # . + # @option options [Object] :limit + # The maximum number of items to return. Must be between 1 - 1000 both inclusive. + # @option options [Object] :team_id + # . + # @see https://api.slack.com/methods/admin.apps.approved.list + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.apps.approved/admin.apps.approved.list.json + def admin_apps_approved_list(options = {}) + if block_given? + Pagination::Cursor.new(self, :admin_apps_approved_list, options).each do |page| + yield page + end + else + post('admin.apps.approved.list', options) + end + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_apps_restricted.rb b/lib/slack/web/api/endpoints/admin_apps_restricted.rb new file mode 100644 index 00000000..f4afb4c1 --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_apps_restricted.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 AdminAppsRestricted + # + # List restricted apps for an org or workspace. + # + # @option options [Object] :cursor + # Set cursor to next_cursor returned by the previous call to list items in the next page. + # @option options [Object] :enterprise_id + # . + # @option options [Object] :limit + # The maximum number of items to return. Must be between 1 - 1000 both inclusive. + # @option options [Object] :team_id + # . + # @see https://api.slack.com/methods/admin.apps.restricted.list + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.apps.restricted/admin.apps.restricted.list.json + def admin_apps_restricted_list(options = {}) + if block_given? + Pagination::Cursor.new(self, :admin_apps_restricted_list, options).each do |page| + yield page + end + else + post('admin.apps.restricted.list', options) + end + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_conversations.rb b/lib/slack/web/api/endpoints/admin_conversations.rb new file mode 100644 index 00000000..de573b55 --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_conversations.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AdminConversations + # + # Set the workspaces in an Enterprise grid org that connect to a channel. + # + # @option options [Object] :channel_id + # The encoded channel_id to add or remove to workspaces. + # @option options [Object] :org_channel + # True if channel has to be converted to an org channel. + # @option options [Object] :target_team_ids + # The list of workspaces to which the channel should be shared. Not required if the channel is being shared orgwide. Example: ['T1234', 'T5678']. + # @option options [Object] :team_id + # The workspace to which the channel belongs. Omit this argument if the channel is a cross-workspace shared channel. + # @see https://api.slack.com/methods/admin.conversations.setTeams + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.setTeams.json + def admin_conversations_setTeams(options = {}) + throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil? + post('admin.conversations.setTeams', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_emoji.rb b/lib/slack/web/api/endpoints/admin_emoji.rb new file mode 100644 index 00000000..f5007804 --- /dev/null +++ b/lib/slack/web/api/endpoints/admin_emoji.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module AdminEmoji + # + # Add an emoji. + # + # @option options [Object] :name + # The name of the emoji to be removed. Colons (:myemoji:) around the value are not required, although they may be included. + # @option options [Object] :url + # The URL of a file to use as an image for the emoji. Square images under 128KB and with transparent backgrounds work best. + # @see https://api.slack.com/methods/admin.emoji.add + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.emoji/admin.emoji.add.json + def admin_emoji_add(options = {}) + throw ArgumentError.new('Required arguments :name missing') if options[:name].nil? + throw ArgumentError.new('Required arguments :url missing') if options[:url].nil? + post('admin.emoji.add', options) + end + + # + # Add an emoji alias. + # + # @option options [Object] :alias_for + # The alias of the emoji. + # @option options [Object] :name + # The name of the emoji to be aliased. Colons (:myemoji:) around the value are not required, although they may be included. + # @see https://api.slack.com/methods/admin.emoji.addAlias + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.emoji/admin.emoji.addAlias.json + def admin_emoji_addAlias(options = {}) + throw ArgumentError.new('Required arguments :alias_for missing') if options[:alias_for].nil? + throw ArgumentError.new('Required arguments :name missing') if options[:name].nil? + post('admin.emoji.addAlias', options) + end + + # + # List emoji for an Enterprise Grid 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 + # The maximum number of items to return. Must be between 1 - 1000 both inclusive. + # @see https://api.slack.com/methods/admin.emoji.list + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.emoji/admin.emoji.list.json + def admin_emoji_list(options = {}) + if block_given? + Pagination::Cursor.new(self, :admin_emoji_list, options).each do |page| + yield page + end + else + post('admin.emoji.list', options) + end + end + + # + # Remove an emoji across an Enterprise Grid organization + # + # @option options [Object] :name + # The name of the emoji to be removed. Colons (:myemoji:) around the value are not required, although they may be included. + # @see https://api.slack.com/methods/admin.emoji.remove + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.emoji/admin.emoji.remove.json + def admin_emoji_remove(options = {}) + throw ArgumentError.new('Required arguments :name missing') if options[:name].nil? + post('admin.emoji.remove', options) + end + + # + # Rename an emoji. + # + # @option options [Object] :name + # The name of the emoji to be renamed. Colons (:myemoji:) around the value are not required, although they may be included. + # @option options [Object] :new_name + # The new name of the emoji. + # @see https://api.slack.com/methods/admin.emoji.rename + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.emoji/admin.emoji.rename.json + def admin_emoji_rename(options = {}) + throw ArgumentError.new('Required arguments :name missing') if options[:name].nil? + throw ArgumentError.new('Required arguments :new_name missing') if options[:new_name].nil? + post('admin.emoji.rename', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/admin_teams_settings.rb b/lib/slack/web/api/endpoints/admin_teams_settings.rb index 53924825..8fc071d8 100644 --- a/lib/slack/web/api/endpoints/admin_teams_settings.rb +++ b/lib/slack/web/api/endpoints/admin_teams_settings.rb @@ -6,11 +6,38 @@ module Web module Api module Endpoints module AdminTeamsSettings + # + # Fetch information about settings in a workspace + # + # @option options [Object] :team_id + # . + # @see https://api.slack.com/methods/admin.teams.settings.info + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.teams.settings/admin.teams.settings.info.json + def admin_teams_settings_info(options = {}) + throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil? + post('admin.teams.settings.info', options) + end + + # + # Set the default channels of a workspace. + # + # @option options [Object] :channel_ids + # An array of channel IDs. + # @option options [Object] :team_id + # ID for the workspace to set the default channel for. + # @see https://api.slack.com/methods/admin.teams.settings.setDefaultChannels + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.teams.settings/admin.teams.settings.setDefaultChannels.json + def admin_teams_settings_setDefaultChannels(options = {}) + throw ArgumentError.new('Required arguments :channel_ids missing') if options[:channel_ids].nil? + throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil? + post('admin.teams.settings.setDefaultChannels', options) + end + # # Set the description of a given workspace. # # @option options [Object] :description - # . + # The new description for the workspace. # @option options [Object] :team_id # ID for the workspace to set the description for. # @see https://api.slack.com/methods/admin.teams.settings.setDescription @@ -21,11 +48,26 @@ def admin_teams_settings_setDescription(options = {}) post('admin.teams.settings.setDescription', options) end + # + # An API method that allows admins to set the discoverability of a given workspace + # + # @option options [Object] :discoverability + # This workspace's discovery setting. It must be set to one of open, invite_only, closed, or unlisted. + # @option options [Object] :team_id + # The ID of the workspace to set discoverability on. + # @see https://api.slack.com/methods/admin.teams.settings.setDiscoverability + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.teams.settings/admin.teams.settings.setDiscoverability.json + def admin_teams_settings_setDiscoverability(options = {}) + throw ArgumentError.new('Required arguments :discoverability missing') if options[:discoverability].nil? + throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil? + post('admin.teams.settings.setDiscoverability', options) + end + # # Sets the icon of a workspace. # # @option options [Object] :image_url - # Set cursor to next_cursor returned by the previous call to list items in the next page. + # Image URL for the icon. # @option options [Object] :team_id # ID for the workspace to set the icon for. # @see https://api.slack.com/methods/admin.teams.settings.setIcon @@ -40,7 +82,7 @@ def admin_teams_settings_setIcon(options = {}) # Set the name of a given workspace. # # @option options [Object] :name - # . + # The new name of the workspace. # @option options [Object] :team_id # ID for the workspace to set the name for. # @see https://api.slack.com/methods/admin.teams.settings.setName diff --git a/lib/slack/web/api/endpoints/admin_users.rb b/lib/slack/web/api/endpoints/admin_users.rb index 4ad31b1e..f4e9a8a0 100644 --- a/lib/slack/web/api/endpoints/admin_users.rb +++ b/lib/slack/web/api/endpoints/admin_users.rb @@ -13,6 +13,8 @@ module AdminUsers # The ID (T1234) of the workspace. # @option options [Object] :user_id # The ID of the user to add to the workspace. + # @option options [Object] :channel_ids + # Comma separated values of channel IDs to add user in the new workspace. # @option options [Object] :is_restricted # True if user should be added to the workspace as a guest. # @option options [Object] :is_ultra_restricted @@ -55,6 +57,28 @@ def admin_users_invite(options = {}) post('admin.users.invite', options) end + # + # List users on a workspace + # + # @option options [Object] :team_id + # The ID (T1234) of the workspace. + # @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 + # Limit for how many users to be retrieved per page. + # @see https://api.slack.com/methods/admin.users.list + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.list.json + def admin_users_list(options = {}) + throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil? + if block_given? + Pagination::Cursor.new(self, :admin_users_list, options).each do |page| + yield page + end + else + post('admin.users.list', options) + end + end + # # Remove a user from a workspace. # @@ -85,6 +109,24 @@ def admin_users_setAdmin(options = {}) post('admin.users.setAdmin', options) end + # + # Set an expiration for a guest user + # + # @option options [Object] :expiration_ts + # Timestamp when guest account should be disabled. + # @option options [Object] :team_id + # The ID (T1234) of the workspace. + # @option options [Object] :user_id + # The ID of the user to set an expiration for. + # @see https://api.slack.com/methods/admin.users.setExpiration + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.setExpiration.json + def admin_users_setExpiration(options = {}) + throw ArgumentError.new('Required arguments :expiration_ts missing') if options[:expiration_ts].nil? + throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil? + throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil? + post('admin.users.setExpiration', options) + end + # # Set an existing guest, regular user, or admin user to be a workspace owner. # diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb index 571105ab..8e9eb533 100644 --- a/lib/slack/web/api/endpoints/chat.rb +++ b/lib/slack/web/api/endpoints/chat.rb @@ -99,7 +99,7 @@ def chat_meMessage(options = {}) # @option options [channel] :channel # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. # @option options [Object] :text - # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. + # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail. # @option options [user] :user # id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument. # @option options [Object] :as_user @@ -146,17 +146,17 @@ def chat_postEphemeral(options = {}) # @option options [channel] :channel # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details. # @option options [Object] :text - # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation. + # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail. # @option options [Object] :as_user - # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below. + # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below. This argument may not be used with newer bot tokens. # @option options [Object] :attachments # A JSON-based array of structured attachments, presented as a URL-encoded string. # @option options [Object] :blocks # A JSON-based array of structured blocks, presented as a URL-encoded string. # @option options [Object] :icon_emoji - # Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below. + # Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below. This argument may not be used with newer bot tokens. # @option options [Object] :icon_url - # URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below. + # URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below. This argument may not be used with newer bot tokens. # @option options [Object] :link_names # Find and link channel names and usernames. # @option options [Object] :mrkdwn @@ -201,9 +201,9 @@ def chat_postMessage(options = {}) # @option options [Object] :post_at # Unix EPOCH timestamp of time in future to send the message. # @option options [Object] :text - # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation. + # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail. # @option options [Object] :as_user - # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below. + # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See chat.postMessage. # @option options [Object] :attachments # A JSON-based array of structured attachments, presented as a URL-encoded string. # @option options [Object] :blocks @@ -211,7 +211,7 @@ def chat_postMessage(options = {}) # @option options [Object] :link_names # Find and link channel names and usernames. # @option options [Object] :parse - # Change how messages are treated. Defaults to none. See below. + # Change how messages are treated. Defaults to none. See chat.postMessage. # @option options [Object] :reply_broadcast # Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false. # @option options [Object] :thread_ts diff --git a/lib/slack/web/api/endpoints/files.rb b/lib/slack/web/api/endpoints/files.rb index 8d2c855a..52452b41 100644 --- a/lib/slack/web/api/endpoints/files.rb +++ b/lib/slack/web/api/endpoints/files.rb @@ -62,6 +62,8 @@ def files_info(options = {}) # # @option options [channel] :channel # Filter files appearing in a specific channel, indicated by its ID. + # @option options [Object] :show_files_hidden_by_limit + # Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit. # @option options [Object] :ts_from # Filter files created after this timestamp (inclusive). # @option options [Object] :ts_to diff --git a/lib/slack/web/api/endpoints/files_remote.rb b/lib/slack/web/api/endpoints/files_remote.rb index 3f651b27..b54114d9 100644 --- a/lib/slack/web/api/endpoints/files_remote.rb +++ b/lib/slack/web/api/endpoints/files_remote.rb @@ -18,7 +18,7 @@ module FilesRemote # @option options [Object] :filetype # type of file. # @option options [Object] :indexable_file_contents - # File containing contents that can be used to improve searchability for the remote file. + # A text file (txt, pdf, doc, etc.) containing textual search terms that are used to improve discovery of the remote file. # @option options [Object] :preview_image # Preview of the document via multipart/form-data. # @see https://api.slack.com/methods/files.remote.add diff --git a/lib/slack/web/api/endpoints/oauth.rb b/lib/slack/web/api/endpoints/oauth.rb index 7e6294a2..09ef89eb 100644 --- a/lib/slack/web/api/endpoints/oauth.rb +++ b/lib/slack/web/api/endpoints/oauth.rb @@ -18,7 +18,7 @@ module Oauth # @option options [Object] :redirect_uri # This must match the originally submitted URI (if one was sent). # @option options [Object] :single_channel - # Request the user to add your app only to a single channel. + # Request the user to add your app only to a single channel. Only valid with a legacy workspace app. # @see https://api.slack.com/methods/oauth.access # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/oauth/oauth.access.json def oauth_access(options = {}) diff --git a/lib/slack/web/api/errors.rb b/lib/slack/web/api/errors.rb index 8a6dd44b..f2870ede 100644 --- a/lib/slack/web/api/errors.rb +++ b/lib/slack/web/api/errors.rb @@ -64,7 +64,9 @@ class CouldNotCreateWorkspace < SlackError; end class DefaultOrgWideChannel < SlackError; end class DiscoverabilitySettingInvalid < SlackError; end class DomainTaken < SlackError; end + class DuplicateChannelNotFound < SlackError; end class DuplicateExternalId < SlackError; end + class DuplicateMessageNotFound < SlackError; end class EditWindowClosed < SlackError; end class EkmAccessDenied < SlackError; end class EmojiNotFound < SlackError; end @@ -340,7 +342,9 @@ class ViewTooLarge < SlackError; end 'default_org_wide_channel' => DefaultOrgWideChannel, 'discoverability_setting_invalid' => DiscoverabilitySettingInvalid, 'domain_taken' => DomainTaken, + 'duplicate_channel_not_found' => DuplicateChannelNotFound, 'duplicate_external_id' => DuplicateExternalId, + 'duplicate_message_not_found' => DuplicateMessageNotFound, 'edit_window_closed' => EditWindowClosed, 'ekm_access_denied' => EkmAccessDenied, 'emoji_not_found' => EmojiNotFound, diff --git a/lib/slack/web/api/slack-api-ref b/lib/slack/web/api/slack-api-ref index 8380e304..c4a603a7 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit 8380e304a6acc2c5981d38459c2c57d27295886e +Subproject commit c4a603a72cbb3b090ed5f5a255820522d9f3eef8 diff --git a/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb b/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb new file mode 100644 index 00000000..aca05618 --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_apps_approved_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::AdminAppsApproved do + let(:client) { Slack::Web::Client.new } +end diff --git a/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb b/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb new file mode 100644 index 00000000..f3d58fc0 --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_apps_restricted_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::AdminAppsRestricted 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 new file mode 100644 index 00000000..916fbbdb --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_conversations_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::AdminConversations do + let(:client) { Slack::Web::Client.new } + 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 +end diff --git a/spec/slack/web/api/endpoints/admin_emoji_spec.rb b/spec/slack/web/api/endpoints/admin_emoji_spec.rb new file mode 100644 index 00000000..b22f8d24 --- /dev/null +++ b/spec/slack/web/api/endpoints/admin_emoji_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::AdminEmoji do + let(:client) { Slack::Web::Client.new } + context 'admin.emoji_add' do + it 'requires name' do + expect { client.admin_emoji_add(url: '') }.to raise_error ArgumentError, /Required arguments :name missing/ + end + it 'requires url' do + expect { client.admin_emoji_add(name: '') }.to raise_error ArgumentError, /Required arguments :url missing/ + end + end + context 'admin.emoji_addAlias' do + it 'requires alias_for' do + expect { client.admin_emoji_addAlias(name: '') }.to raise_error ArgumentError, /Required arguments :alias_for missing/ + end + it 'requires name' do + expect { client.admin_emoji_addAlias(alias_for: '') }.to raise_error ArgumentError, /Required arguments :name missing/ + end + end + context 'admin.emoji_remove' do + it 'requires name' do + expect { client.admin_emoji_remove }.to raise_error ArgumentError, /Required arguments :name missing/ + end + end + context 'admin.emoji_rename' do + it 'requires name' do + expect { client.admin_emoji_rename(new_name: '') }.to raise_error ArgumentError, /Required arguments :name missing/ + end + it 'requires new_name' do + expect { client.admin_emoji_rename(name: '') }.to raise_error ArgumentError, /Required arguments :new_name missing/ + end + end +end diff --git a/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb b/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb index bcc4ac5b..7c0df701 100644 --- a/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +++ b/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb @@ -5,17 +5,38 @@ RSpec.describe Slack::Web::Api::Endpoints::AdminTeamsSettings do let(:client) { Slack::Web::Client.new } + context 'admin.teams.settings_info' do + it 'requires team_id' do + expect { client.admin_teams_settings_info }.to raise_error ArgumentError, /Required arguments :team_id missing/ + end + end + context 'admin.teams.settings_setDefaultChannels' do + it 'requires channel_ids' do + expect { client.admin_teams_settings_setDefaultChannels(team_id: '') }.to raise_error ArgumentError, /Required arguments :channel_ids missing/ + end + it 'requires team_id' do + expect { client.admin_teams_settings_setDefaultChannels(channel_ids: '') }.to raise_error ArgumentError, /Required arguments :team_id missing/ + end + end context 'admin.teams.settings_setDescription' do it 'requires description' do - expect { client.admin_teams_settings_setDescription(team_id: ' ') }.to raise_error ArgumentError, /Required arguments :description missing/ + expect { client.admin_teams_settings_setDescription(team_id: '') }.to raise_error ArgumentError, /Required arguments :description missing/ + end + it 'requires team_id' do + expect { client.admin_teams_settings_setDescription(description: '') }.to raise_error ArgumentError, /Required arguments :team_id missing/ + end + end + context 'admin.teams.settings_setDiscoverability' do + it 'requires discoverability' do + expect { client.admin_teams_settings_setDiscoverability(team_id: '') }.to raise_error ArgumentError, /Required arguments :discoverability missing/ end it 'requires team_id' do - expect { client.admin_teams_settings_setDescription(description: ' ') }.to raise_error ArgumentError, /Required arguments :team_id missing/ + expect { client.admin_teams_settings_setDiscoverability(discoverability: '') }.to raise_error ArgumentError, /Required arguments :team_id missing/ end end context 'admin.teams.settings_setIcon' do it 'requires image_url' do - expect { client.admin_teams_settings_setIcon(team_id: ' ') }.to raise_error ArgumentError, /Required arguments :image_url missing/ + expect { client.admin_teams_settings_setIcon(team_id: '') }.to raise_error ArgumentError, /Required arguments :image_url missing/ end it 'requires team_id' do expect { client.admin_teams_settings_setIcon(image_url: 'http://mysite.com/icon.jpeg') }.to raise_error ArgumentError, /Required arguments :team_id missing/ @@ -23,10 +44,10 @@ end context 'admin.teams.settings_setName' do it 'requires name' do - expect { client.admin_teams_settings_setName(team_id: ' ') }.to raise_error ArgumentError, /Required arguments :name missing/ + expect { client.admin_teams_settings_setName(team_id: '') }.to raise_error ArgumentError, /Required arguments :name missing/ end it 'requires team_id' do - expect { client.admin_teams_settings_setName(name: ' ') }.to raise_error ArgumentError, /Required arguments :team_id missing/ + expect { client.admin_teams_settings_setName(name: '') }.to raise_error ArgumentError, /Required arguments :team_id missing/ end end end diff --git a/spec/slack/web/api/endpoints/admin_teams_spec.rb b/spec/slack/web/api/endpoints/admin_teams_spec.rb index 81e449ea..314baa0d 100644 --- a/spec/slack/web/api/endpoints/admin_teams_spec.rb +++ b/spec/slack/web/api/endpoints/admin_teams_spec.rb @@ -7,10 +7,10 @@ let(:client) { Slack::Web::Client.new } context 'admin.teams_create' do it 'requires team_domain' do - expect { client.admin_teams_create(team_name: ' ') }.to raise_error ArgumentError, /Required arguments :team_domain missing/ + expect { client.admin_teams_create(team_name: '') }.to raise_error ArgumentError, /Required arguments :team_domain missing/ end it 'requires team_name' do - expect { client.admin_teams_create(team_domain: ' ') }.to raise_error ArgumentError, /Required arguments :team_name missing/ + expect { client.admin_teams_create(team_domain: '') }.to raise_error ArgumentError, /Required arguments :team_name missing/ end end end diff --git a/spec/slack/web/api/endpoints/admin_users_spec.rb b/spec/slack/web/api/endpoints/admin_users_spec.rb index 51f78ef8..fd22b994 100644 --- a/spec/slack/web/api/endpoints/admin_users_spec.rb +++ b/spec/slack/web/api/endpoints/admin_users_spec.rb @@ -7,29 +7,34 @@ let(:client) { Slack::Web::Client.new } context 'admin.users_assign' do it 'requires team_id' do - expect { client.admin_users_assign(user_id: ' ') }.to raise_error ArgumentError, /Required arguments :team_id missing/ + expect { client.admin_users_assign(user_id: '') }.to raise_error ArgumentError, /Required arguments :team_id missing/ end it 'requires user_id' do - expect { client.admin_users_assign(team_id: ' ') }.to raise_error ArgumentError, /Required arguments :user_id missing/ + expect { client.admin_users_assign(team_id: '') }.to raise_error ArgumentError, /Required arguments :user_id missing/ end end context 'admin.users_invite' do it 'requires channel_ids' do - expect { client.admin_users_invite(email: 'joe@email.com', team_id: ' ') }.to raise_error ArgumentError, /Required arguments :channel_ids missing/ + expect { client.admin_users_invite(email: 'joe@email.com', team_id: '') }.to raise_error ArgumentError, /Required arguments :channel_ids missing/ end it 'requires email' do - expect { client.admin_users_invite(channel_ids: 'C1A2B3C4D,C26Z25Y24', team_id: ' ') }.to raise_error ArgumentError, /Required arguments :email missing/ + expect { client.admin_users_invite(channel_ids: 'C1A2B3C4D,C26Z25Y24', team_id: '') }.to raise_error ArgumentError, /Required arguments :email missing/ end it 'requires team_id' do expect { client.admin_users_invite(channel_ids: 'C1A2B3C4D,C26Z25Y24', email: 'joe@email.com') }.to raise_error ArgumentError, /Required arguments :team_id missing/ end end + context 'admin.users_list' do + it 'requires team_id' do + expect { client.admin_users_list }.to raise_error ArgumentError, /Required arguments :team_id missing/ + end + end context 'admin.users_remove' do it 'requires team_id' do expect { client.admin_users_remove(user_id: 'W12345678') }.to raise_error ArgumentError, /Required arguments :team_id missing/ end it 'requires user_id' do - expect { client.admin_users_remove(team_id: ' ') }.to raise_error ArgumentError, /Required arguments :user_id missing/ + expect { client.admin_users_remove(team_id: '') }.to raise_error ArgumentError, /Required arguments :user_id missing/ end end context 'admin.users_setAdmin' do @@ -37,15 +42,26 @@ expect { client.admin_users_setAdmin(user_id: 'W12345678') }.to raise_error ArgumentError, /Required arguments :team_id missing/ end it 'requires user_id' do - expect { client.admin_users_setAdmin(team_id: ' ') }.to raise_error ArgumentError, /Required arguments :user_id missing/ + expect { client.admin_users_setAdmin(team_id: '') }.to raise_error ArgumentError, /Required arguments :user_id missing/ + end + end + context 'admin.users_setExpiration' do + it 'requires expiration_ts' do + expect { client.admin_users_setExpiration(team_id: '', user_id: 'W12345678') }.to raise_error ArgumentError, /Required arguments :expiration_ts missing/ + end + it 'requires team_id' do + expect { client.admin_users_setExpiration(expiration_ts: '1234567890', user_id: 'W12345678') }.to raise_error ArgumentError, /Required arguments :team_id missing/ + end + it 'requires user_id' do + expect { client.admin_users_setExpiration(expiration_ts: '1234567890', team_id: '') }.to raise_error ArgumentError, /Required arguments :user_id missing/ end end context 'admin.users_setOwner' do it 'requires team_id' do - expect { client.admin_users_setOwner(user_id: ' ') }.to raise_error ArgumentError, /Required arguments :team_id missing/ + expect { client.admin_users_setOwner(user_id: '') }.to raise_error ArgumentError, /Required arguments :team_id missing/ end it 'requires user_id' do - expect { client.admin_users_setOwner(team_id: ' ') }.to raise_error ArgumentError, /Required arguments :user_id missing/ + expect { client.admin_users_setOwner(team_id: '') }.to raise_error ArgumentError, /Required arguments :user_id missing/ end end context 'admin.users_setRegular' do @@ -53,7 +69,7 @@ expect { client.admin_users_setRegular(user_id: 'W12345678') }.to raise_error ArgumentError, /Required arguments :team_id missing/ end it 'requires user_id' do - expect { client.admin_users_setRegular(team_id: ' ') }.to raise_error ArgumentError, /Required arguments :user_id missing/ + expect { client.admin_users_setRegular(team_id: '') }.to raise_error ArgumentError, /Required arguments :user_id missing/ end end end diff --git a/spec/slack/web/api/endpoints/apps_permissions_spec.rb b/spec/slack/web/api/endpoints/apps_permissions_spec.rb index 9e29e3bd..0a811113 100644 --- a/spec/slack/web/api/endpoints/apps_permissions_spec.rb +++ b/spec/slack/web/api/endpoints/apps_permissions_spec.rb @@ -7,10 +7,10 @@ let(:client) { Slack::Web::Client.new } context 'apps.permissions_request' do it 'requires scopes' do - expect { client.apps_permissions_request(trigger_id: ' ') }.to raise_error ArgumentError, /Required arguments :scopes missing/ + expect { client.apps_permissions_request(trigger_id: '') }.to raise_error ArgumentError, /Required arguments :scopes missing/ end it 'requires trigger_id' do - expect { client.apps_permissions_request(scopes: ' ') }.to raise_error ArgumentError, /Required arguments :trigger_id missing/ + expect { client.apps_permissions_request(scopes: '') }.to raise_error ArgumentError, /Required arguments :trigger_id missing/ end end end diff --git a/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb b/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb index e32d7c67..502b34a9 100644 --- a/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +++ b/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb @@ -7,13 +7,13 @@ let(:client) { Slack::Web::Client.new } context 'apps.permissions.users_request' do it 'requires scopes' do - expect { client.apps_permissions_users_request(trigger_id: ' ', user: ' ') }.to raise_error ArgumentError, /Required arguments :scopes missing/ + expect { client.apps_permissions_users_request(trigger_id: '', user: '') }.to raise_error ArgumentError, /Required arguments :scopes missing/ end it 'requires trigger_id' do - expect { client.apps_permissions_users_request(scopes: ' ', user: ' ') }.to raise_error ArgumentError, /Required arguments :trigger_id missing/ + expect { client.apps_permissions_users_request(scopes: '', user: '') }.to raise_error ArgumentError, /Required arguments :trigger_id missing/ end it 'requires user' do - expect { client.apps_permissions_users_request(scopes: ' ', trigger_id: ' ') }.to raise_error ArgumentError, /Required arguments :user missing/ + expect { client.apps_permissions_users_request(scopes: '', trigger_id: '') }.to raise_error ArgumentError, /Required arguments :user 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 d8634741..2ae44ea5 100644 --- a/spec/slack/web/api/endpoints/conversations_spec.rb +++ b/spec/slack/web/api/endpoints/conversations_spec.rb @@ -63,7 +63,7 @@ end context 'conversations_rename' do it 'requires channel' do - expect { client.conversations_rename(name: ' ') }.to raise_error ArgumentError, /Required arguments :channel missing/ + expect { client.conversations_rename(name: '') }.to raise_error ArgumentError, /Required arguments :channel missing/ end it 'requires name' do expect { client.conversations_rename(channel: 'C1234567890') }.to raise_error ArgumentError, /Required arguments :name missing/