comprodls-sdk 2.102.0-thor → 2.102.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
  /**
@@ -12077,8 +12067,7 @@ function spacesextn(accountId) {
12077
12067
  this.accountId = accountId;
12078
12068
  return {
12079
12069
  entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this),
12080
- setupUser: setupUser.bind(this),
12081
- deleteUserAccount : deleteUserAccount.bind(this)
12070
+ setupUser: setupUser.bind(this)
12082
12071
  };
12083
12072
  }
12084
12073
 
@@ -12165,50 +12154,6 @@ function setupUser(options) {
12165
12154
  }
12166
12155
  return deferred.promise;
12167
12156
  }
12168
-
12169
- /**
12170
- * Wiki Link for SDK params
12171
- * https://github.com/comprodls/comprodls-sdk-js/wiki/04_AUTH-Adapter#getuserprofileparams
12172
- */
12173
- function deleteUserAccount(options) {
12174
- var self = this;
12175
- return new Promise(function(resolve, reject) {
12176
-
12177
- if (options.ext_user_id && options.body) {
12178
- //Passed all validations, Contruct API url
12179
- var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
12180
- self.config.AUTHEXTN_API_URLS.deleteUserAccount;
12181
- url = helpers.api.constructAPIUrl(url, {
12182
- accountid: self.accountId,
12183
- ext_user_id: options.ext_user_id,
12184
- });
12185
-
12186
- // Setup request
12187
- var requestAPI = request.delete(url)
12188
- .set('Content-Type', 'application/json')
12189
- .set('Accept', 'application/json');
12190
- if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
12191
-
12192
- requestAPI
12193
- .send(options.body)
12194
- .agent(keepaliveAgent)
12195
- .end(function(error, response) {
12196
- if (error) {
12197
- var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
12198
- reject(err);
12199
- } else {
12200
- resolve(response.body);
12201
- }
12202
- });
12203
- } else {
12204
- var err = {};
12205
- err.description = 'Mandatory field \'ext_user_id\' or \'body\' in request options.';
12206
- err.message = err.description;
12207
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
12208
- reject(err);
12209
- }
12210
- });
12211
- }
12212
12157
 
12213
12158
  },{"../../helpers":3,"agentkeepalive":31,"q":36,"superagent":39}],25:[function(require,module,exports){
12214
12159
  /*************************************************************************