-
Notifications
You must be signed in to change notification settings - Fork 662
/
Copy pathusergroups.js
118 lines (100 loc) · 4.2 KB
/
usergroups.js
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
/**
* API Facet to make calls to methods in the usergroups namespace.
*
* This provides functions to call:
* - create: {@link https://api.slack.com/methods/usergroups.create|usergroups.create}
* - disable: {@link https://api.slack.com/methods/usergroups.disable|usergroups.disable}
* - enable: {@link https://api.slack.com/methods/usergroups.enable|usergroups.enable}
* - list: {@link https://api.slack.com/methods/usergroups.list|usergroups.list}
* - update: {@link https://api.slack.com/methods/usergroups.update|usergroups.update}
*
*/
function UsergroupsFacet(makeAPICall) {
this.name = 'usergroups';
this.makeAPICall = makeAPICall;
}
/**
* Create a User Group
* @see {@link https://api.slack.com/methods/usergroups.create|usergroups.create}
*
* @param {?} name - A name for the User Group. Must be unique among User Groups.
* @param {Object=} opts
* @param {?} opts.handle - A mention handle. Must be unique among channels, users and User
* Groups.
* @param {?} opts.description - A short description of the User Group.
* @param {?} opts.channels - A comma separated string of encoded channel IDs for which the User
* Group uses as a default.
* @param {?} opts.include_count - Include the number of users in each User Group.
* @param {function=} optCb Optional callback, if not using promises.
*/
UsergroupsFacet.prototype.create = function create(name, opts, optCb) {
var requiredArgs = {
name: name
};
return this.makeAPICall('usergroups.create', requiredArgs, opts, optCb);
};
/**
* Disable an existing User Group
* @see {@link https://api.slack.com/methods/usergroups.disable|usergroups.disable}
*
* @param {?} usergroup - The encoded ID of the User Group to disable.
* @param {Object=} opts
* @param {?} opts.include_count - Include the number of users in the User Group.
* @param {function=} optCb Optional callback, if not using promises.
*/
UsergroupsFacet.prototype.disable = function disable(usergroup, opts, optCb) {
var requiredArgs = {
usergroup: usergroup
};
return this.makeAPICall('usergroups.disable', requiredArgs, opts, optCb);
};
/**
* Enable a User Group
* @see {@link https://api.slack.com/methods/usergroups.enable|usergroups.enable}
*
* @param {?} usergroup - The encoded ID of the User Group to enable.
* @param {Object=} opts
* @param {?} opts.include_count - Include the number of users in the User Group.
* @param {function=} optCb Optional callback, if not using promises.
*/
UsergroupsFacet.prototype.enable = function enable(usergroup, opts, optCb) {
var requiredArgs = {
usergroup: usergroup
};
return this.makeAPICall('usergroups.enable', requiredArgs, opts, optCb);
};
/**
* List all User Groups for a team
* @see {@link https://api.slack.com/methods/usergroups.list|usergroups.list}
*
* @param {Object=} opts
* @param {?} opts.include_disabled - Include disabled User Groups.
* @param {?} opts.include_count - Include the number of users in each User Group.
* @param {?} opts.include_users - Include the list of users for each User Group.
* @param {function=} optCb Optional callback, if not using promises.
*/
UsergroupsFacet.prototype.list = function list(opts, optCb) {
return this.makeAPICall('usergroups.list', null, opts, optCb);
};
/**
* Update an existing User Group
* @see {@link https://api.slack.com/methods/usergroups.update|usergroups.update}
*
* @param {?} usergroup - The encoded ID of the User Group to update.
* @param {Object=} opts
* @param {?} opts.name - A name for the User Group. Must be unique among User Groups.
* @param {?} opts.handle - A mention handle. Must be unique among channels, users and User
* Groups.
* @param {?} opts.description - A short description of the User Group.
* @param {?} opts.channels - A comma separated string of encoded channel IDs for which the User
* Group uses as a default.
* @param {?} opts.include_count - Include the number of users in the User Group.
* @param {function=} optCb Optional callback, if not using promises.
*/
UsergroupsFacet.prototype.update = function update(usergroup, opts, optCb) {
var requiredArgs = {
usergroup: usergroup
};
return this.makeAPICall('usergroups.update', requiredArgs, opts, optCb);
};
module.exports = UsergroupsFacet;