comprodls-sdk 2.93.0-thor → 2.95.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.
@@ -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 = {
@@ -11108,45 +11104,39 @@ function changeSpaceCode(options) {
11108
11104
  */
11109
11105
  function joinInstituteSpace(options) {
11110
11106
  var self = this;
11107
+ // Initializing promise
11108
+ var dfd = q.defer();
11111
11109
 
11112
- return new Promise(function(resolve, reject) {
11113
- if (options && options.ext_user_id && options.ext_role) {
11114
- // Passed all validations, Contruct API url
11115
-
11116
- var url;
11117
- if (options.ext_role === 'student') {
11118
- url = self.config.DEFAULT_HOSTS.AUTH +
11119
- self.config.AUTH_API_URLS.provisionStudentInInstitutionalSpace;
11120
- }
11121
- else {
11122
- url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.joinInstituteSpace;
11123
- }
11124
- url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
11110
+ if(options && options.ext_user_id &&
11111
+ options.ext_role && options.space_code)
11112
+ {
11113
+ // Passed all validations, Contruct API url
11114
+ var url = self.config.DEFAULT_HOSTS.AUTH +
11115
+ self.config.AUTH_API_URLS.joinInstituteSpace;
11116
+ url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
11125
11117
 
11126
- // Setup request with URL and Params
11127
- var requestAPI = request.post(url)
11118
+ // Setup request with URL and Params
11119
+ var requestAPI = request.post(url)
11128
11120
  .set('Content-Type', 'application/json')
11129
- .set('Accept', 'application/json');
11130
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
11121
+ .set('Accept', 'application/json')
11122
+ .send(options);
11123
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
11131
11124
 
11132
- requestAPI
11133
- .send(options)
11134
- .agent(keepaliveAgent)
11135
- .end(function(error, response) {
11136
- if (error) {
11137
- var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
11138
- reject(err);
11139
- }
11140
- else { resolve(response.body); }
11141
- });
11142
- } else {
11143
- var err = {};
11144
- err.message = err.description = 'ext_user_id or ext_role not found' +
11145
- ' in request options.';
11146
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
11147
- reject(err);
11148
- }
11149
- });
11125
+ requestAPI.end(function(error, response) {
11126
+ if(error) {
11127
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
11128
+ dfd.reject(err);
11129
+ }
11130
+ else { dfd.resolve(response.body); }
11131
+ });
11132
+ } else {
11133
+ var err = {};
11134
+ err.message = err.description = 'ext_user_id or ext_role or space_code not found in request options.';
11135
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
11136
+ dfd.reject(err);
11137
+ }
11138
+
11139
+ return dfd.promise;
11150
11140
  }
11151
11141
 
11152
11142
  /**
@@ -11880,8 +11870,7 @@ function spacesextn(accountId) {
11880
11870
  this.accountId = accountId;
11881
11871
  return {
11882
11872
  entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this),
11883
- setupUser: setupUser.bind(this),
11884
- deleteUserAccount : deleteUserAccount.bind(this)
11873
+ setupUser: setupUser.bind(this)
11885
11874
  };
11886
11875
  }
11887
11876
 
@@ -11968,50 +11957,6 @@ function setupUser(options) {
11968
11957
  }
11969
11958
  return deferred.promise;
11970
11959
  }
11971
-
11972
- /**
11973
- * Wiki Link for SDK params
11974
- * https://github.com/comprodls/comprodls-sdk-js/wiki/04_AUTH-Adapter#getuserprofileparams
11975
- */
11976
- function deleteUserAccount(options) {
11977
- var self = this;
11978
- return new Promise(function(resolve, reject) {
11979
-
11980
- if (options.ext_user_id && options.body) {
11981
- //Passed all validations, Contruct API url
11982
- var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
11983
- self.config.AUTHEXTN_API_URLS.deleteUserAccount;
11984
- url = helpers.api.constructAPIUrl(url, {
11985
- accountid: self.accountId,
11986
- ext_user_id: options.ext_user_id,
11987
- });
11988
-
11989
- // Setup request
11990
- var requestAPI = request.delete(url)
11991
- .set('Content-Type', 'application/json')
11992
- .set('Accept', 'application/json');
11993
- if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
11994
-
11995
- requestAPI
11996
- .send(options.body)
11997
- .agent(keepaliveAgent)
11998
- .end(function(error, response) {
11999
- if (error) {
12000
- var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
12001
- reject(err);
12002
- } else {
12003
- resolve(response.body);
12004
- }
12005
- });
12006
- } else {
12007
- var err = {};
12008
- err.description = 'Mandatory field \'ext_user_id\' or \'body\' in request options.';
12009
- err.message = err.description;
12010
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
12011
- reject(err);
12012
- }
12013
- });
12014
- }
12015
11960
 
12016
11961
  },{"../../helpers":3,"agentkeepalive":30,"q":35,"superagent":38}],24:[function(require,module,exports){
12017
11962
  /*************************************************************************