-
-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathadmin_users.rb
More file actions
167 lines (159 loc) · 8.77 KB
/
Copy pathadmin_users.rb
File metadata and controls
167 lines (159 loc) · 8.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake
module Slack
module Web
module Api
module Endpoints
module AdminUsers
#
# Add an Enterprise user to a workspace.
#
# @option options [Object] :team_id
# The ID (T1234) of the workspace.
# @option options [Object] :user_id
# The ID of the user to add to the workspace.
# @option options [string] :channel_ids
# Comma separated values of channel IDs to add user in the new workspace.
# @option options [boolean] :is_restricted
# True if user should be added to the workspace as a guest.
# @option options [boolean] :is_ultra_restricted
# True if user should be added to the workspace as a single-channel guest.
# @see https://api.slack.com/methods/admin.users.assign
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.assign.json
def admin_users_assign(options = {})
raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
post('admin.users.assign', options)
end
#
# Invite a user to a workspace.
#
# @option options [string] :channel_ids
# A comma-separated list of channel_ids for this user to join. At least one channel is required.
# @option options [string] :email
# The email address of the person to invite.
# @option options [Object] :team_id
# The ID (T1234) of the workspace.
# @option options [string] :custom_message
# An optional message to send to the user in the invite email.
# @option options [boolean] :email_password_policy_enabled
# Allow invited user to sign in via email and password. Only available for Enterprise Grid teams via admin invite.
# @option options [string] :guest_expiration_ts
# 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.
# @option options [boolean] :is_restricted
# Is this user a multi-channel guest user? (default: false).
# @option options [boolean] :is_ultra_restricted
# Is this user a single channel guest user? (default: false).
# @option options [string] :real_name
# Full name of the user.
# @option options [boolean] :resend
# Allow this invite to be resent in the future if a user has not signed up yet. Resending can only be done via the UI and has no expiration. (default: false).
# @see https://api.slack.com/methods/admin.users.invite
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.invite.json
def admin_users_invite(options = {})
raise ArgumentError, 'Required arguments :channel_ids missing' if options[:channel_ids].nil?
raise ArgumentError, 'Required arguments :email missing' if options[:email].nil?
raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
post('admin.users.invite', options)
end
#
# List users on a workspace
#
# @option options [string] :cursor
# Set cursor to next_cursor returned by the previous call to list items in the next page.
# @option options [boolean] :include_deactivated_user_workspaces
# Only applies with org token and no team_id. If true, return workspaces for a user even if they may be deactivated on them. If false, return workspaces for a user only when user is active on them. Default is false.
# @option options [boolean] :is_active
# If true, only active users will be returned. If false, only deactivated users will be returned. Default is true.
# @option options [integer] :limit
# Limit for how many users to be retrieved per page.
# @option options [Object] :team_id
# The ID (T1234) of a workspace. Filters results to just the specified workspace.
# @see https://api.slack.com/methods/admin.users.list
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.list.json
def admin_users_list(options = {})
if block_given?
Pagination::Cursor.new(self, :admin_users_list, options).each do |page|
yield page
end
else
post('admin.users.list', options)
end
end
#
# Remove a user from a workspace.
#
# @option options [Object] :team_id
# The ID (T1234) of the workspace.
# @option options [string] :user_id
# The ID of the user to remove.
# @see https://api.slack.com/methods/admin.users.remove
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.remove.json
def admin_users_remove(options = {})
raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
post('admin.users.remove', options)
end
#
# Set an existing regular user or owner to be a workspace admin.
#
# @option options [Object] :team_id
# The ID (T1234) of the workspace.
# @option options [string] :user_id
# The ID of the user to designate as an admin.
# @see https://api.slack.com/methods/admin.users.setAdmin
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.setAdmin.json
def admin_users_setAdmin(options = {})
raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
post('admin.users.setAdmin', options)
end
#
# Set an expiration for a guest user
#
# @option options [integer] :expiration_ts
# Epoch timestamp in seconds when guest account should be disabled.
# @option options [string] :user_id
# The ID of the user to set an expiration for.
# @option options [Object] :team_id
# The ID (T1234) of the workspace.
# @see https://api.slack.com/methods/admin.users.setExpiration
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.setExpiration.json
def admin_users_setExpiration(options = {})
raise ArgumentError, 'Required arguments :expiration_ts missing' if options[:expiration_ts].nil?
raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
post('admin.users.setExpiration', options)
end
#
# Set an existing regular user or admin to be a workspace owner.
#
# @option options [Object] :team_id
# The ID (T1234) of the workspace.
# @option options [Object] :user_id
# Id of the user to promote to owner.
# @see https://api.slack.com/methods/admin.users.setOwner
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.setOwner.json
def admin_users_setOwner(options = {})
raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
post('admin.users.setOwner', options)
end
#
# Set an existing guest user, admin user, or owner to be a regular user.
#
# @option options [Object] :team_id
# The ID (T1234) of the workspace.
# @option options [string] :user_id
# The ID of the user to designate as a regular user.
# @see https://api.slack.com/methods/admin.users.setRegular
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.setRegular.json
def admin_users_setRegular(options = {})
raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
post('admin.users.setRegular', options)
end
end
end
end
end
end