comprodls-sdk 2.99.18 → 2.100.1-qa

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.
@@ -289,7 +289,6 @@ exports.AUTH_API_URLS = {
289
289
  validateSpaceCode: '/accounts/{accountid}/space-code/validate',
290
290
  validateClassCode: '/accounts/{accountid}/class-code/validate',
291
291
  joinInstituteSpace: '/accounts/{accountid}/join-institute-space',
292
- provisionStudentInInstitutionalSpace: '/accounts/{accountid}/student/join-institute-space',
293
292
  provisionSpacesToStudent: '/accounts/{accountId}/student/provision-spaces',
294
293
  provisionSpacesToTeacher: '/accounts/{accountId}/teacher/provision-spaces',
295
294
  shadowProvision: '/org/{orgId}/shadow-provision',
@@ -372,7 +371,6 @@ exports.AUTHEXTN_API_URLS = {
372
371
 
373
372
  //Space related API
374
373
  entitleBulkUsersToProducts: '/accounts/{accountid}/entitle-users/bulk',
375
- deleteUserAccount : '/accounts/{accountid}/ext-users/{ext_user_id}',
376
374
 
377
375
  // Assigned Path APIs
378
376
  userAssignedPaths: '/org/{orgid}/classes/{classid}/assigned-paths/{assignedpathid}/enroll-user/multi',
@@ -733,9 +731,7 @@ function setupAPIToken(request, token) {
733
731
  var ERROR_TYPES = {
734
732
  API_ERROR: 'API_ERROR',
735
733
  SDK_ERROR: 'SDK_ERROR',
736
- CHANNEL_SUBSCRIPTION: 'CHANNEL_SUBSCRIPTION',
737
- UNEXPECTED_ERROR: 'UNEXPECTED_ERROR',
738
- POLLING_INITIATION: 'POLLING_INITIATION'
734
+ CHANNEL_SUBSCRIPTION: 'CHANNEL_SUBSCRIPTION'
739
735
  };
740
736
 
741
737
  var ERROR_CATEGORY = {
@@ -11304,45 +11300,39 @@ function changeSpaceCode(options) {
11304
11300
  */
11305
11301
  function joinInstituteSpace(options) {
11306
11302
  var self = this;
11303
+ // Initializing promise
11304
+ var dfd = q.defer();
11307
11305
 
11308
- return new Promise(function(resolve, reject) {
11309
- if (options && options.ext_user_id && options.ext_role) {
11310
- // Passed all validations, Contruct API url
11311
-
11312
- var url;
11313
- if (options.ext_role === 'student') {
11314
- url = self.config.DEFAULT_HOSTS.AUTH +
11315
- self.config.AUTH_API_URLS.provisionStudentInInstitutionalSpace;
11316
- }
11317
- else {
11318
- url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.joinInstituteSpace;
11319
- }
11320
- url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
11306
+ if(options && options.ext_user_id &&
11307
+ options.ext_role && options.space_code)
11308
+ {
11309
+ // Passed all validations, Contruct API url
11310
+ var url = self.config.DEFAULT_HOSTS.AUTH +
11311
+ self.config.AUTH_API_URLS.joinInstituteSpace;
11312
+ url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
11321
11313
 
11322
- // Setup request with URL and Params
11323
- var requestAPI = request.post(url)
11314
+ // Setup request with URL and Params
11315
+ var requestAPI = request.post(url)
11324
11316
  .set('Content-Type', 'application/json')
11325
- .set('Accept', 'application/json');
11326
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
11317
+ .set('Accept', 'application/json')
11318
+ .send(options);
11319
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
11327
11320
 
11328
- requestAPI
11329
- .send(options)
11330
- .agent(keepaliveAgent)
11331
- .end(function(error, response) {
11332
- if (error) {
11333
- var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
11334
- reject(err);
11335
- }
11336
- else { resolve(response.body); }
11337
- });
11338
- } else {
11339
- var err = {};
11340
- err.message = err.description = 'ext_user_id or ext_role not found' +
11341
- ' in request options.';
11342
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
11343
- reject(err);
11344
- }
11345
- });
11321
+ requestAPI.end(function(error, response) {
11322
+ if(error) {
11323
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
11324
+ dfd.reject(err);
11325
+ }
11326
+ else { dfd.resolve(response.body); }
11327
+ });
11328
+ } else {
11329
+ var err = {};
11330
+ err.message = err.description = 'ext_user_id or ext_role or space_code not found in request options.';
11331
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
11332
+ dfd.reject(err);
11333
+ }
11334
+
11335
+ return dfd.promise;
11346
11336
  }
11347
11337
 
11348
11338
  /**
@@ -12076,8 +12066,7 @@ function spacesextn(accountId) {
12076
12066
  this.accountId = accountId;
12077
12067
  return {
12078
12068
  entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this),
12079
- setupUser: setupUser.bind(this),
12080
- deleteUserAccount : deleteUserAccount.bind(this)
12069
+ setupUser: setupUser.bind(this)
12081
12070
  };
12082
12071
  }
12083
12072
 
@@ -12164,50 +12153,6 @@ function setupUser(options) {
12164
12153
  }
12165
12154
  return deferred.promise;
12166
12155
  }
12167
-
12168
- /**
12169
- * Wiki Link for SDK params
12170
- * https://github.com/comprodls/comprodls-sdk-js/wiki/04_AUTH-Adapter#getuserprofileparams
12171
- */
12172
- function deleteUserAccount(options) {
12173
- var self = this;
12174
- return new Promise(function(resolve, reject) {
12175
-
12176
- if (options.ext_user_id && options.body) {
12177
- //Passed all validations, Contruct API url
12178
- var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
12179
- self.config.AUTHEXTN_API_URLS.deleteUserAccount;
12180
- url = helpers.api.constructAPIUrl(url, {
12181
- accountid: self.accountId,
12182
- ext_user_id: options.ext_user_id,
12183
- });
12184
-
12185
- // Setup request
12186
- var requestAPI = request.delete(url)
12187
- .set('Content-Type', 'application/json')
12188
- .set('Accept', 'application/json');
12189
- if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
12190
-
12191
- requestAPI
12192
- .send(options.body)
12193
- .agent(keepaliveAgent)
12194
- .end(function(error, response) {
12195
- if (error) {
12196
- var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
12197
- reject(err);
12198
- } else {
12199
- resolve(response.body);
12200
- }
12201
- });
12202
- } else {
12203
- var err = {};
12204
- err.description = 'Mandatory field \'ext_user_id\' or \'body\' in request options.';
12205
- err.message = err.description;
12206
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
12207
- reject(err);
12208
- }
12209
- });
12210
- }
12211
12156
 
12212
12157
  },{"../../helpers":3,"agentkeepalive":31,"q":36,"superagent":39}],25:[function(require,module,exports){
12213
12158
  /*************************************************************************