comprodls-sdk 2.69.0 → 2.70.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.
@@ -9740,42 +9740,33 @@ function getParticularOrgProductEntitlement(options) {
9740
9740
  //Initializing promise
9741
9741
  var deferred = q.defer();
9742
9742
 
9743
- //Validations
9744
- var error = helpers.validations.isAuthenticated(self.orgId, self.token);
9745
- if (error) {
9746
- deferred.reject(error);
9747
- } else {
9748
- if (options && options.productcode) {
9749
- // Passed all validations, Contruct the API URL
9750
- var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
9751
- self.config.AUTHEXTN_API_URLS.orgProductEntitlement;
9752
- url = helpers.api.constructAPIUrl(url, { orgid: self.orgId });
9753
-
9754
- // Setup request with URL and Query Params
9755
- var params = { productcode: options.productcode };
9756
- var requestAPI = request.get(url).query(params);
9743
+ if (options && options.productcode) {
9744
+ // Passed all validations, Contruct the API URL
9745
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
9746
+ self.config.AUTHEXTN_API_URLS.orgProductEntitlement;
9747
+ url = helpers.api.constructAPIUrl(url, { orgid: self.orgId });
9757
9748
 
9758
- // Setup 'traceid' in request header
9759
- if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
9749
+ // Setup request with URL and Query Params
9750
+ var params = { productcode: options.productcode };
9751
+ var requestAPI = request.get(url).query(params);
9760
9752
 
9761
- // Setup 'token' in Authorization header
9762
- requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
9753
+ // Setup 'traceid' in request header
9754
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
9763
9755
 
9764
- requestAPI.agent(keepaliveAgent).end(function (error, response) {
9765
- if (error) {
9766
- error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
9767
- deferred.reject(error);
9768
- } else {
9769
- deferred.resolve(response.body);
9770
- }
9771
- });
9772
- } else {
9773
- error = {};
9774
- error.message = error.description = 'Mandatory field \'productcode\' not found '+
9775
- 'in request options.';
9776
- error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
9777
- deferred.reject(error);
9778
- }
9756
+ requestAPI.agent(keepaliveAgent).end(function (error, response) {
9757
+ if (error) {
9758
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
9759
+ deferred.reject(error);
9760
+ } else {
9761
+ deferred.resolve(response.body);
9762
+ }
9763
+ });
9764
+ } else {
9765
+ var error = {};
9766
+ error.message = error.description = 'Mandatory field \'productcode\' not found '+
9767
+ 'in request options.';
9768
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
9769
+ deferred.reject(error);
9779
9770
  }
9780
9771
 
9781
9772
  return deferred.promise;
@@ -9793,40 +9784,31 @@ function getAllOrgProductEntitlements(options) {
9793
9784
  //Initializing promise
9794
9785
  var deferred = q.defer();
9795
9786
 
9796
- //Validations
9797
- var error = helpers.validations.isAuthenticated(self.orgId, self.token);
9798
- if (error) {
9799
- deferred.reject(error);
9800
- } else {
9801
- // Passed all validations, Contruct the API URL
9802
- var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
9803
- self.config.AUTHEXTN_API_URLS.orgProductEntitlement;
9804
- url = helpers.api.constructAPIUrl(url, { orgid: self.orgId });
9787
+ // Contruct the API URL
9788
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
9789
+ self.config.AUTHEXTN_API_URLS.orgProductEntitlement;
9790
+ url = helpers.api.constructAPIUrl(url, { orgid: self.orgId });
9805
9791
 
9806
- // Setup request with URL and Query Params
9807
- var params = { productcode: options.productcode };
9792
+ // Setup request with URL and Query Params
9793
+ var params = { productcode: options.productcode };
9808
9794
 
9809
- if (options.status) { params.status = options.status; }
9810
- if (options.hasOwnProperty('expired')) { params.expired = options.expired; }
9811
- if (options.cursor) { params.cursor = options.cursor; }
9795
+ if (options.status) { params.status = options.status; }
9796
+ if (options.hasOwnProperty('expired')) { params.expired = options.expired; }
9797
+ if (options.cursor) { params.cursor = options.cursor; }
9812
9798
 
9813
- var requestAPI = request.get(url).query(params);
9814
-
9815
- // Setup 'traceid' in request header
9816
- if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
9799
+ var requestAPI = request.get(url).query(params);
9817
9800
 
9818
- // Setup 'token' in Authorization header
9819
- requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
9801
+ // Setup 'traceid' in request header
9802
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
9820
9803
 
9821
- requestAPI.agent(keepaliveAgent).end(function (error, response) {
9822
- if (error) {
9823
- error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
9824
- deferred.reject(error);
9825
- } else {
9826
- deferred.resolve(response.body);
9827
- }
9828
- });
9829
- }
9804
+ requestAPI.agent(keepaliveAgent).end(function (error, response) {
9805
+ if (error) {
9806
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
9807
+ deferred.reject(error);
9808
+ } else {
9809
+ deferred.resolve(response.body);
9810
+ }
9811
+ });
9830
9812
 
9831
9813
  return deferred.promise;
9832
9814
  }
@@ -12028,9 +12010,10 @@ function getMicroEntitlementsForAUser(options) {
12028
12010
 
12029
12011
  }
12030
12012
 
12031
- // options= {
12032
- // stage: "", //stage number or version
12033
- // }
12013
+ /* options= {
12014
+ stage: "string", //optional, stage number or version
12015
+ target_role: "string" // optional
12016
+ } */
12034
12017
  function getAllBundles(options) {
12035
12018
  var self = this;
12036
12019
  var dfd = q.defer();
@@ -12041,7 +12024,14 @@ function getAllBundles(options) {
12041
12024
  url = helpers.api.constructAPIUrl(url, { accountId : self.accountId });
12042
12025
  //Contruct parameters
12043
12026
  var params = {};
12044
- if(options && options.stage) { params.stage = options.stage; }
12027
+ if(options) {
12028
+ if(options.stage){
12029
+ params.stage = options.stage;
12030
+ }
12031
+ if(options.target_role){
12032
+ params.target_role = options.target_role;
12033
+ }
12034
+ }
12045
12035
 
12046
12036
  //Setup request with URL and Post data
12047
12037
  var requestAPI = request.get(url).query(params);
@@ -12516,10 +12506,10 @@ function updateBundle(options) {
12516
12506
  return dfd.promise;
12517
12507
  }
12518
12508
 
12519
- // options= {
12520
- // stage: "", //stage number or version
12521
- // }
12522
-
12509
+ /* options= {
12510
+ stage: "string", //optional, stage number or version
12511
+ target_role: "string" // optional
12512
+ } */
12523
12513
  function getAllBundles(options) {
12524
12514
  var self = this;
12525
12515
  //Initializing promise
@@ -12531,7 +12521,14 @@ function getAllBundles(options) {
12531
12521
  url = helpers.api.constructAPIUrl(url, { orgid: self.orgId, });
12532
12522
  //Contruct parameters
12533
12523
  var params = {};
12534
- if(options && options.stage) { params.stage = options.stage; }
12524
+ if(options) {
12525
+ if(options.stage){
12526
+ params.stage = options.stage;
12527
+ }
12528
+ if(options.target_role){
12529
+ params.target_role = options.target_role;
12530
+ }
12531
+ }
12535
12532
 
12536
12533
  //Setup request with URL and Post data
12537
12534
  var requestAPI = request.get(url).query(params);