comprodls-sdk 2.102.1-qa → 2.104.0-qa.1

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.
@@ -12185,6 +12185,7 @@ var q = require('q');
12185
12185
  var request = require('superagent');
12186
12186
 
12187
12187
  var helpers = require('../../helpers');
12188
+ var requestLayer = require('../../helpers/lib/requestLayer');
12188
12189
 
12189
12190
  var DLSError = helpers.errors.DLSError;
12190
12191
 
@@ -12206,34 +12207,33 @@ function superuser(accountId) {
12206
12207
  */
12207
12208
  function getAllInstitutions(options) {
12208
12209
  var self = this;
12209
- // Initializing promise
12210
- var dfd = q.defer();
12211
12210
 
12212
- var url = self.config.DEFAULT_HOSTS.AUTH +
12213
- self.config.AUTH_API_URLS.getAllInstitutions;
12214
- url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
12211
+ var url = helpers.api.constructAPIUrl(
12212
+ self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.getAllInstitutions,
12213
+ { accountid : self.accountId }
12214
+ );
12215
12215
 
12216
12216
  var params = {};
12217
- if(options) {
12218
- if(options.lookup) { params.lookup = options.lookup; }
12219
- if(options.cursor) { params.cursor = options.cursor; }
12220
- if(options.limit) { params.limit = options.limit; }
12217
+ if (options) {
12218
+ if (options.lookup) { params.lookup = options.lookup; }
12219
+ if (options.country) { params.country = options.country; }
12220
+ if (options.cursor) { params.cursor = options.cursor; }
12221
+ if (options.start) { params.start = options.start; }
12222
+ if (options.end) { params.end = options.end; }
12221
12223
  }
12222
12224
 
12223
- //Setup request with URL and Params
12224
- var requestAPI = request.get(url).query(params);
12225
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
12226
-
12227
- requestAPI.end(function(err, response) {
12228
- if(err) {
12229
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
12230
- dfd.reject(err);
12231
- } else {
12232
- dfd.resolve(response.body);
12233
- }
12225
+ // Prepare request parameters & execute request
12226
+ var reqOptions = {
12227
+ params: params,
12228
+ headers: { traceid: self.traceid }
12229
+ };
12230
+ return requestLayer.get(url, reqOptions)
12231
+ .then(function (response) {
12232
+ return response.body;
12233
+ })
12234
+ .catch(function (err) {
12235
+ throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
12234
12236
  });
12235
-
12236
- return dfd.promise;
12237
12237
  }
12238
12238
 
12239
12239
  /**
@@ -12317,7 +12317,7 @@ function provisionSpacesToSuperAdmin(options) {
12317
12317
  return dfd.promise;
12318
12318
  }
12319
12319
 
12320
- },{"../../helpers":3,"q":36,"superagent":39}],26:[function(require,module,exports){
12320
+ },{"../../helpers":3,"../../helpers/lib/requestLayer":7,"q":36,"superagent":39}],26:[function(require,module,exports){
12321
12321
  /*************************************************************************
12322
12322
  *
12323
12323
  * COMPRO CONFIDENTIAL