Skip to content

Commit 40cf30c

Browse files
manuelmeurerdblock
authored andcommitted
add admin web api methods (#305)
1 parent e18ada5 commit 40cf30c

30 files changed

+858
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
### 0.14.6 (Next)
22

3+
* [#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).
34
* Your contribution here.
45

56
### 0.14.5 (2019/12/23)
67

78
* [#293](https://github.com/slack-ruby/slack-ruby-client/pull/293): Rubocop auto-correct and comprehensive todo - [@jcraigk](https://github.com/jcraigk).
89
* [#297](https://github.com/slack-ruby/slack-ruby-client/pull/297): Various Rubocop fixes - [@jcraigk](https://github.com/jcraigk).
9-
* [#298](https://github.com/slack-ruby/slack-ruby-client/pull/298): Add `admin.apps`, `admin.app.requests` and `views` endpoints - [@jmanian](https://github.com/jmanian).
10-
* [#302](https://github.com/slack-ruby/slack-ruby-client/pull/302): Add `oauth.v2.access` and `views.published` endpoints - [@jwright](https://github.com/jwright).
10+
* [#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).
11+
* [#303](https://github.com/slack-ruby/slack-ruby-client/pull/303): Added `oauth.v2.access` and `views.publish` endpoints - [@jwright](https://github.com/jwright).
1112
* [#309](https://github.com/slack-ruby/slack-ruby-client/pull/309): Stop ping on `inactive_account` and `invalid_auth` - [@dblock](https://github.com/dblock).
1213

1314
### 0.14.4 (2019/7/28)
@@ -171,8 +172,8 @@
171172
### 0.7.1 (2016/5/2)
172173

173174
* [#82](https://github.com/slack-ruby/slack-ruby-client/pull/82): Fix `usergroups.users.{list,update}` and `files.comments.{add,edit,delete}` APIs - [@masatomo](https://github.com/masatomo).
174-
* [#73](https://github.com/slack-ruby/slack-ruby-client/issues/73): Add a `closed` event - [@rkadyb](https://github.com/rkadyb).
175-
* [#69](https://github.com/slack-ruby/slack-ruby-client/issues/69): Add attachments support for `Slack::Web::Api::Endpoints::Chat.chat_update` - [@nicka](https://github.com/nicka).
175+
* [#73](https://github.com/slack-ruby/slack-ruby-client/issues/73): Added a `closed` event - [@rkadyb](https://github.com/rkadyb).
176+
* [#69](https://github.com/slack-ruby/slack-ruby-client/issues/69): Added attachments support for `Slack::Web::Api::Endpoints::Chat.chat_update` - [@nicka](https://github.com/nicka).
176177
* [#85](https://github.com/slack-ruby/slack-ruby-client/issues/85): Compatibility with WebMock 2.0 - [@dblock](https://github.com/dblock).
177178
* Added `as_user` to `chat_delete` Web API - [@dblock](https://github.com/dblock).
178179
* Added `reminders_add`, `reminders_complete`, `reminders_delete`, `reminders_info` and `reminders_list` to Web API - [@dblock](https://github.com/dblock).

bin/commands.rb

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

44
require 'commands/admin_apps'
55
require 'commands/admin_apps_requests'
6+
require 'commands/admin_inviteRequests'
7+
require 'commands/admin_inviteRequests_approved'
8+
require 'commands/admin_inviteRequests_denied'
9+
require 'commands/admin_teams'
10+
require 'commands/admin_teams_admins'
11+
require 'commands/admin_teams_owners'
12+
require 'commands/admin_teams_settings'
13+
require 'commands/admin_users'
614
require 'commands/admin_users_session'
715
require 'commands/api'
816
require 'commands/apps'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# frozen_string_literal: true
2+
# This file was auto-generated by lib/tasks/web.rake
3+
4+
desc 'AdminInviterequests methods.'
5+
command 'admin_inviteRequests' do |g|
6+
g.desc 'Approve a workspace invite request.'
7+
g.long_desc %( Approve a workspace invite request. )
8+
g.command 'approve' do |c|
9+
c.flag 'invite_request_id', desc: 'ID of the request to invite.'
10+
c.flag 'team_id', desc: 'ID for the workspace where the invite request was made.'
11+
c.action do |_global_options, options, _args|
12+
puts JSON.dump($client.admin_inviteRequests_approve(options))
13+
end
14+
end
15+
16+
g.desc 'Deny a workspace invite request.'
17+
g.long_desc %( Deny a workspace invite request. )
18+
g.command 'deny' do |c|
19+
c.flag 'invite_request_id', desc: 'ID of the request to invite.'
20+
c.flag 'team_id', desc: 'ID for the workspace where the invite request was made.'
21+
c.action do |_global_options, options, _args|
22+
puts JSON.dump($client.admin_inviteRequests_deny(options))
23+
end
24+
end
25+
26+
g.desc 'List all pending workspace invite requests.'
27+
g.long_desc %( List all pending workspace invite requests. )
28+
g.command 'list' do |c|
29+
c.flag 'cursor', desc: 'Value of the next_cursor field sent as part of the previous API response.'
30+
c.flag 'limit', desc: 'The number of results that will be returned by the API on each invocation. Must be between 1 - 1000, both inclusive.'
31+
c.flag 'team_id', desc: 'ID for the workspace where the invite requests were made.'
32+
c.action do |_global_options, options, _args|
33+
puts JSON.dump($client.admin_inviteRequests_list(options))
34+
end
35+
end
36+
end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# frozen_string_literal: true
2+
# This file was auto-generated by lib/tasks/web.rake
3+
4+
desc 'AdminInviterequestsApproved methods.'
5+
command 'admin_inviteRequests_approved' do |g|
6+
g.desc 'List all approved workspace invite requests.'
7+
g.long_desc %( List all approved workspace invite requests. )
8+
g.command 'list' do |c|
9+
c.flag 'cursor', desc: 'Value of the next_cursor field sent as part of the previous API response.'
10+
c.flag 'limit', desc: 'The number of results that will be returned by the API on each invocation. Must be between 1 - 1000, both inclusive.'
11+
c.flag 'team_id', desc: 'ID for the workspace where the invite requests were made.'
12+
c.action do |_global_options, options, _args|
13+
puts JSON.dump($client.admin_inviteRequests_approved_list(options))
14+
end
15+
end
16+
end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# frozen_string_literal: true
2+
# This file was auto-generated by lib/tasks/web.rake
3+
4+
desc 'AdminInviterequestsDenied methods.'
5+
command 'admin_inviteRequests_denied' do |g|
6+
g.desc 'List all denied workspace invite requests.'
7+
g.long_desc %( List all denied workspace invite requests. )
8+
g.command 'list' do |c|
9+
c.flag 'cursor', desc: 'Value of the next_cursor field sent as part of the previous api response.'
10+
c.flag 'limit', desc: 'The number of results that will be returned by the API on each invocation. Must be between 1 - 1000 both inclusive.'
11+
c.flag 'team_id', desc: 'ID for the workspace where the invite requests were made.'
12+
c.action do |_global_options, options, _args|
13+
puts JSON.dump($client.admin_inviteRequests_denied_list(options))
14+
end
15+
end
16+
end

bin/commands/admin_teams.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
# This file was auto-generated by lib/tasks/web.rake
3+
4+
desc 'AdminTeams methods.'
5+
command 'admin_teams' do |g|
6+
g.desc 'Create an Enterprise team.'
7+
g.long_desc %( Create an Enterprise team. )
8+
g.command 'create' do |c|
9+
c.flag 'team_domain', desc: 'Team domain (for example, slacksoftballteam).'
10+
c.flag 'team_name', desc: 'Team name (for example, Slack Softball Team).'
11+
c.flag 'team_description', desc: 'Description for the team.'
12+
c.flag 'team_discoverability', desc: "Who can join the team. A team's discoverability can be open, closed, invite_only, or unlisted."
13+
c.action do |_global_options, options, _args|
14+
puts JSON.dump($client.admin_teams_create(options))
15+
end
16+
end
17+
18+
g.desc 'List all teams on an Enterprise organization'
19+
g.long_desc %( List all teams on an Enterprise organization )
20+
g.command 'list' do |c|
21+
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
22+
c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 100 both inclusive.'
23+
c.action do |_global_options, options, _args|
24+
puts JSON.dump($client.admin_teams_list(options))
25+
end
26+
end
27+
end

bin/commands/admin_teams_admins.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# frozen_string_literal: true
2+
# This file was auto-generated by lib/tasks/web.rake
3+
4+
desc 'AdminTeamsAdmins methods.'
5+
command 'admin_teams_admins' do |g|
6+
g.desc 'List all of the admins on a given workspace.'
7+
g.long_desc %( List all of the admins on a given workspace. )
8+
g.command 'list' do |c|
9+
c.flag 'team_id', desc: '.'
10+
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
11+
c.flag 'limit', desc: 'The maximum number of items to return.'
12+
c.action do |_global_options, options, _args|
13+
puts JSON.dump($client.admin_teams_admins_list(options))
14+
end
15+
end
16+
end

bin/commands/admin_teams_owners.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# frozen_string_literal: true
2+
# This file was auto-generated by lib/tasks/web.rake
3+
4+
desc 'AdminTeamsOwners methods.'
5+
command 'admin_teams_owners' do |g|
6+
g.desc 'List all of the owners on a given workspace.'
7+
g.long_desc %( List all of the owners on a given workspace. )
8+
g.command 'list' do |c|
9+
c.flag 'team_id', desc: '.'
10+
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
11+
c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
12+
c.action do |_global_options, options, _args|
13+
puts JSON.dump($client.admin_teams_owners_list(options))
14+
end
15+
end
16+
end
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# frozen_string_literal: true
2+
# This file was auto-generated by lib/tasks/web.rake
3+
4+
desc 'AdminTeamsSettings methods.'
5+
command 'admin_teams_settings' do |g|
6+
g.desc 'Set the description of a given workspace.'
7+
g.long_desc %( Set the description of a given workspace. )
8+
g.command 'setDescription' do |c|
9+
c.flag 'description', desc: '.'
10+
c.flag 'team_id', desc: 'ID for the workspace to set the description for.'
11+
c.action do |_global_options, options, _args|
12+
puts JSON.dump($client.admin_teams_settings_setDescription(options))
13+
end
14+
end
15+
16+
g.desc 'Sets the icon of a workspace.'
17+
g.long_desc %( Sets the icon of a workspace. )
18+
g.command 'setIcon' do |c|
19+
c.flag 'image_url', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
20+
c.flag 'team_id', desc: 'ID for the workspace to set the icon for.'
21+
c.action do |_global_options, options, _args|
22+
puts JSON.dump($client.admin_teams_settings_setIcon(options))
23+
end
24+
end
25+
26+
g.desc 'Set the name of a given workspace.'
27+
g.long_desc %( Set the name of a given workspace. )
28+
g.command 'setName' do |c|
29+
c.flag 'name', desc: '.'
30+
c.flag 'team_id', desc: 'ID for the workspace to set the name for.'
31+
c.action do |_global_options, options, _args|
32+
puts JSON.dump($client.admin_teams_settings_setName(options))
33+
end
34+
end
35+
end

bin/commands/admin_users.rb

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# frozen_string_literal: true
2+
# This file was auto-generated by lib/tasks/web.rake
3+
4+
desc 'AdminUsers methods.'
5+
command 'admin_users' do |g|
6+
g.desc 'Add an Enterprise user to a workspace.'
7+
g.long_desc %( Add an Enterprise user to a workspace. )
8+
g.command 'assign' do |c|
9+
c.flag 'team_id', desc: 'The ID (T1234) of the workspace.'
10+
c.flag 'user_id', desc: 'The ID of the user to add to the workspace.'
11+
c.flag 'is_restricted', desc: 'True if user should be added to the workspace as a guest.'
12+
c.flag 'is_ultra_restricted', desc: 'True if user should be added to the workspace as a single-channel guest.'
13+
c.action do |_global_options, options, _args|
14+
puts JSON.dump($client.admin_users_assign(options))
15+
end
16+
end
17+
18+
g.desc 'Invite a user to a workspace.'
19+
g.long_desc %( Invite a user to a workspace. )
20+
g.command 'invite' do |c|
21+
c.flag 'channel_ids', desc: 'A comma-separated list of channel_ids for this user to join. At least one channel is required.'
22+
c.flag 'email', desc: 'The email address of the person to invite.'
23+
c.flag 'team_id', desc: 'The ID (T1234) of the workspace.'
24+
c.flag 'custom_message', desc: 'An optional message to send to the user in the invite email.'
25+
c.flag 'guest_expiration_ts', desc: 'Timestamp when guest account should be disabled. Only include this timestamp if you are inviting a guest user and you want their account to expire on a certain date.'
26+
c.flag 'is_restricted', desc: 'Is this user a multi-channel guest user? (default: false).'
27+
c.flag 'is_ultra_restricted', desc: 'Is this user a single channel guest user? (default: false).'
28+
c.flag 'real_name', desc: 'Full name of the user.'
29+
c.flag 'resend', desc: 'Allow this invite to be resent in the future if a user has not signed up yet. (default: false).'
30+
c.action do |_global_options, options, _args|
31+
puts JSON.dump($client.admin_users_invite(options))
32+
end
33+
end
34+
35+
g.desc 'Remove a user from a workspace.'
36+
g.long_desc %( Remove a user from a workspace. )
37+
g.command 'remove' do |c|
38+
c.flag 'team_id', desc: 'The ID (T1234) of the workspace.'
39+
c.flag 'user_id', desc: 'The ID of the user to remove.'
40+
c.action do |_global_options, options, _args|
41+
puts JSON.dump($client.admin_users_remove(options))
42+
end
43+
end
44+
45+
g.desc 'Set an existing guest, regular user, or owner to be an admin user.'
46+
g.long_desc %( Set an existing guest, regular user, or owner to be an admin user. )
47+
g.command 'setAdmin' do |c|
48+
c.flag 'team_id', desc: 'The ID (T1234) of the workspace.'
49+
c.flag 'user_id', desc: 'The ID of the user to designate as an admin.'
50+
c.action do |_global_options, options, _args|
51+
puts JSON.dump($client.admin_users_setAdmin(options))
52+
end
53+
end
54+
55+
g.desc 'Set an existing guest, regular user, or admin user to be a workspace owner.'
56+
g.long_desc %( Set an existing guest, regular user, or admin user to be a workspace owner. )
57+
g.command 'setOwner' do |c|
58+
c.flag 'team_id', desc: 'The ID (T1234) of the workspace.'
59+
c.flag 'user_id', desc: 'Id of the user to promote to owner.'
60+
c.action do |_global_options, options, _args|
61+
puts JSON.dump($client.admin_users_setOwner(options))
62+
end
63+
end
64+
65+
g.desc 'Set an existing guest user, admin user, or owner to be a regular user.'
66+
g.long_desc %( Set an existing guest user, admin user, or owner to be a regular user. )
67+
g.command 'setRegular' do |c|
68+
c.flag 'team_id', desc: 'The ID (T1234) of the workspace.'
69+
c.flag 'user_id', desc: 'The ID of the user to designate as a regular user.'
70+
c.action do |_global_options, options, _args|
71+
puts JSON.dump($client.admin_users_setRegular(options))
72+
end
73+
end
74+
end

0 commit comments

Comments
 (0)