Skip to content

Commit 498f34e

Browse files
authored
Use conversations_list instead of deprecated channels_list (#331)
1 parent 0d0514f commit 498f34e

38 files changed

+441
-119
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* [#327](https://github.com/slack-ruby/slack-ruby-client/pull/327), [#326](https://github.com/slack-ruby/slack-ruby-client/pull/326): Added `admin_conversations_whitelist`, `admin_usergroups`, `calls` and `calls_participants` endpoints - [@wasabigeek](https://github.com/wasabigeek).
77
* [#329](https://github.com/slack-ruby/slack-ruby-client/pull/329): Log when methods are deprecated - [@wasabigeek](https://github.com/wasabigeek).
88
* [#325](https://github.com/slack-ruby/slack-ruby-client/pull/325): Remove activesupport dependency - [@ianks](https://github.com/ianks).
9+
* [#331](https://github.com/slack-ruby/slack-ruby-client/pull/331): Use `conversations_list` instead of deprecated `channels_list`. Added `admin_conversations_restrictAccess_addGroup`, `admin_conversations_restrictAccess_listGroups` and `admin_conversations_restrictAccess_removeGroup` endpoints - [@wasabigeek](https://github.com/wasabigeek).
910
* Your contribution here.
1011

1112
### 0.14.6 (2020/3/28)

bin/commands.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require 'commands/admin_apps_requests'
77
require 'commands/admin_apps_restricted'
88
require 'commands/admin_conversations'
9+
require 'commands/admin_conversations_restrictAccess'
910
require 'commands/admin_conversations_whitelist'
1011
require 'commands/admin_emoji'
1112
require 'commands/admin_inviteRequests'
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# frozen_string_literal: true
2+
# This file was auto-generated by lib/tasks/web.rake
3+
4+
desc 'AdminConversationsRestrictaccess methods.'
5+
command 'admin_conversations_restrictAccess' do |g|
6+
g.desc 'Add an allowlist of IDP groups for accessing a channel'
7+
g.long_desc %( Add an allowlist of IDP groups for accessing a channel )
8+
g.command 'addGroup' do |c|
9+
c.flag 'channel_id', desc: 'The channel to link this group to.'
10+
c.flag 'group_id', desc: 'The IDP Group ID to be an allowlist for the private channel.'
11+
c.flag 'team_id', desc: 'The workspace where the IDP Group and channel exist.'
12+
c.action do |_global_options, options, _args|
13+
puts JSON.dump($client.admin_conversations_restrictAccess_addGroup(options))
14+
end
15+
end
16+
17+
g.desc 'List all IDP Groups linked to a channel'
18+
g.long_desc %( List all IDP Groups linked to a channel )
19+
g.command 'listGroups' do |c|
20+
c.flag 'channel_id', desc: '.'
21+
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.'
22+
c.action do |_global_options, options, _args|
23+
puts JSON.dump($client.admin_conversations_restrictAccess_listGroups(options))
24+
end
25+
end
26+
27+
g.desc 'Remove a linked IDP group linked from a private channel'
28+
g.long_desc %( Remove a linked IDP group linked from a private channel )
29+
g.command 'removeGroup' do |c|
30+
c.flag 'channel_id', desc: 'The channel to remove the linked group from.'
31+
c.flag 'group_id', desc: 'The IDP Group ID to remove from the private channel.'
32+
c.flag 'team_id', desc: 'The workspace where the IDP Group and channel exist.'
33+
c.action do |_global_options, options, _args|
34+
puts JSON.dump($client.admin_conversations_restrictAccess_removeGroup(options))
35+
end
36+
end
37+
end

bin/commands/admin_conversations_whitelist.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
desc 'AdminConversationsWhitelist methods.'
55
command 'admin_conversations_whitelist' do |g|
6-
g.desc 'Add a whitelist of IDP groups for accessing a channel'
7-
g.long_desc %( Add a whitelist of IDP groups for accessing a channel )
6+
g.desc 'Add an allowlist of IDP groups for accessing a channel'
7+
g.long_desc %( Add an allowlist of IDP groups for accessing a channel )
88
g.command 'add' do |c|
99
c.flag 'channel_id', desc: 'The channel to whitelist a group for.'
1010
c.flag 'group_id', desc: 'The IDP Group ID to whitelist for the private channel.'
@@ -24,8 +24,8 @@
2424
end
2525
end
2626

27-
g.desc 'Remove a whitelisted IDP group linked to a private channel'
28-
g.long_desc %( Remove a whitelisted IDP group linked to a private channel )
27+
g.desc 'Remove an allowlisted IDP group linked to a private channel'
28+
g.long_desc %( Remove an allowlisted IDP group linked to a private channel )
2929
g.command 'remove' do |c|
3030
c.flag 'channel_id', desc: 'The channel to remove a whitelisted group for.'
3131
c.flag 'group_id', desc: 'The IDP Group ID to remove from the private channel whitelist.'

bin/commands/admin_usergroups.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
g.long_desc %( Add one or more default channels to an IDP group. )
88
g.command 'addChannels' do |c|
99
c.flag 'channel_ids', desc: 'Comma separated string of channel IDs.'
10-
c.flag 'team_id', desc: 'The workspace to add default channels in.'
1110
c.flag 'usergroup_id', desc: 'ID of the IDP group to add default channels for.'
11+
c.flag 'team_id', desc: 'The workspace to add default channels in.'
1212
c.action do |_global_options, options, _args|
1313
puts JSON.dump($client.admin_usergroups_addChannels(options))
1414
end
1515
end
1616

17-
g.desc 'Add one or more teams to the list of teams associated with an org-level usergroup.'
18-
g.long_desc %( Add one or more teams to the list of teams associated with an org-level usergroup. )
17+
g.desc 'Associate one or more default workspaces with an organization-wide IDP group.'
18+
g.long_desc %( Associate one or more default workspaces with an organization-wide IDP group. )
1919
g.command 'addTeams' do |c|
20-
c.flag 'team_ids', desc: 'A comma separated list of encoded team IDs. Teams MUST belong to the organization.'
21-
c.flag 'usergroup_id', desc: 'A encoded usergroup ID.'
22-
c.flag 'auto_provision', desc: 'A boolean to control whether to automatically create new team users for the usergroup memebrs or not.'
20+
c.flag 'team_ids', desc: 'A comma separated list of encoded team (workspace) IDs. Each workspace MUST belong to the organization associated with the token.'
21+
c.flag 'usergroup_id', desc: 'An encoded usergroup (IDP Group) ID.'
22+
c.flag 'auto_provision', desc: 'When true, this method automatically creates new workspace accounts for the IDP group members.'
2323
c.action do |_global_options, options, _args|
2424
puts JSON.dump($client.admin_usergroups_addTeams(options))
2525
end

bin/commands/calls_participants.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,14 @@
1212
puts JSON.dump($client.calls_participants_add(options))
1313
end
1414
end
15+
16+
g.desc 'Registers participants removed from a Call.'
17+
g.long_desc %( Registers participants removed from a Call. )
18+
g.command 'remove' do |c|
19+
c.flag 'id', desc: 'id returned by the calls.add method.'
20+
c.flag 'users', desc: 'The list of users to remove as participants in the Call. Read more on how to specify users here.'
21+
c.action do |_global_options, options, _args|
22+
puts JSON.dump($client.calls_participants_remove(options))
23+
end
24+
end
1525
end

bin/commands/conversations.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
g.command 'create' do |c|
2727
c.flag 'name', desc: 'Name of the public or private channel to create.'
2828
c.flag 'is_private', desc: 'Create a private channel instead of a public one.'
29-
c.flag 'user_ids', desc: 'Required for workspace apps. A list of between 1 and 30 human users that will be added to the newly-created conversation. This argument has no effect when used by classic Slack apps.'
3029
c.action do |_global_options, options, _args|
3130
puts JSON.dump($client.conversations_create(options))
3231
end

lib/slack/web/api/endpoints.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require_relative 'endpoints/admin_apps_requests'
77
require_relative 'endpoints/admin_apps_restricted'
88
require_relative 'endpoints/admin_conversations'
9+
require_relative 'endpoints/admin_conversations_restrictAccess'
910
require_relative 'endpoints/admin_conversations_whitelist'
1011
require_relative 'endpoints/admin_emoji'
1112
require_relative 'endpoints/admin_inviteRequests'
@@ -64,6 +65,7 @@ module Slack
6465
module Web
6566
module Api
6667
module Endpoints
68+
include Slack::Web::Api::Mixins::Conversations
6769
include Slack::Web::Api::Mixins::Channels
6870
include Slack::Web::Api::Mixins::Users
6971
include Slack::Web::Api::Mixins::Groups
@@ -73,6 +75,7 @@ module Endpoints
7375
include AdminAppsRequests
7476
include AdminAppsRestricted
7577
include AdminConversations
78+
include AdminConversationsRestrictaccess
7679
include AdminConversationsWhitelist
7780
include AdminEmoji
7881
include AdminInviterequests
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# frozen_string_literal: true
2+
# This file was auto-generated by lib/tasks/web.rake
3+
4+
module Slack
5+
module Web
6+
module Api
7+
module Endpoints
8+
module AdminConversationsRestrictaccess
9+
#
10+
# Add an allowlist of IDP groups for accessing a channel
11+
#
12+
# @option options [Object] :channel_id
13+
# The channel to link this group to.
14+
# @option options [Object] :group_id
15+
# The IDP Group ID to be an allowlist for the private channel.
16+
# @option options [Object] :team_id
17+
# The workspace where the IDP Group and channel exist.
18+
# @see https://api.slack.com/methods/admin.conversations.restrictAccess.addGroup
19+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.restrictAccess/admin.conversations.restrictAccess.addGroup.json
20+
def admin_conversations_restrictAccess_addGroup(options = {})
21+
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
22+
throw ArgumentError.new('Required arguments :group_id missing') if options[:group_id].nil?
23+
post('admin.conversations.restrictAccess.addGroup', options)
24+
end
25+
26+
#
27+
# List all IDP Groups linked to a channel
28+
#
29+
# @option options [Object] :channel_id
30+
# .
31+
# @option options [Object] :team_id
32+
# 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.
33+
# @see https://api.slack.com/methods/admin.conversations.restrictAccess.listGroups
34+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.restrictAccess/admin.conversations.restrictAccess.listGroups.json
35+
def admin_conversations_restrictAccess_listGroups(options = {})
36+
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
37+
post('admin.conversations.restrictAccess.listGroups', options)
38+
end
39+
40+
#
41+
# Remove a linked IDP group linked from a private channel
42+
#
43+
# @option options [Object] :channel_id
44+
# The channel to remove the linked group from.
45+
# @option options [Object] :group_id
46+
# The IDP Group ID to remove from the private channel.
47+
# @option options [Object] :team_id
48+
# The workspace where the IDP Group and channel exist.
49+
# @see https://api.slack.com/methods/admin.conversations.restrictAccess.removeGroup
50+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.restrictAccess/admin.conversations.restrictAccess.removeGroup.json
51+
def admin_conversations_restrictAccess_removeGroup(options = {})
52+
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
53+
throw ArgumentError.new('Required arguments :group_id missing') if options[:group_id].nil?
54+
throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
55+
post('admin.conversations.restrictAccess.removeGroup', options)
56+
end
57+
end
58+
end
59+
end
60+
end
61+
end

lib/slack/web/api/endpoints/admin_conversations_whitelist.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Api
77
module Endpoints
88
module AdminConversationsWhitelist
99
#
10-
# Add a whitelist of IDP groups for accessing a channel
10+
# Add an allowlist of IDP groups for accessing a channel
1111
#
1212
# @option options [Object] :channel_id
1313
# The channel to whitelist a group for.
@@ -20,6 +20,7 @@ module AdminConversationsWhitelist
2020
def admin_conversations_whitelist_add(options = {})
2121
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
2222
throw ArgumentError.new('Required arguments :group_id missing') if options[:group_id].nil?
23+
logger.warn('admin.conversations.whitelist.add: Alternative methods: .')
2324
post('admin.conversations.whitelist.add', options)
2425
end
2526

@@ -34,11 +35,12 @@ def admin_conversations_whitelist_add(options = {})
3435
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.whitelist/admin.conversations.whitelist.listGroupsLinkedToChannel.json
3536
def admin_conversations_whitelist_listGroupsLinkedToChannel(options = {})
3637
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
38+
logger.warn('admin.conversations.whitelist.listGroupsLinkedToChannel: Alternative methods: .')
3739
post('admin.conversations.whitelist.listGroupsLinkedToChannel', options)
3840
end
3941

4042
#
41-
# Remove a whitelisted IDP group linked to a private channel
43+
# Remove an allowlisted IDP group linked to a private channel
4244
#
4345
# @option options [Object] :channel_id
4446
# The channel to remove a whitelisted group for.
@@ -52,6 +54,7 @@ def admin_conversations_whitelist_remove(options = {})
5254
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
5355
throw ArgumentError.new('Required arguments :group_id missing') if options[:group_id].nil?
5456
throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
57+
logger.warn('admin.conversations.whitelist.remove: Alternative methods: .')
5558
post('admin.conversations.whitelist.remove', options)
5659
end
5760
end

0 commit comments

Comments
 (0)