Skip to content

Commit

Permalink
Update New Methods (#327)
Browse files Browse the repository at this point in the history
* Update slack-api-ref reference

* Add AdminConversationsWhitelist methods

* Update AdminConversations docs

* Add endpoints for AdminConversationsWhitelist

* Update changelog

* Add more new methods

* Update changelog
  • Loading branch information
wasabigeek authored Jun 14, 2020
1 parent 9b20556 commit c04a831
Show file tree
Hide file tree
Showing 19 changed files with 621 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
### 0.15.0 (Next)

* [#326](https://github.com/slack-ruby/slack-ruby-client/pull/326): Update new methods - [@wasabigeek](https://github.com/wasabigeek).
* [#322](https://github.com/slack-ruby/slack-ruby-client/pull/322): Cache `Faraday::Connection` for persistent adapters - [@drbrain](https://github.com/drbrain).
* [#324](https://github.com/slack-ruby/slack-ruby-client/pull/324): Require Faraday >= 1.0 - [@dblock](https://github.com/dblock).
* [#324](https://github.com/slack-ruby/slack-ruby-client/pull/324): Upgrade slack-ruby-danger, rubocop, rubocop-rspec and rubocop-performance - [@dblock](https://github.com/dblock).
* [#322](https://github.com/slack-ruby/slack-ruby-client/pull/322): Cache `Faraday::Connection` for persistent adapters - [@drbrain](https://github.com/drbrain).
* [#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).
* Your contribution here.

### 0.14.6 (2020/3/28)
Expand Down
4 changes: 4 additions & 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_whitelist'
require 'commands/admin_emoji'
require 'commands/admin_inviteRequests'
require 'commands/admin_inviteRequests_approved'
Expand All @@ -14,6 +15,7 @@
require 'commands/admin_teams_admins'
require 'commands/admin_teams_owners'
require 'commands/admin_teams_settings'
require 'commands/admin_usergroups'
require 'commands/admin_users'
require 'commands/admin_users_session'
require 'commands/api'
Expand All @@ -24,6 +26,8 @@
require 'commands/apps_permissions_users'
require 'commands/auth'
require 'commands/bots'
require 'commands/calls'
require 'commands/calls_participants'
require 'commands/channels'
require 'commands/chat'
require 'commands/chat_scheduledMessages'
Expand Down
2 changes: 1 addition & 1 deletion bin/commands/admin_conversations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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 'target_team_ids', desc: 'A comma-separated list of workspaces to which the channel should be shared. Not required if the channel is being shared org-wide.'
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))
Expand Down
37 changes: 37 additions & 0 deletions bin/commands/admin_conversations_whitelist.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 '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.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.'
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_whitelist_add(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 'listGroupsLinkedToChannel' 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_whitelist_listGroupsLinkedToChannel(options))
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.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.'
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_whitelist_remove(options))
end
end
end
48 changes: 48 additions & 0 deletions bin/commands/admin_usergroups.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

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.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.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.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.action do |_global_options, options, _args|
puts JSON.dump($client.admin_usergroups_addTeams(options))
end
end

g.desc 'List the channels linked to an org-level IDP group (user group).'
g.long_desc %( List the channels linked to an org-level IDP group (user group). )
g.command 'listChannels' do |c|
c.flag 'usergroup_id', desc: 'ID of the IDP group to list default channels for.'
c.flag 'include_num_members', desc: 'Flag to include or exclude the count of members per channel.'
c.flag 'team_id', desc: 'ID of the the workspace.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_usergroups_listChannels(options))
end
end

g.desc 'Remove one or more default channels from an org-level IDP group (user group).'
g.long_desc %( Remove one or more default channels from an org-level IDP group (user group). )
g.command 'removeChannels' do |c|
c.flag 'channel_ids', desc: 'Comma-separated string of channel IDs.'
c.flag 'usergroup_id', desc: 'ID of the IDP Group.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.admin_usergroups_removeChannels(options))
end
end
end
52 changes: 52 additions & 0 deletions bin/commands/calls.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

desc 'Calls methods.'
command 'calls' do |g|
g.desc 'Registers a new Call.'
g.long_desc %( Registers a new Call. )
g.command 'add' do |c|
c.flag 'external_unique_id', desc: 'An ID supplied by the 3rd-party Call provider. It must be unique across all Calls from that service.'
c.flag 'join_url', desc: 'The URL required for a client to join the Call.'
c.flag 'created_by', desc: 'The valid Slack user ID of the user who created this Call. When this method is called with a user token, the created_by field is optional and defaults to the authed user of the token. Otherwise, the field is required.'
c.flag 'date_start', desc: 'Call start time in UTC UNIX timestamp format.'
c.flag 'desktop_app_join_url', desc: 'When supplied, available Slack clients will attempt to directly launch the 3rd-party Call with this URL.'
c.flag 'external_display_id', desc: 'An optional, human-readable ID supplied by the 3rd-party Call provider. If supplied, this ID will be displayed in the Call object.'
c.flag 'title', desc: 'The name of the Call.'
c.flag 'users', desc: 'The list of users to register 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_add(options))
end
end

g.desc 'Ends a Call.'
g.long_desc %( Ends a Call. )
g.command 'end' do |c|
c.flag 'id', desc: 'id returned when registering the call using the calls.add method.'
c.flag 'duration', desc: 'Call duration in seconds.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.calls_end(options))
end
end

g.desc 'Returns information about a Call.'
g.long_desc %( Returns information about a Call. )
g.command 'info' do |c|
c.flag 'id', desc: 'id of the Call returned by the calls.add method.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.calls_info(options))
end
end

g.desc 'Updates information about a Call.'
g.long_desc %( Updates information about a Call. )
g.command 'update' do |c|
c.flag 'id', desc: 'id returned by the calls.add method.'
c.flag 'desktop_app_join_url', desc: 'When supplied, available Slack clients will attempt to directly launch the 3rd-party Call with this URL.'
c.flag 'join_url', desc: 'The URL required for a client to join the Call.'
c.flag 'title', desc: 'The name of the Call.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.calls_update(options))
end
end
end
15 changes: 15 additions & 0 deletions bin/commands/calls_participants.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 'CallsParticipants methods.'
command 'calls_participants' do |g|
g.desc 'Registers new participants added to a Call.'
g.long_desc %( Registers new participants added to a Call. )
g.command 'add' do |c|
c.flag 'id', desc: 'id returned by the calls.add method.'
c.flag 'users', desc: 'The list of users to add 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_add(options))
end
end
end
8 changes: 8 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_whitelist'
require_relative 'endpoints/admin_emoji'
require_relative 'endpoints/admin_inviteRequests'
require_relative 'endpoints/admin_inviteRequests_approved'
Expand All @@ -14,6 +15,7 @@
require_relative 'endpoints/admin_teams_admins'
require_relative 'endpoints/admin_teams_owners'
require_relative 'endpoints/admin_teams_settings'
require_relative 'endpoints/admin_usergroups'
require_relative 'endpoints/admin_users'
require_relative 'endpoints/admin_users_session'
require_relative 'endpoints/api'
Expand All @@ -24,6 +26,8 @@
require_relative 'endpoints/apps_permissions_users'
require_relative 'endpoints/auth'
require_relative 'endpoints/bots'
require_relative 'endpoints/calls'
require_relative 'endpoints/calls_participants'
require_relative 'endpoints/channels'
require_relative 'endpoints/chat'
require_relative 'endpoints/chat_scheduledMessages'
Expand Down Expand Up @@ -69,6 +73,7 @@ module Endpoints
include AdminAppsRequests
include AdminAppsRestricted
include AdminConversations
include AdminConversationsWhitelist
include AdminEmoji
include AdminInviterequests
include AdminInviterequestsApproved
Expand All @@ -77,6 +82,7 @@ module Endpoints
include AdminTeamsAdmins
include AdminTeamsOwners
include AdminTeamsSettings
include AdminUsergroups
include AdminUsers
include AdminUsersSession
include Api
Expand All @@ -87,6 +93,8 @@ module Endpoints
include AppsPermissionsUsers
include Auth
include Bots
include Calls
include CallsParticipants
include Channels
include Chat
include ChatScheduledmessages
Expand Down
2 changes: 1 addition & 1 deletion lib/slack/web/api/endpoints/admin_conversations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module AdminConversations
# @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'].
# A comma-separated list of workspaces to which the channel should be shared. Not required if the channel is being shared org-wide.
# @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
Expand Down
61 changes: 61 additions & 0 deletions lib/slack/web/api/endpoints/admin_conversations_whitelist.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 AdminConversationsWhitelist
#
# Add a whitelist of IDP groups for accessing a channel
#
# @option options [Object] :channel_id
# The channel to whitelist a group for.
# @option options [Object] :group_id
# The IDP Group ID to whitelist 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.whitelist.add
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.whitelist/admin.conversations.whitelist.add.json
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?
post('admin.conversations.whitelist.add', 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.whitelist.listGroupsLinkedToChannel
# @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?
post('admin.conversations.whitelist.listGroupsLinkedToChannel', options)
end

#
# Remove a whitelisted IDP group linked to a private channel
#
# @option options [Object] :channel_id
# The channel to remove a whitelisted group for.
# @option options [Object] :group_id
# The IDP Group ID to remove from the private channel whitelist.
# @option options [Object] :team_id
# The workspace where the IDP Group and channel exist.
# @see https://api.slack.com/methods/admin.conversations.whitelist.remove
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations.whitelist/admin.conversations.whitelist.remove.json
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?
post('admin.conversations.whitelist.remove', options)
end
end
end
end
end
end
Loading

0 comments on commit c04a831

Please sign in to comment.