From d9cb65f0e4b421865d33874c4a92d6c14b3e9228 Mon Sep 17 00:00:00 2001 From: l12s Date: Tue, 14 Jun 2016 17:29:27 -0700 Subject: [PATCH 1/2] Updates the API facets to latest and revs version to `3.5.0` * Adds the [team.billableInfo](https://api.slack.com/methods/team.billableInfo) endpoint to the team facet * Adds the [bots.info](https://api.slack.com/methods/bots.info) endpoint and creates the `bots` facet * Removes the `user` optional argument from the [stars.list](https://api.slack.com/methods/stars.list) method --- CHANGELOG.md | 6 ++++++ lib/clients/web/facets/bots.js | 29 +++++++++++++++++++++++++++++ lib/clients/web/facets/index.js | 1 + lib/clients/web/facets/stars.js | 1 - lib/clients/web/facets/team.js | 14 ++++++++++++++ package.json | 2 +- 6 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 lib/clients/web/facets/bots.js diff --git a/CHANGELOG.md b/CHANGELOG.md index a2974c22b..2190c4175 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### v3.5.0 (2016-06-14) + + * Adds the [team.billableInfo](https://api.slack.com/methods/team.billableInfo) endpoint to the team facet + * Adds the [bots.info](https://api.slack.com/methods/bots.info) endpoint and creates the `bots` facet + * Removes the `user` optional argument from the [stars.list](https://api.slack.com/methods/stars.list) method + ### v3.4.0 (2016-05-31) * Adds the [chat.meMessage](https://api.slack.com/methods/chat.meMessage) endpoint to the chat facet diff --git a/lib/clients/web/facets/bots.js b/lib/clients/web/facets/bots.js new file mode 100644 index 000000000..43279fcb1 --- /dev/null +++ b/lib/clients/web/facets/bots.js @@ -0,0 +1,29 @@ +/** + * API Facet to make calls to methods in the bots namespace. + * + * This provides functions to call: + * - info: {@link https://api.slack.com/methods/bots.info|bots.info} + * + */ + + +function BotsFacet(makeAPICall) { + this.name = 'bots'; + this.makeAPICall = makeAPICall; +} + + +/** + * Gets information about a bot user. + * @see {@link https://api.slack.com/methods/bots.info|bots.info} + * + * @param {Object=} opts + * @param {?} opts.bot - Bot user to get info on + * @param {function=} optCb Optional callback, if not using promises. + */ +BotsFacet.prototype.info = function info(opts, optCb) { + return this.makeAPICall('bots.info', null, opts, optCb); +}; + + +module.exports = BotsFacet; diff --git a/lib/clients/web/facets/index.js b/lib/clients/web/facets/index.js index d155e3b48..da4c34dc7 100644 --- a/lib/clients/web/facets/index.js +++ b/lib/clients/web/facets/index.js @@ -1,6 +1,7 @@ module.exports = { ApiFacet: require('./api.js'), AuthFacet: require('./auth.js'), + BotsFacet: require('./bots'), ChannelsFacet: require('./channels.js'), ChatFacet: require('./chat.js'), DndFacet: require('./dnd.js'), diff --git a/lib/clients/web/facets/stars.js b/lib/clients/web/facets/stars.js index b787f2b49..08a05e1c4 100644 --- a/lib/clients/web/facets/stars.js +++ b/lib/clients/web/facets/stars.js @@ -37,7 +37,6 @@ StarsFacet.prototype.add = function add(opts, optCb) { * @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. diff --git a/lib/clients/web/facets/team.js b/lib/clients/web/facets/team.js index d32b30e30..3298b7e0d 100644 --- a/lib/clients/web/facets/team.js +++ b/lib/clients/web/facets/team.js @@ -3,6 +3,7 @@ * * This provides functions to call: * - accessLogs: {@link https://api.slack.com/methods/team.accessLogs|team.accessLogs} + * - billableInfo: {@link https://api.slack.com/methods/team.billableInfo|team.billableInfo} * - info: {@link https://api.slack.com/methods/team.info|team.info} * - integrationLogs: {@link https://api.slack.com/methods/team.integrationLogs|team.integrationLogs} * @@ -29,6 +30,19 @@ TeamFacet.prototype.accessLogs = function accessLogs(opts, optCb) { }; +/** + * Gets billable users information for the current team. + * @see {@link https://api.slack.com/methods/team.billableInfo|team.billableInfo} + * + * @param {Object=} opts + * @param {?} opts.user - A user to retrieve the billable information for. Defaults to all users. + * @param {function=} optCb Optional callback, if not using promises. + */ +TeamFacet.prototype.billableInfo = function billableInfo(opts, optCb) { + return this.makeAPICall('team.billableInfo', null, opts, optCb); +}; + + /** * Gets information about the current team. * @see {@link https://api.slack.com/methods/team.info|team.info} diff --git a/package.json b/package.json index 836ef7d2c..4d7c378d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@slack/client", - "version": "3.4.0", + "version": "3.5.0", "description": "A library for creating a Slack client", "main": "./index", "scripts": { From e163fb155eb0c0803317ac9fd20da4059c598409 Mon Sep 17 00:00:00 2001 From: l12s Date: Tue, 14 Jun 2016 17:50:12 -0700 Subject: [PATCH 2/2] Exclude the auto-generated facet code when computing test coverage --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4d7c378d2..3472a582e 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "lint": "eslint . --ignore-path .gitignore", "mocha": "mocha --recursive --reporter spec test", "test": "npm run mocha && npm run lint", - "cover": "istanbul cover --report lcovonly _mocha -- --recursive", + "cover": "istanbul cover -x **/facets/*.js --report lcovonly _mocha -- --recursive", "coveralls": "npm run cover && istanbul-coveralls", "make-slack-client-symlink": "mkdir -p $PWD/node_modules/@slack/client && ln -s $PWD/index.js $PWD/node_modules/@slack/client/index.js" },