Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Slack API. #356

Merged
merged 2 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
### 0.16.0 (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).
* [#350](https://github.com/slack-ruby/slack-ruby-client/pull/350): Handle server errors such as timouts & non-json responses (see [Upgrading to 0.16.0](UPGRADING.md#upgrading-to--0160)) - [@ojab](https://github.com/ojab).
* [#354](https://github.com/slack-ruby/slack-ruby-client/pull/354): Rewind body after checking request signature - [@sunny](https://github.com/sunny).
* [#355](https://github.com/slack-ruby/slack-ruby-client/pull/355): Remove celluloid code - [@wasabigeek](https://github.com/wasabigeek).
* [#355](https://github.com/slack-ruby/slack-ruby-client/pull/355): Removed celluloid concurrency support - [@wasabigeek](https://github.com/wasabigeek).
* [#356](https://github.com/slack-ruby/slack-ruby-client/pull/356): Added `admin_apps_clearResolution`, `admin_conversations_getCustomRetention`, `admin_conversations_removeCustomRetention`, `admin_conversations_setCustomRetention` and `admin_users_session_list` endpoints - [@dblock](https://github.com/dblock).
* [#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` and `workflows_updateStep` endpoints - [@wasabigeek](https://github.com/wasabigeek).
* Your contribution here.

### 0.15.1 (2020/9/3)
Expand Down
4 changes: 4 additions & 0 deletions bin/commands.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

require 'commands/admin_analytics'
require 'commands/admin_apps'
require 'commands/admin_apps_approved'
require 'commands/admin_apps_requests'
require 'commands/admin_apps_restricted'
require 'commands/admin_barriers'
require 'commands/admin_conversations'
require 'commands/admin_conversations_ekm'
require 'commands/admin_conversations_restrictAccess'
Expand All @@ -22,12 +24,14 @@
require 'commands/admin_users_session'
require 'commands/api'
require 'commands/apps'
require 'commands/apps_connections'
require 'commands/apps_event_authorizations'
require 'commands/apps_permissions'
require 'commands/apps_permissions_resources'
require 'commands/apps_permissions_scopes'
require 'commands/apps_permissions_users'
require 'commands/auth'
require 'commands/auth_teams'
require 'commands/bots'
require 'commands/calls'
require 'commands/calls_participants'
Expand Down
15 changes: 15 additions & 0 deletions bin/commands/admin_analytics.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

desc 'AdminAnalytics methods.'
command 'admin_analytics' do |g|
g.desc 'Retrieve analytics data for a given date, presented as a compressed JSON file'
g.long_desc %( Retrieve analytics data for a given date, presented as a compressed JSON file )
g.command 'getFile' do |c|
c.flag 'type', desc: 'The type of analytics to retrieve. The options are currently limited to member.'
c.flag 'date', desc: 'Date to retrieve the analytics data for, expressed as YYYY-MM-DD in UTC.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_analytics_getFile(options))
end
end
end
17 changes: 15 additions & 2 deletions bin/commands/admin_apps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,32 @@
g.long_desc %( Approve an app for installation on a workspace. )
g.command 'approve' do |c|
c.flag 'app_id', desc: 'The id of the app to approve.'
c.flag 'enterprise_id', desc: 'The ID of the enterprise to approve the app on.'
c.flag 'request_id', desc: 'The id of the request to approve.'
c.flag 'team_id', desc: '.'
c.flag 'team_id', desc: 'The ID of the workspace to approve the app on.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_apps_approve(options))
end
end

g.desc 'Clear an app resolution'
g.long_desc %( Clear an app resolution )
g.command 'clearResolution' do |c|
c.flag 'app_id', desc: 'The id of the app whose resolution you want to clear/undo.'
c.flag 'enterprise_id', desc: 'The enterprise to clear the app resolution from.'
c.flag 'team_id', desc: 'The workspace to clear the app resolution from.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_apps_clearResolution(options))
end
end

g.desc 'Restrict an app for installation on a workspace.'
g.long_desc %( Restrict an app for installation on a workspace. )
g.command 'restrict' do |c|
c.flag 'app_id', desc: 'The id of the app to restrict.'
c.flag 'enterprise_id', desc: 'The ID of the enterprise to approve the app on.'
c.flag 'request_id', desc: 'The id of the request to restrict.'
c.flag 'team_id', desc: '.'
c.flag 'team_id', desc: 'The ID of the workspace to approve the app on.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_apps_restrict(options))
end
Expand Down
47 changes: 47 additions & 0 deletions bin/commands/admin_barriers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

desc 'AdminBarriers methods.'
command 'admin_barriers' do |g|
g.desc 'Create an Information Barrier'
g.long_desc %( Create an Information Barrier )
g.command 'create' do |c|
c.flag 'barriered_from_usergroup_ids', desc: 'A list of IDP Groups ids that the primary usergroup is to be barriered from.'
c.flag 'primary_usergroup_id', desc: 'The id of the primary IDP Group.'
c.flag 'restricted_subjects', desc: 'What kind of interactions are blocked by this barrier? For v1, we only support a list of all 3, eg im, mpim, call.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_barriers_create(options))
end
end

g.desc 'Delete an existing Information Barrier'
g.long_desc %( Delete an existing Information Barrier )
g.command 'delete' do |c|
c.flag 'barrier_id', desc: "The ID of the barrier you're trying to delete."
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_barriers_delete(options))
end
end

g.desc 'Get all Information Barriers for your organization'
g.long_desc %( Get all Information Barriers for your 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_barriers_list(options))
end
end

g.desc 'Update an existing Information Barrier'
g.long_desc %( Update an existing Information Barrier )
g.command 'update' do |c|
c.flag 'barrier_id', desc: "The ID of the barrier you're trying to modify."
c.flag 'barriered_from_usergroup_ids', desc: 'A list of IDP Groups ids that the primary usergroup is to be barriered from.'
c.flag 'primary_usergroup_id', desc: 'The id of the primary IDP Group.'
c.flag 'restricted_subjects', desc: 'What kind of interactions are blocked by this barrier? For v1, we only support a list of all 3, eg im, mpim, call.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_barriers_update(options))
end
end
end
28 changes: 28 additions & 0 deletions bin/commands/admin_conversations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@
end
end

g.desc "This API endpoint can be used by any admin to get a channel's retention policy."
g.long_desc %( This API endpoint can be used by any admin to get a channel's retention policy. )
g.command 'getCustomRetention' do |c|
c.flag 'channel_id', desc: 'The channel to get the retention policy for.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_conversations_getCustomRetention(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|
Expand All @@ -83,6 +92,15 @@
end
end

g.desc "This API endpoint can be used by any admin to remove a channel's retention policy."
g.long_desc %( This API endpoint can be used by any admin to remove a channel's retention policy. )
g.command 'removeCustomRetention' do |c|
c.flag 'channel_id', desc: 'The channel to set the retention policy for.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_conversations_removeCustomRetention(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|
Expand Down Expand Up @@ -118,6 +136,16 @@
end
end

g.desc "This API endpoint can be used by any admin to set a channel's retention policy."
g.long_desc %( This API endpoint can be used by any admin to set a channel's retention policy. )
g.command 'setCustomRetention' do |c|
c.flag 'channel_id', desc: 'The channel to set the retention policy for.'
c.flag 'duration_days', desc: 'The message retention duration in days to set for this channel.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_conversations_setCustomRetention(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|
Expand Down
2 changes: 1 addition & 1 deletion bin/commands/admin_conversations_restrictAccess.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

desc 'AdminConversationsRestrictaccess methods.'
desc 'Add and remove user groups from conversations.'
command 'admin_conversations_restrictAccess' do |g|
g.desc 'Add an allowlist of IDP groups for accessing a channel'
g.long_desc %( Add an allowlist of IDP groups for accessing a channel )
Expand Down
2 changes: 1 addition & 1 deletion bin/commands/admin_conversations_whitelist.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

desc 'AdminConversationsWhitelist methods.'
desc 'Add and remove user groups from conversations. Use admin.conversations.* equivalents instead.'
command 'admin_conversations_whitelist' do |g|
g.desc 'Add an allowlist of IDP groups for accessing a channel'
g.long_desc %( Add an allowlist of IDP groups for accessing a channel )
Expand Down
2 changes: 1 addition & 1 deletion bin/commands/admin_emoji.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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 'name', desc: 'The name of the emoji to be added. 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))
Expand Down
4 changes: 2 additions & 2 deletions bin/commands/admin_usergroups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

desc 'AdminUsergroups methods.'
command 'admin_usergroups' do |g|
g.desc 'Add one or more default channels to an IDP group.'
g.long_desc %( Add one or more default channels to an IDP group. )
g.desc 'Add up to one hundred default channels to an IDP group.'
g.long_desc %( Add up to one hundred default channels to an IDP group. )
g.command 'addChannels' do |c|
c.flag 'channel_ids', desc: 'Comma separated string of channel IDs.'
c.flag 'usergroup_id', desc: 'ID of the IDP group to add default channels for.'
Expand Down
4 changes: 2 additions & 2 deletions bin/commands/admin_users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
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.flag 'team_id', desc: 'The ID (T1234) of the workspace.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_users_list(options))
end
Expand Down Expand Up @@ -68,8 +68,8 @@
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.flag 'team_id', desc: 'The ID (T1234) of the workspace.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_users_setExpiration(options))
end
Expand Down
20 changes: 16 additions & 4 deletions bin/commands/admin_users_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,28 @@

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.desc 'Revoke a single session for a user. The user will be forced to login to Slack.'
g.long_desc %( Revoke a single session for a user. The user will be forced to login to Slack. )
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.flag 'session_id', desc: 'ID of the session to invalidate.'
c.flag 'team_id', desc: 'ID of the workspace 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 'List active user sessions for an organization'
g.long_desc %( List active user sessions for an 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.flag 'team_id', desc: "The ID of the workspace you'd like active sessions for. If you pass a team_id, you'll need to pass a user_id as well."
c.flag 'user_id', desc: "The ID of user you'd like active sessions for. If you pass a user_id, you'll need to pass a team_id as well."
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_users_session_list(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|
Expand Down
1 change: 0 additions & 1 deletion bin/commands/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
g.long_desc %( Checks API calling code. )
g.command 'test' do |c|
c.flag 'error', desc: 'Error response to return.'
c.flag 'foo', desc: 'example property to return.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.api_test(options))
end
Expand Down
13 changes: 13 additions & 0 deletions bin/commands/apps_connections.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

desc 'AppsConnections methods.'
command 'apps_connections' do |g|
g.desc 'Generate a temporary Socket Mode WebSocket URL that your app can connect to in order to receive events and interactive payloads over,'
g.long_desc %( Generate a temporary Socket Mode WebSocket URL that your app can connect to in order to receive events and interactive payloads over, )
g.command 'open' do |c|
c.action do |_global_options, options, _args|
puts JSON.dump($client.apps_connections_open(options))
end
end
end
16 changes: 16 additions & 0 deletions bin/commands/auth_teams.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

desc 'AuthTeams methods.'
command 'auth_teams' do |g|
g.desc 'List the workspaces a token can access.'
g.long_desc %( List the workspaces a token can access. )
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 'include_icon', desc: 'Whether to return icon paths for each workspace. An icon path represents a URI pointing to the image signifying the workspace.'
c.flag 'limit', desc: 'The maximum number of workspaces to return. Must be a positive integer no larger than 1000.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.auth_teams_list(options))
end
end
end
1 change: 1 addition & 0 deletions bin/commands/bots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
g.long_desc %( Gets information about a bot user. )
g.command 'info' do |c|
c.flag 'bot', desc: 'Bot user to get info on.'
c.flag 'team_id', desc: 'encoded team id or enterprise id where the bot exists, required if org token is used.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.bots_info(options))
end
Expand Down
9 changes: 6 additions & 3 deletions bin/commands/channels.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

desc 'Channels methods.'
desc "Get info on your team's Slack channels, create or archive channels, invite users, set the topic and purpose, and mark a channel as read."
command 'channels' do |g|
g.desc 'Archives a channel.'
g.long_desc %( Archives a channel. )
Expand All @@ -16,6 +16,7 @@
g.long_desc %( Creates a channel. )
g.command 'create' do |c|
c.flag 'name', desc: 'Name of channel to create.'
c.flag 'team_id', desc: 'encoded team id to create the channel in, required if org token is used.'
c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.channels_create(options))
Expand Down Expand Up @@ -77,6 +78,7 @@
g.long_desc %( Joins a channel, creating it if needed. )
g.command 'join' do |c|
c.flag 'name', desc: 'Name of channel to join.'
c.flag 'team_id', desc: 'encoded team id to list channels in, required if org token is used.'
c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.channels_join(options))
Expand Down Expand Up @@ -109,6 +111,7 @@
c.flag 'exclude_archived', desc: 'Exclude archived channels from the list.'
c.flag 'exclude_members', desc: 'Exclude the members collection from each channel.'
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 'team_id', desc: 'encoded team id to list channels in, required if org token is used.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.channels_list(options))
end
Expand All @@ -117,8 +120,8 @@
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 to set reading cursor in.'
c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
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.channels_mark(options))
end
Expand Down
Loading