Skip to content

Commit

Permalink
Use conversations_list instead of deprecated channels_list (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabigeek authored Jul 7, 2020
1 parent 0d0514f commit 498f34e
Show file tree
Hide file tree
Showing 38 changed files with 441 additions and 119 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [#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).
* [#329](https://github.com/slack-ruby/slack-ruby-client/pull/329): Log when methods are deprecated - [@wasabigeek](https://github.com/wasabigeek).
* [#325](https://github.com/slack-ruby/slack-ruby-client/pull/325): Remove activesupport dependency - [@ianks](https://github.com/ianks).
* [#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).
* Your contribution here.

### 0.14.6 (2020/3/28)
Expand Down
1 change: 1 addition & 0 deletions bin/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require 'commands/admin_apps_requests'
require 'commands/admin_apps_restricted'
require 'commands/admin_conversations'
require 'commands/admin_conversations_restrictAccess'
require 'commands/admin_conversations_whitelist'
require 'commands/admin_emoji'
require 'commands/admin_inviteRequests'
Expand Down
37 changes: 37 additions & 0 deletions bin/commands/admin_conversations_restrictAccess.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

desc 'AdminConversationsRestrictaccess methods.'
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 )
g.command 'addGroup' do |c|
c.flag 'channel_id', desc: 'The channel to link this group to.'
c.flag 'group_id', desc: 'The IDP Group ID to be an allowlist for the private channel.'
c.flag 'team_id', desc: 'The workspace where the IDP Group and channel exist.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_conversations_restrictAccess_addGroup(options))
end
end

g.desc 'List all IDP Groups linked to a channel'
g.long_desc %( List all IDP Groups linked to a channel )
g.command 'listGroups' do |c|
c.flag 'channel_id', desc: '.'
c.flag 'team_id', desc: 'The workspace where the channele exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_conversations_restrictAccess_listGroups(options))
end
end

g.desc 'Remove a linked IDP group linked from a private channel'
g.long_desc %( Remove a linked IDP group linked from a private channel )
g.command 'removeGroup' do |c|
c.flag 'channel_id', desc: 'The channel to remove the linked group from.'
c.flag 'group_id', desc: 'The IDP Group ID to remove from the private channel.'
c.flag 'team_id', desc: 'The workspace where the IDP Group and channel exist.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_conversations_restrictAccess_removeGroup(options))
end
end
end
8 changes: 4 additions & 4 deletions bin/commands/admin_conversations_whitelist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

desc 'AdminConversationsWhitelist methods.'
command 'admin_conversations_whitelist' do |g|
g.desc 'Add a whitelist of IDP groups for accessing a channel'
g.long_desc %( Add a whitelist of IDP groups for accessing a channel )
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 )
g.command 'add' do |c|
c.flag 'channel_id', desc: 'The channel to whitelist a group for.'
c.flag 'group_id', desc: 'The IDP Group ID to whitelist for the private channel.'
Expand All @@ -24,8 +24,8 @@
end
end

g.desc 'Remove a whitelisted IDP group linked to a private channel'
g.long_desc %( Remove a whitelisted IDP group linked to a private channel )
g.desc 'Remove an allowlisted IDP group linked to a private channel'
g.long_desc %( Remove an allowlisted IDP group linked to a private channel )
g.command 'remove' do |c|
c.flag 'channel_id', desc: 'The channel to remove a whitelisted group for.'
c.flag 'group_id', desc: 'The IDP Group ID to remove from the private channel whitelist.'
Expand Down
12 changes: 6 additions & 6 deletions bin/commands/admin_usergroups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
g.long_desc %( Add one or more default channels to an IDP group. )
g.command 'addChannels' do |c|
c.flag 'channel_ids', desc: 'Comma separated string of channel IDs.'
c.flag 'team_id', desc: 'The workspace to add default channels in.'
c.flag 'usergroup_id', desc: 'ID of the IDP group to add default channels for.'
c.flag 'team_id', desc: 'The workspace to add default channels in.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_usergroups_addChannels(options))
end
end

g.desc 'Add one or more teams to the list of teams associated with an org-level usergroup.'
g.long_desc %( Add one or more teams to the list of teams associated with an org-level usergroup. )
g.desc 'Associate one or more default workspaces with an organization-wide IDP group.'
g.long_desc %( Associate one or more default workspaces with an organization-wide IDP group. )
g.command 'addTeams' do |c|
c.flag 'team_ids', desc: 'A comma separated list of encoded team IDs. Teams MUST belong to the organization.'
c.flag 'usergroup_id', desc: 'A encoded usergroup ID.'
c.flag 'auto_provision', desc: 'A boolean to control whether to automatically create new team users for the usergroup memebrs or not.'
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.'
c.flag 'usergroup_id', desc: 'An encoded usergroup (IDP Group) ID.'
c.flag 'auto_provision', desc: 'When true, this method automatically creates new workspace accounts for the IDP group members.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_usergroups_addTeams(options))
end
Expand Down
10 changes: 10 additions & 0 deletions bin/commands/calls_participants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,14 @@
puts JSON.dump($client.calls_participants_add(options))
end
end

g.desc 'Registers participants removed from a Call.'
g.long_desc %( Registers participants removed from a Call. )
g.command 'remove' do |c|
c.flag 'id', desc: 'id returned by the calls.add method.'
c.flag 'users', desc: 'The list of users to remove as participants in the Call. Read more on how to specify users here.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.calls_participants_remove(options))
end
end
end
1 change: 0 additions & 1 deletion bin/commands/conversations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
g.command 'create' do |c|
c.flag 'name', desc: 'Name of the public or private channel to create.'
c.flag 'is_private', desc: 'Create a private channel instead of a public one.'
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.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.conversations_create(options))
end
Expand Down
3 changes: 3 additions & 0 deletions lib/slack/web/api/endpoints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require_relative 'endpoints/admin_apps_requests'
require_relative 'endpoints/admin_apps_restricted'
require_relative 'endpoints/admin_conversations'
require_relative 'endpoints/admin_conversations_restrictAccess'
require_relative 'endpoints/admin_conversations_whitelist'
require_relative 'endpoints/admin_emoji'
require_relative 'endpoints/admin_inviteRequests'
Expand Down Expand Up @@ -64,6 +65,7 @@ module Slack
module Web
module Api
module Endpoints
include Slack::Web::Api::Mixins::Conversations
include Slack::Web::Api::Mixins::Channels
include Slack::Web::Api::Mixins::Users
include Slack::Web::Api::Mixins::Groups
Expand All @@ -73,6 +75,7 @@ module Endpoints
include AdminAppsRequests
include AdminAppsRestricted
include AdminConversations
include AdminConversationsRestrictaccess
include AdminConversationsWhitelist
include AdminEmoji
include AdminInviterequests
Expand Down
61 changes: 61 additions & 0 deletions lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

module Slack
module Web
module Api
module Endpoints
module AdminConversationsRestrictaccess
#
# Add an allowlist of IDP groups for accessing a channel
#
# @option options [Object] :channel_id
# The channel to link this group to.
# @option options [Object] :group_id
# The IDP Group ID to be an allowlist for the private channel.
# @option options [Object] :team_id
# The workspace where the IDP Group and channel exist.
# @see https://api.slack.com/methods/admin.conversations.restrictAccess.addGroup
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.restrictAccess/admin.conversations.restrictAccess.addGroup.json
def admin_conversations_restrictAccess_addGroup(options = {})
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
throw ArgumentError.new('Required arguments :group_id missing') if options[:group_id].nil?
post('admin.conversations.restrictAccess.addGroup', options)
end

#
# List all IDP Groups linked to a channel
#
# @option options [Object] :channel_id
# .
# @option options [Object] :team_id
# The workspace where the channele exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization.
# @see https://api.slack.com/methods/admin.conversations.restrictAccess.listGroups
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.restrictAccess/admin.conversations.restrictAccess.listGroups.json
def admin_conversations_restrictAccess_listGroups(options = {})
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
post('admin.conversations.restrictAccess.listGroups', options)
end

#
# Remove a linked IDP group linked from a private channel
#
# @option options [Object] :channel_id
# The channel to remove the linked group from.
# @option options [Object] :group_id
# The IDP Group ID to remove from the private channel.
# @option options [Object] :team_id
# The workspace where the IDP Group and channel exist.
# @see https://api.slack.com/methods/admin.conversations.restrictAccess.removeGroup
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.restrictAccess/admin.conversations.restrictAccess.removeGroup.json
def admin_conversations_restrictAccess_removeGroup(options = {})
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
throw ArgumentError.new('Required arguments :group_id missing') if options[:group_id].nil?
throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
post('admin.conversations.restrictAccess.removeGroup', options)
end
end
end
end
end
end
7 changes: 5 additions & 2 deletions lib/slack/web/api/endpoints/admin_conversations_whitelist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Api
module Endpoints
module AdminConversationsWhitelist
#
# Add a whitelist of IDP groups for accessing a channel
# Add an allowlist of IDP groups for accessing a channel
#
# @option options [Object] :channel_id
# The channel to whitelist a group for.
Expand All @@ -20,6 +20,7 @@ module AdminConversationsWhitelist
def admin_conversations_whitelist_add(options = {})
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
throw ArgumentError.new('Required arguments :group_id missing') if options[:group_id].nil?
logger.warn('admin.conversations.whitelist.add: Alternative methods: .')
post('admin.conversations.whitelist.add', options)
end

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

#
# Remove a whitelisted IDP group linked to a private channel
# Remove an allowlisted IDP group linked to a private channel
#
# @option options [Object] :channel_id
# The channel to remove a whitelisted group for.
Expand All @@ -52,6 +54,7 @@ def admin_conversations_whitelist_remove(options = {})
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
throw ArgumentError.new('Required arguments :group_id missing') if options[:group_id].nil?
throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
logger.warn('admin.conversations.whitelist.remove: Alternative methods: .')
post('admin.conversations.whitelist.remove', options)
end
end
Expand Down
13 changes: 6 additions & 7 deletions lib/slack/web/api/endpoints/admin_usergroups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,27 @@ module AdminUsergroups
#
# @option options [Object] :channel_ids
# Comma separated string of channel IDs.
# @option options [Object] :team_id
# The workspace to add default channels in.
# @option options [Object] :usergroup_id
# ID of the IDP group to add default channels for.
# @option options [Object] :team_id
# The workspace to add default channels in.
# @see https://api.slack.com/methods/admin.usergroups.addChannels
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.usergroups/admin.usergroups.addChannels.json
def admin_usergroups_addChannels(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?
throw ArgumentError.new('Required arguments :usergroup_id missing') if options[:usergroup_id].nil?
post('admin.usergroups.addChannels', options)
end

#
# Add one or more teams to the list of teams associated with an org-level usergroup.
# Associate one or more default workspaces with an organization-wide IDP group.
#
# @option options [Object] :team_ids
# A comma separated list of encoded team IDs. Teams MUST belong to the organization.
# A comma separated list of encoded team (workspace) IDs. Each workspace MUST belong to the organization associated with the token.
# @option options [Object] :usergroup_id
# A encoded usergroup ID.
# An encoded usergroup (IDP Group) ID.
# @option options [Object] :auto_provision
# A boolean to control whether to automatically create new team users for the usergroup memebrs or not.
# When true, this method automatically creates new workspace accounts for the IDP group members.
# @see https://api.slack.com/methods/admin.usergroups.addTeams
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.usergroups/admin.usergroups.addTeams.json
def admin_usergroups_addTeams(options = {})
Expand Down
15 changes: 15 additions & 0 deletions lib/slack/web/api/endpoints/calls_participants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ def calls_participants_add(options = {})
throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
post('calls.participants.add', options)
end

#
# Registers participants removed from a Call.
#
# @option options [Object] :id
# id returned by the calls.add method.
# @option options [Object] :users
# The list of users to remove as participants in the Call. Read more on how to specify users here.
# @see https://api.slack.com/methods/calls.participants.remove
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls.participants/calls.participants.remove.json
def calls_participants_remove(options = {})
throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
post('calls.participants.remove', options)
end
end
end
end
Expand Down
Loading

0 comments on commit 498f34e

Please sign in to comment.