Skip to content

Commit

Permalink
Updates the facets index.js file to reference new facets and adds in …
Browse files Browse the repository at this point in the history
…a reminders facet
  • Loading branch information
l12s committed May 2, 2016
1 parent bdba645 commit 5d85be5
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### v3.1.0 (2016-05-01)

* Updates the [`lib/clients/web/facets/index.js`](/lib/clients/web/facets/index.js) to reference the new facets added in the 3.0.0 update
* Adds in a [`reminders`](/lib/clients/web/facets/reminders.js) client facet

### v3.0.0 (2016-04-24)

* Adds a number of new web client API facets:
Expand Down
1 change: 1 addition & 0 deletions lib/clients/web/facets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
PinsFacet: require('./pins.js'),
PresenceFacet: require('./presence.js'),
ReactionsFacet: require('./reactions.js'),
RemindersFacet: require('./reminders.js'),
RtmFacet: require('./rtm.js'),
SearchFacet: require('./search.js'),
StarsFacet: require('./stars.js'),
Expand Down
102 changes: 102 additions & 0 deletions lib/clients/web/facets/reminders.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/**
* API Facet to make calls to methods in the reminders namespace.
*
* This provides functions to call:
* - add: {@link https://api.slack.com/methods/reminders.add|reminders.add}
* - complete: {@link https://api.slack.com/methods/reminders.complete|reminders.complete}
* - delete: {@link https://api.slack.com/methods/reminders.delete|reminders.delete}
* - info: {@link https://api.slack.com/methods/reminders.info|reminders.info}
* - list: {@link https://api.slack.com/methods/reminders.list|reminders.list}
*
*/


function RemindersFacet(makeAPICall) {
this.name = 'reminders';
this.makeAPICall = makeAPICall;
}


/**
* Creates a reminder.
* @see {@link https://api.slack.com/methods/reminders.add|reminders.add}
*
* @param {?} text - The content of the reminder
* @param {?} time - When this reminder should happen: the Unix timestamp (up to five years from
* now), the number of seconds until the reminder (if within 24 hours), or a natural language
* description (Ex. "in 15 minutes," or "every Thursday")
* @param {Object=} opts
* @param {?} opts.user - The user who will receive the reminder. If no user is specified, the
* reminder will go to user who created it.
* @param {function=} optCb Optional callback, if not using promises.
*/
RemindersFacet.prototype.add = function add(text, time, opts, optCb) {
var requiredArgs = {
text: text,
time: time
};

return this.makeAPICall('reminders.add', requiredArgs, opts, optCb);
};


/**
* Marks a reminder as complete.
* @see {@link https://api.slack.com/methods/reminders.complete|reminders.complete}
*
* @param {?} reminder - The ID of the reminder to be marked as complete
* @param {function=} optCb Optional callback, if not using promises.
*/
RemindersFacet.prototype.complete = function complete(reminder, optCb) {
var requiredArgs = {
reminder: reminder
};

return this.makeAPICall('reminders.complete', requiredArgs, null, optCb);
};


/**
* Deletes a reminder.
* @see {@link https://api.slack.com/methods/reminders.delete|reminders.delete}
*
* @param {?} reminder - The ID of the reminder
* @param {function=} optCb Optional callback, if not using promises.
*/
RemindersFacet.prototype.delete = function delete_(reminder, optCb) {
var requiredArgs = {
reminder: reminder
};

return this.makeAPICall('reminders.delete', requiredArgs, null, optCb);
};


/**
* Gets information about a reminder.
* @see {@link https://api.slack.com/methods/reminders.info|reminders.info}
*
* @param {?} reminder - The ID of the reminder
* @param {function=} optCb Optional callback, if not using promises.
*/
RemindersFacet.prototype.info = function info(reminder, optCb) {
var requiredArgs = {
reminder: reminder
};

return this.makeAPICall('reminders.info', requiredArgs, null, optCb);
};


/**
* Lists all reminders created by or for a given user.
* @see {@link https://api.slack.com/methods/reminders.list|reminders.list}
*
* @param {function=} optCb Optional callback, if not using promises.
*/
RemindersFacet.prototype.list = function list(optCb) {
return this.makeAPICall('reminders.list', null, null, optCb);
};


module.exports = RemindersFacet;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@slack/client",
"version": "3.0.0",
"version": "3.1.0",
"description": "A library for creating a Slack client",
"main": "./index",
"scripts": {
Expand Down

0 comments on commit 5d85be5

Please sign in to comment.