comprodls-sdk 2.25.0 → 2.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -154,6 +154,7 @@ exports.AUTH_API_URLS = {
154
154
  provisionBulkSpaces: '/org/{orgId}/provision-spaces/bulk',
155
155
  entitleUserToProduct: '/accounts/{accountId}/entitle-user',
156
156
  microEntitleUserToProduct: '/accounts/{accountId}/entitle-user/micro',
157
+ bulkMicroEntitleProductToUser: '/accounts/{accountId}/entitle-user/micro/bulk',
157
158
  enrollUserInClass: '/accounts/{accountId}/enroll-with-classcode',
158
159
  getExtProductAPI: '/accounts/{accountId}/products/{extProductId}',
159
160
  getSpaceDetails: '/accounts/{accountId}/spaces/{spacekey}',
@@ -53,6 +53,7 @@ function spaces(accountId) {
53
53
  unentitleUserToProduct: unentitleUserToProduct.bind(this),
54
54
  revokeMicroEntitlementOfAUser: revokeMicroEntitlementOfAUser.bind(this),
55
55
  microEntitleUserToProduct: microEntitleUserToProduct.bind(this),
56
+ bulkMicroEntitleProductToUser: bulkMicroEntitleProductToUser.bind(this),
56
57
  enrollUserInClass: enrollUserInClass.bind(this),
57
58
  getExtProduct: getExtProduct.bind(this),
58
59
  getSpaceDetails: getSpaceDetails.bind(this),
@@ -721,6 +722,68 @@ function microEntitleUserToProduct(options) {
721
722
  return dfd.promise;
722
723
  }
723
724
 
725
+ /* This function calls the ComproDLS API to micro entitle user to product.
726
+ options = {
727
+ "micro-entitlements": [{ // Mandatory, Min: 1
728
+ "ext_user_id": "string", // Mandatory
729
+
730
+ "productcode": "string",
731
+ "ext_product_id": "string",
732
+
733
+ "context": "string",
734
+ "feature_key": "string",
735
+ "feature_id": "string",,
736
+ "data": {},
737
+ "ext_entitlement_meta": {
738
+ "startdate": 0,
739
+ "enddate": 0
740
+ },
741
+
742
+ "ext_actor_id": "string", // Mandatory if 'audit' is true
743
+ "audit": true
744
+ },
745
+
746
+ ]
747
+ }
748
+ */
749
+ function bulkMicroEntitleProductToUser(options) {
750
+ var self = this;
751
+ // Initializing promise
752
+ var dfd = q.defer();
753
+
754
+ if(options && options['micro-entitlements'])
755
+ {
756
+ // Passed all validations, Contruct API url
757
+ var url = self.config.DEFAULT_HOSTS.AUTH +
758
+ self.config.AUTH_API_URLS.bulkMicroEntitleProductToUser;
759
+ url = helpers.api.constructAPIUrl(url, { accountId : self.accountId });
760
+
761
+ // Setup request with URL and Params
762
+ var requestAPI = request.post(url)
763
+ .set('Content-Type', 'application/json')
764
+ .set('Accept', 'application/json')
765
+ .send(options);
766
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
767
+
768
+ requestAPI.end(function(error, response) {
769
+ if(error) {
770
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
771
+ dfd.reject(err);
772
+ }
773
+ else { dfd.resolve(response.body); }
774
+ });
775
+ } else {
776
+ var err = {};
777
+ err.description = 'Missing mandatory keys in request options.' +
778
+ ' \'micro-entitlements\' must be present.'
779
+ err.message = err.description;
780
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
781
+ dfd.reject(err);
782
+ }
783
+
784
+ return dfd.promise;
785
+ }
786
+
724
787
  /* This function calls the ComproDLS API to revoke micro entitlement of a user.
725
788
  options = {
726
789
  "ext_user_id": "string", // Mandatory
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "comprodls-sdk",
3
3
  "description": "comproDLS SDK for JavaScript",
4
- "version": "2.25.0",
4
+ "version": "2.26.0",
5
5
  "author": {
6
6
  "name": "Compro Technologies Private Limited",
7
7
  "url": "http://www.comprotechnologies.com/"