dispatch-node-sdk
Advanced tools
Comparing version 2.7.2 to 2.8.0
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -40,2 +42,39 @@ | ||
} | ||
/** | ||
* Add a premium product for a certain entity. Optionally specify some config for it. | ||
* | ||
* @param {String} entityType The entity's type. E.g. "organization" | ||
* @param {Number} entityID The entity's ID | ||
* @param {String} name The product name | ||
* @param {Object} [config] An object with public_config and private_config properties. | ||
* Both of these are objects that can contain any properties. | ||
* @return {Promise} | ||
*/ | ||
}, { | ||
key: 'addForEntity', | ||
value: function addForEntity(entityType, entityID, name) { | ||
var config = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; | ||
var body = _extends({ | ||
name: name | ||
}, config); | ||
return this.client.doAuthenticatedRequest('POST', '/products/' + entityType + '/' + entityID, body); | ||
} | ||
/** | ||
* Remove a premium product for a certain entity. | ||
* | ||
* @param {String} entityType The entity's type. E.g. "organization" | ||
* @param {Number} entityID The entity's ID | ||
* @param {String} name The product name | ||
* @return {Promise} | ||
*/ | ||
}, { | ||
key: 'removeForEntity', | ||
value: function removeForEntity(entityType, entityID, name) { | ||
return this.client.doAuthenticatedRequest('DELETE', '/products/' + entityType + '/' + entityID + '/' + name); | ||
} | ||
}]); | ||
@@ -42,0 +81,0 @@ |
@@ -23,2 +23,32 @@ import { stringify } from './queryString'; | ||
} | ||
/** | ||
* Add a premium product for a certain entity. Optionally specify some config for it. | ||
* | ||
* @param {String} entityType The entity's type. E.g. "organization" | ||
* @param {Number} entityID The entity's ID | ||
* @param {String} name The product name | ||
* @param {Object} [config] An object with public_config and private_config properties. | ||
* Both of these are objects that can contain any properties. | ||
* @return {Promise} | ||
*/ | ||
addForEntity(entityType, entityID, name, config = {}) { | ||
const body = { | ||
name, | ||
...config, | ||
}; | ||
return this.client.doAuthenticatedRequest('POST', `/products/${entityType}/${entityID}`, body); | ||
} | ||
/** | ||
* Remove a premium product for a certain entity. | ||
* | ||
* @param {String} entityType The entity's type. E.g. "organization" | ||
* @param {Number} entityID The entity's ID | ||
* @param {String} name The product name | ||
* @return {Promise} | ||
*/ | ||
removeForEntity(entityType, entityID, name) { | ||
return this.client.doAuthenticatedRequest('DELETE', `/products/${entityType}/${entityID}/${name}`); | ||
} | ||
} |
{ | ||
"name": "dispatch-node-sdk", | ||
"version": "2.7.2", | ||
"version": "2.8.0", | ||
"description": "High- and low-level libraries for interacting with the Dispatch API", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
270875
6799