-
Notifications
You must be signed in to change notification settings - Fork 662
/
Copy pathauth.js
42 lines (34 loc) · 1.12 KB
/
auth.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
/**
* API Facet to make calls to methods in the auth namespace.
*
* This provides functions to call:
* - revoke: {@link https://api.slack.com/methods/auth.revoke|auth.revoke}
* - test: {@link https://api.slack.com/methods/auth.test|auth.test}
*
*/
function AuthFacet(makeAPICall) {
this.name = 'auth';
this.makeAPICall = makeAPICall;
}
/**
* Revokes a token.
* @see {@link https://api.slack.com/methods/auth.revoke|auth.revoke}
*
* @param {Object=} opts
* @param {?} opts.test - Setting this parameter to `1` triggers a _testing mode_ where the
* specified token will not actually be revoked.
* @param {function=} optCb Optional callback, if not using promises.
*/
AuthFacet.prototype.revoke = function revoke(opts, optCb) {
return this.makeAPICall('auth.revoke', null, opts, optCb);
};
/**
* Checks authentication & identity.
* @see {@link https://api.slack.com/methods/auth.test|auth.test}
*
* @param {function=} optCb Optional callback, if not using promises.
*/
AuthFacet.prototype.test = function test(optCb) {
return this.makeAPICall('auth.test', null, null, optCb);
};
module.exports = AuthFacet;