sprucebot-node
Advanced tools
Comparing version 6.16.0-beta.e779235 to 6.21.0-beta.e5fc2c1
@@ -6,11 +6,14 @@ # Change Log | ||
<a name="6.16.0-beta.e779235"></a> | ||
# [6.16.0-beta.e779235](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/compare/v6.15.0...v6.16.0-beta.e779235) (2018-07-11) | ||
<a name="6.21.0-beta.e5fc2c1"></a> | ||
# [6.21.0-beta.e5fc2c1](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/compare/v6.20.0...v6.21.0-beta.e5fc2c1) (2018-07-20) | ||
**Note:** Version bump only for package sprucebot-node | ||
### Features | ||
* Metadata support ([40ea1ef](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/commit/40ea1ef)) | ||
<a name="6.15.0"></a> | ||
@@ -17,0 +20,0 @@ # [6.15.0](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/compare/v6.14.0...v6.15.0) (2018-07-11) |
55
index.js
@@ -473,2 +473,57 @@ const Https = require('./https') | ||
/** | ||
* Get metadata | ||
* | ||
* @param {Object} query | ||
*/ | ||
async getMetadata(query) { | ||
const meta = await this.https.get('/metadata', query) | ||
return meta | ||
} | ||
/** | ||
* Set metadata | ||
* | ||
* @param {Object} metadata | ||
*/ | ||
async setMetadata({ locationId, organizationId, userId, refId, metadata }) { | ||
if (!metadata || metadata.length < 1) { | ||
throw new Error('INVALID_METADATA') | ||
} | ||
const data = [ | ||
{ | ||
locationId: locationId || null, | ||
organizationId: organizationId || null, | ||
userId: userId || null, | ||
refId: refId || null, | ||
metadata | ||
} | ||
] | ||
const meta = await this.https.patch('/metadata', data) | ||
return meta | ||
} | ||
/** | ||
* Delete metadata | ||
* | ||
* @param {Object} query | ||
*/ | ||
async deleteMetadata({ keys, locationId, organizationId, userId, refId }) { | ||
if (keys && keys.length > 0) { | ||
const data = keys.map(k => { | ||
return { | ||
key: k, | ||
locationId, | ||
organizationId, | ||
userId, | ||
refId | ||
} | ||
}) | ||
await this.https.delete('/metadata', data) | ||
} | ||
return | ||
} | ||
/** | ||
* To stop race conditions, you can have requests wait before starting the next. | ||
@@ -475,0 +530,0 @@ * |
{ | ||
"name": "sprucebot-node", | ||
"version": "6.16.0-beta.e779235", | ||
"version": "6.21.0-beta.e5fc2c1", | ||
"description": "Jam with the Sprucebot API in your favorite scripting language. 🤓", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "e779235887e5095032e6828cef631b21e58ca3f4" | ||
"gitHead": "e5fc2c12e229bfb75f1f709db7c7817145f923d0" | ||
} |
377904
8323