-
Notifications
You must be signed in to change notification settings - Fork 662
/
stars.js
67 lines (55 loc) · 2.14 KB
/
stars.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
/**
* API Facet to make calls to methods in the stars namespace.
*
* This provides functions to call:
* - add: {@link https://api.slack.com/methods/stars.add|stars.add}
* - list: {@link https://api.slack.com/methods/stars.list|stars.list}
* - remove: {@link https://api.slack.com/methods/stars.remove|stars.remove}
*
*/
function StarsFacet(makeAPICall) {
this.name = 'stars';
this.makeAPICall = makeAPICall;
}
/**
* Adds a star to an item.
* @see {@link https://api.slack.com/methods/stars.add|stars.add}
*
* @param {Object=} opts
* @param {?} opts.file - File to add star to.
* @param {?} opts.file_comment - File comment to add star to.
* @param {?} opts.channel - Channel to add star to, or channel where the message to add star to
* was posted (used with `timestamp`).
* @param {?} opts.timestamp - Timestamp of the message to add star to.
* @param {function=} optCb Optional callback, if not using promises.
*/
StarsFacet.prototype.add = function add(opts, optCb) {
return this.makeAPICall('stars.add', null, opts, optCb);
};
/**
* Lists stars for a user.
* @see {@link https://api.slack.com/methods/stars.list|stars.list}
*
* @param {Object=} opts
* @param {?} opts.user - Show stars by this user. Defaults to the authed user.
* @param {function=} optCb Optional callback, if not using promises.
*/
StarsFacet.prototype.list = function list(opts, optCb) {
return this.makeAPICall('stars.list', null, opts, optCb);
};
/**
* Removes a star from an item.
* @see {@link https://api.slack.com/methods/stars.remove|stars.remove}
*
* @param {Object=} opts
* @param {?} opts.file - File to remove star from.
* @param {?} opts.file_comment - File comment to remove star from.
* @param {?} opts.channel - Channel to remove star from, or channel where the message to remove
* star from was posted (used with `timestamp`).
* @param {?} opts.timestamp - Timestamp of the message to remove star from.
* @param {function=} optCb Optional callback, if not using promises.
*/
StarsFacet.prototype.remove = function remove(opts, optCb) {
return this.makeAPICall('stars.remove', null, opts, optCb);
};
module.exports = StarsFacet;