Skip to content

Instantly share code, notes, and snippets.

@findchris
Created March 3, 2017 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save findchris/987a1ec39b09c1de3b587a0957a96d8b to your computer and use it in GitHub Desktop.
Save findchris/987a1ec39b09c1de3b587a0957a96d8b to your computer and use it in GitHub Desktop.
Handle POST /spaces/:id/events
diff --git a/node_modules/robin-js-sdk/lib/api/modules/spaces.js b/node_modules/robin-js-sdk/lib/api/modules/spaces.js
index c2cac7a..96d9886 100644
--- a/node_modules/robin-js-sdk/lib/api/modules/spaces.js
+++ b/node_modules/robin-js-sdk/lib/api/modules/spaces.js
@@ -54,6 +54,28 @@ module.exports = {
},
/**
+ * Space Events
+ * @type {Object}
+ */
+ events: {
+ /**
+ * Create an event for a space
+ * @param {String|Integer} spaceIdentifier A Robin space identifier
+ * @param {Object} data A data object
+ * @return {Function} A Promise
+ */
+ create: function(spaceIdentifier, data) {
+ var path;
+ if (spaceIdentifier && data) {
+ path = this.constructPath(constants.SPACES, spaceIdentifier, constants.EVENTS);
+ return this.Core.POST(path, data);
+ } else {
+ return this.rejectRequest('Bad Request: A space identifier and event data are required');
+ }
+ }
+ },
+
+ /**
* Space Devices
* @type {Object}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment