comprodls-sdk 2.113.0-thor.1 → 2.115.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.
- package/dist/comprodls-sdk.js +73 -278
- package/dist/comprodls-sdk.min.js +1 -1
- package/lib/config/index.js +2 -9
- package/lib/helpers/lib/errors.js +1 -3
- package/lib/services/analytics/index.js +1 -83
- package/lib/services/auth/index.js +33 -28
- package/lib/services/integrations/index.js +1 -39
- package/lib/services/spaces/index.js +29 -36
- package/lib/services/spacesextn/index.js +1 -46
- package/lib/services/xapi/index.js +1 -31
- package/package.json +1 -1
package/dist/comprodls-sdk.js
CHANGED
|
@@ -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',
|
|
@@ -416,11 +414,7 @@ exports.ANALYTICS_API_URLS = {
|
|
|
416
414
|
getClassCustomComponentUserSubmission: '/{orgId}/class/custom-component/class-record/evaluations',
|
|
417
415
|
|
|
418
416
|
//CrossProductAggregation Related APIs
|
|
419
|
-
getCrossProductAggregation: '/{orgId}/class/cross-product-aggregation'
|
|
420
|
-
|
|
421
|
-
// MAP Aggregation Related APIs
|
|
422
|
-
getStudentAggregation: '/{orgId}/student/aggregation',
|
|
423
|
-
getTeacherAggregation: '/{orgId}/teacher/aggregation'
|
|
417
|
+
getCrossProductAggregation: '/{orgId}/class/cross-product-aggregation'
|
|
424
418
|
};
|
|
425
419
|
|
|
426
420
|
exports.PRODUCT_API_URLS = {
|
|
@@ -474,8 +468,7 @@ exports.INTEGRATIONS_API_URLS = {
|
|
|
474
468
|
auditTrail: '/accounts/{accountId}/audit-trail',
|
|
475
469
|
customEvents: '/accounts/{accountId}/custom-events',
|
|
476
470
|
schedules: '/accounts/{accountId}/context/{context}/schedule',
|
|
477
|
-
particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}'
|
|
478
|
-
lifecycleEvents: '/accounts/{accountId}/lifecycle-events'
|
|
471
|
+
particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}'
|
|
479
472
|
};
|
|
480
473
|
|
|
481
474
|
exports.DRIVE_API_URLS = {
|
|
@@ -738,9 +731,7 @@ function setupAPIToken(request, token) {
|
|
|
738
731
|
var ERROR_TYPES = {
|
|
739
732
|
API_ERROR: 'API_ERROR',
|
|
740
733
|
SDK_ERROR: 'SDK_ERROR',
|
|
741
|
-
CHANNEL_SUBSCRIPTION: 'CHANNEL_SUBSCRIPTION'
|
|
742
|
-
UNEXPECTED_ERROR: 'UNEXPECTED_ERROR',
|
|
743
|
-
POLLING_INITIATION: 'POLLING_INITIATION'
|
|
734
|
+
CHANNEL_SUBSCRIPTION: 'CHANNEL_SUBSCRIPTION'
|
|
744
735
|
};
|
|
745
736
|
|
|
746
737
|
var ERROR_CATEGORY = {
|
|
@@ -1332,7 +1323,6 @@ var q = require('q');
|
|
|
1332
1323
|
var request = require('superagent');
|
|
1333
1324
|
var Agent = require('agentkeepalive');
|
|
1334
1325
|
|
|
1335
|
-
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
1336
1326
|
var helpers = require('../../helpers');
|
|
1337
1327
|
var DLSError = helpers.errors.DLSError;
|
|
1338
1328
|
|
|
@@ -1379,11 +1369,7 @@ function analytics() {
|
|
|
1379
1369
|
getClassCustomComponentUserSubmission: getClassCustomComponentUserSubmission.bind(this),
|
|
1380
1370
|
|
|
1381
1371
|
//CrossProductAggregation Related APIs
|
|
1382
|
-
getCrossProductAggregation: getCrossProductAggregation.bind(this)
|
|
1383
|
-
|
|
1384
|
-
//MAP Aggregation Related APIs
|
|
1385
|
-
getStudentAggregation: getStudentAggregation.bind(this),
|
|
1386
|
-
getTeacherAggregation: getTeacherAggregation.bind(this)
|
|
1372
|
+
getCrossProductAggregation: getCrossProductAggregation.bind(this)
|
|
1387
1373
|
};
|
|
1388
1374
|
}
|
|
1389
1375
|
|
|
@@ -2673,85 +2659,8 @@ function getCrossProductAggregation(options) {
|
|
|
2673
2659
|
}
|
|
2674
2660
|
return dfd.promise;
|
|
2675
2661
|
}
|
|
2676
|
-
|
|
2677
|
-
/**
|
|
2678
|
-
* Wiki Link for SDK params
|
|
2679
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/06_ANALYTICS-Adapter#getstudentaggregationparams
|
|
2680
|
-
*/
|
|
2681
|
-
function getStudentAggregation(options) {
|
|
2682
|
-
var self = this;
|
|
2683
|
-
|
|
2684
|
-
let err = {};
|
|
2685
|
-
|
|
2686
|
-
// Validations
|
|
2687
|
-
if(!(options && options.studentid && options.courseid)) {
|
|
2688
|
-
err.message = err.description = 'Mandatory params: studentid/courseid' +
|
|
2689
|
-
' not found in request options.';
|
|
2690
|
-
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
2691
|
-
} else {
|
|
2692
|
-
// Passed all validations, Constructing URL
|
|
2693
|
-
var url = self.config.DEFAULT_HOSTS.ANALYTICS +
|
|
2694
|
-
self.config.ANALYTICS_API_URLS.getStudentAggregation;
|
|
2695
|
-
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
|
|
2696
|
-
|
|
2697
|
-
// Setup Query Params
|
|
2698
|
-
var queryParams = { courseId: options.courseid, studentId: options.studentid };
|
|
2699
|
-
|
|
2700
|
-
// Prepare request parameters & execute request
|
|
2701
|
-
let reqOptions = {
|
|
2702
|
-
params: queryParams,
|
|
2703
|
-
headers: { traceid: self.traceid, token: self.token }
|
|
2704
|
-
};
|
|
2705
|
-
return requestLayer.get(url, reqOptions)
|
|
2706
|
-
.then(function (response) {
|
|
2707
|
-
return response.body;
|
|
2708
|
-
})
|
|
2709
|
-
.catch(function (err) {
|
|
2710
|
-
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
2711
|
-
});
|
|
2712
|
-
}
|
|
2713
|
-
|
|
2714
|
-
}
|
|
2715
|
-
|
|
2716
|
-
/**
|
|
2717
|
-
* Wiki Link for SDK params
|
|
2718
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/06_ANALYTICS-Adapter#getteacheraggregationparams
|
|
2719
|
-
*/
|
|
2720
|
-
function getTeacherAggregation(options) {
|
|
2721
|
-
var self = this;
|
|
2722
|
-
|
|
2723
|
-
let err = {};
|
|
2724
|
-
|
|
2725
|
-
// Validations
|
|
2726
|
-
if(!(options && options.teacherid)) {
|
|
2727
|
-
err.message = err.description = 'Mandatory params: teacherid not found in request options.';
|
|
2728
|
-
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
2729
|
-
} else {
|
|
2730
|
-
// Passed all validations, Constructing URL
|
|
2731
|
-
var url = self.config.DEFAULT_HOSTS.ANALYTICS +
|
|
2732
|
-
self.config.ANALYTICS_API_URLS.getTeacherAggregation;
|
|
2733
|
-
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
|
|
2734
|
-
|
|
2735
|
-
// Setup Query Params
|
|
2736
|
-
var queryParams = { teacherId: options.teacherid, studentId: options.studentid };
|
|
2737
|
-
|
|
2738
|
-
// Prepare request parameters & execute request
|
|
2739
|
-
let reqOptions = {
|
|
2740
|
-
params: queryParams,
|
|
2741
|
-
headers: { traceid: self.traceid, token: self.token }
|
|
2742
|
-
};
|
|
2743
|
-
return requestLayer.get(url, reqOptions)
|
|
2744
|
-
.then(function (response) {
|
|
2745
|
-
return response.body;
|
|
2746
|
-
})
|
|
2747
|
-
.catch(function (err) {
|
|
2748
|
-
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
2749
|
-
});
|
|
2750
|
-
}
|
|
2751
|
-
|
|
2752
|
-
}
|
|
2753
2662
|
|
|
2754
|
-
},{"../../helpers":3,"
|
|
2663
|
+
},{"../../helpers":3,"agentkeepalive":31,"q":36,"superagent":39}],11:[function(require,module,exports){
|
|
2755
2664
|
/*************************************************************************
|
|
2756
2665
|
*
|
|
2757
2666
|
* COMPRO CONFIDENTIAL
|
|
@@ -3174,7 +3083,6 @@ var Agent = require('agentkeepalive');
|
|
|
3174
3083
|
|
|
3175
3084
|
var helpers = require('../../helpers');
|
|
3176
3085
|
var converter = require('../../helpers/lib/api/converter');
|
|
3177
|
-
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
3178
3086
|
|
|
3179
3087
|
var DLSError = helpers.errors.DLSError;
|
|
3180
3088
|
|
|
@@ -3322,37 +3230,43 @@ function getUserProfile(options) {
|
|
|
3322
3230
|
*/
|
|
3323
3231
|
function deleteUserProfile(options) {
|
|
3324
3232
|
var self = this;
|
|
3233
|
+
var dfd = q.defer();
|
|
3325
3234
|
|
|
3326
|
-
//
|
|
3327
|
-
var
|
|
3328
|
-
if (
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
if (!(options && options.userid)) {
|
|
3333
|
-
var err = {};
|
|
3334
|
-
err.message = err.description = 'Mandatory parameter userid not found in request options.';
|
|
3335
|
-
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
3336
|
-
}
|
|
3235
|
+
// Validations
|
|
3236
|
+
var err = helpers.validations.isAuthenticated(self.orgId, self.token);
|
|
3237
|
+
if(err) { dfd.reject(err); }
|
|
3238
|
+
else {
|
|
3239
|
+
if (options.userid) {
|
|
3240
|
+
var userid = options.userid;
|
|
3337
3241
|
|
|
3242
|
+
// Passed all validations, Contruct API url
|
|
3243
|
+
var url = self.config.DEFAULT_HOSTS.AUTH +
|
|
3244
|
+
self.config.AUTH_API_URLS.userInfoAPI;
|
|
3245
|
+
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId, userId: userid });
|
|
3338
3246
|
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3247
|
+
// Setup request with URL
|
|
3248
|
+
var requestAPI = request.delete(url);
|
|
3249
|
+
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
3250
|
+
|
|
3251
|
+
// Setup token in Authorization header
|
|
3252
|
+
requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
|
|
3253
|
+
|
|
3254
|
+
// Call DELETE USER API
|
|
3255
|
+
requestAPI.end(function (error, response) {
|
|
3256
|
+
if (error) {
|
|
3257
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
3258
|
+
dfd.reject(error);
|
|
3259
|
+
}
|
|
3260
|
+
else { dfd.resolve(response.body); }
|
|
3261
|
+
});
|
|
3262
|
+
} else {
|
|
3263
|
+
err = {};
|
|
3264
|
+
err.message = err.description = 'Mandatory parameter userid not found in request options.';
|
|
3265
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
3266
|
+
dfd.reject(err);
|
|
3267
|
+
}
|
|
3347
3268
|
}
|
|
3348
|
-
|
|
3349
|
-
return requestLayer.delete(url, reqOptions)
|
|
3350
|
-
.then(function (response) {
|
|
3351
|
-
return response.body;
|
|
3352
|
-
})
|
|
3353
|
-
.catch(function (err) {
|
|
3354
|
-
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
3355
|
-
});
|
|
3269
|
+
return dfd.promise;
|
|
3356
3270
|
}
|
|
3357
3271
|
|
|
3358
3272
|
/**
|
|
@@ -6847,7 +6761,7 @@ function getAllCustomComponents(options) {
|
|
|
6847
6761
|
return deferred.promise;
|
|
6848
6762
|
}
|
|
6849
6763
|
|
|
6850
|
-
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"
|
|
6764
|
+
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":31,"q":36,"superagent":39}],13:[function(require,module,exports){
|
|
6851
6765
|
/*************************************************************************
|
|
6852
6766
|
*
|
|
6853
6767
|
* COMPRO CONFIDENTIAL
|
|
@@ -8460,7 +8374,6 @@ var q = require('q');
|
|
|
8460
8374
|
var request = require('superagent');
|
|
8461
8375
|
var Agent = require('agentkeepalive');
|
|
8462
8376
|
|
|
8463
|
-
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
8464
8377
|
var helpers = require('../../helpers');
|
|
8465
8378
|
var converter = require('../../helpers/lib/api/converter');
|
|
8466
8379
|
|
|
@@ -8486,8 +8399,7 @@ function integrations(accountId) {
|
|
|
8486
8399
|
createSchedule: createSchedule.bind(this),
|
|
8487
8400
|
getSchedule: getSchedule.bind(this),
|
|
8488
8401
|
updateSchedule: updateSchedule.bind(this),
|
|
8489
|
-
deleteSchedule: deleteSchedule.bind(this)
|
|
8490
|
-
publishLifecycleEvent: publishLifecycleEvent.bind(this)
|
|
8402
|
+
deleteSchedule: deleteSchedule.bind(this)
|
|
8491
8403
|
};
|
|
8492
8404
|
}
|
|
8493
8405
|
|
|
@@ -8913,44 +8825,8 @@ function deleteSchedule(options) {
|
|
|
8913
8825
|
|
|
8914
8826
|
return deferred.promise;
|
|
8915
8827
|
}
|
|
8916
|
-
|
|
8917
|
-
/**
|
|
8918
|
-
* Wiki Link for SDK params
|
|
8919
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#publishlifecycleeventparams
|
|
8920
|
-
*/
|
|
8921
|
-
function publishLifecycleEvent(options) {
|
|
8922
|
-
let self = this;
|
|
8923
|
-
|
|
8924
|
-
// Validate productcode
|
|
8925
|
-
if (!(options && options.category && options.action && options.timestamp &&
|
|
8926
|
-
options.data && options.ext_actor_id)) {
|
|
8927
|
-
let err = {};
|
|
8928
|
-
err.message = err.description = 'Mandatory params: category/action/timestamp' +
|
|
8929
|
-
'/data/ext_actor_id not found in request options.';
|
|
8930
|
-
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
8931
|
-
}
|
|
8932
|
-
|
|
8933
|
-
// Construct API URL
|
|
8934
|
-
let url = helpers.api.constructAPIUrl(
|
|
8935
|
-
self.config.DEFAULT_HOSTS.INTEGRATION + self.config.INTEGRATIONS_API_URLS.lifecycleEvents,
|
|
8936
|
-
{ accountId: self.accountId }
|
|
8937
|
-
);
|
|
8938
|
-
|
|
8939
|
-
// Prepare request parameters & execute request
|
|
8940
|
-
let reqOptions = {
|
|
8941
|
-
params: options,
|
|
8942
|
-
headers: { traceid: self.traceid }
|
|
8943
|
-
};
|
|
8944
|
-
return requestLayer.post(url, reqOptions)
|
|
8945
|
-
.then(function (response) {
|
|
8946
|
-
return response.body;
|
|
8947
|
-
})
|
|
8948
|
-
.catch(function (err) {
|
|
8949
|
-
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
8950
|
-
});
|
|
8951
|
-
}
|
|
8952
8828
|
|
|
8953
|
-
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"
|
|
8829
|
+
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":31,"q":36,"superagent":39}],17:[function(require,module,exports){
|
|
8954
8830
|
/*************************************************************************
|
|
8955
8831
|
*
|
|
8956
8832
|
* COMPRO CONFIDENTIAL
|
|
@@ -11502,45 +11378,39 @@ function changeSpaceCode(options) {
|
|
|
11502
11378
|
*/
|
|
11503
11379
|
function joinInstituteSpace(options) {
|
|
11504
11380
|
var self = this;
|
|
11381
|
+
// Initializing promise
|
|
11382
|
+
var dfd = q.defer();
|
|
11505
11383
|
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
self.config.AUTH_API_URLS.provisionStudentInInstitutionalSpace;
|
|
11514
|
-
}
|
|
11515
|
-
else {
|
|
11516
|
-
url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.joinInstituteSpace;
|
|
11517
|
-
}
|
|
11518
|
-
url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
|
|
11384
|
+
if(options && options.ext_user_id &&
|
|
11385
|
+
options.ext_role && options.space_code)
|
|
11386
|
+
{
|
|
11387
|
+
// Passed all validations, Contruct API url
|
|
11388
|
+
var url = self.config.DEFAULT_HOSTS.AUTH +
|
|
11389
|
+
self.config.AUTH_API_URLS.joinInstituteSpace;
|
|
11390
|
+
url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
|
|
11519
11391
|
|
|
11520
|
-
|
|
11521
|
-
|
|
11392
|
+
// Setup request with URL and Params
|
|
11393
|
+
var requestAPI = request.post(url)
|
|
11522
11394
|
.set('Content-Type', 'application/json')
|
|
11523
|
-
.set('Accept', 'application/json')
|
|
11524
|
-
|
|
11395
|
+
.set('Accept', 'application/json')
|
|
11396
|
+
.send(options);
|
|
11397
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
11525
11398
|
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
reject(err);
|
|
11542
|
-
}
|
|
11543
|
-
});
|
|
11399
|
+
requestAPI.end(function(error, response) {
|
|
11400
|
+
if(error) {
|
|
11401
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
11402
|
+
dfd.reject(err);
|
|
11403
|
+
}
|
|
11404
|
+
else { dfd.resolve(response.body); }
|
|
11405
|
+
});
|
|
11406
|
+
} else {
|
|
11407
|
+
var err = {};
|
|
11408
|
+
err.message = err.description = 'ext_user_id or ext_role or space_code not found in request options.';
|
|
11409
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
11410
|
+
dfd.reject(err);
|
|
11411
|
+
}
|
|
11412
|
+
|
|
11413
|
+
return dfd.promise;
|
|
11544
11414
|
}
|
|
11545
11415
|
|
|
11546
11416
|
/**
|
|
@@ -12080,7 +11950,6 @@ function updateUserInformation(options) {
|
|
|
12080
11950
|
};
|
|
12081
11951
|
if(options.ref_id) { bodyParams.ref_id = options.ref_id; }
|
|
12082
11952
|
if(options.ext_email) { bodyParams.ext_email = options.ext_email; }
|
|
12083
|
-
if(options.ext_username) { bodyParams.ext_username = options.ext_username; }
|
|
12084
11953
|
if(options.ext_first_name) { bodyParams.ext_first_name = options.ext_first_name; }
|
|
12085
11954
|
if(options.ext_last_name) { bodyParams.ext_last_name = options.ext_last_name; }
|
|
12086
11955
|
if(options.address) { bodyParams.address = options.address; }
|
|
@@ -12275,8 +12144,7 @@ function spacesextn(accountId) {
|
|
|
12275
12144
|
this.accountId = accountId;
|
|
12276
12145
|
return {
|
|
12277
12146
|
entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this),
|
|
12278
|
-
setupUser: setupUser.bind(this)
|
|
12279
|
-
deleteUserAccount : deleteUserAccount.bind(this)
|
|
12147
|
+
setupUser: setupUser.bind(this)
|
|
12280
12148
|
};
|
|
12281
12149
|
}
|
|
12282
12150
|
|
|
@@ -12363,50 +12231,6 @@ function setupUser(options) {
|
|
|
12363
12231
|
}
|
|
12364
12232
|
return deferred.promise;
|
|
12365
12233
|
}
|
|
12366
|
-
|
|
12367
|
-
/**
|
|
12368
|
-
* Wiki Link for SDK params
|
|
12369
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/04_AUTH-Adapter#getuserprofileparams
|
|
12370
|
-
*/
|
|
12371
|
-
function deleteUserAccount(options) {
|
|
12372
|
-
var self = this;
|
|
12373
|
-
return new Promise(function(resolve, reject) {
|
|
12374
|
-
|
|
12375
|
-
if (options.ext_user_id && options.body) {
|
|
12376
|
-
//Passed all validations, Contruct API url
|
|
12377
|
-
var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
|
|
12378
|
-
self.config.AUTHEXTN_API_URLS.deleteUserAccount;
|
|
12379
|
-
url = helpers.api.constructAPIUrl(url, {
|
|
12380
|
-
accountid: self.accountId,
|
|
12381
|
-
ext_user_id: options.ext_user_id,
|
|
12382
|
-
});
|
|
12383
|
-
|
|
12384
|
-
// Setup request
|
|
12385
|
-
var requestAPI = request.delete(url)
|
|
12386
|
-
.set('Content-Type', 'application/json')
|
|
12387
|
-
.set('Accept', 'application/json');
|
|
12388
|
-
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
12389
|
-
|
|
12390
|
-
requestAPI
|
|
12391
|
-
.send(options.body)
|
|
12392
|
-
.agent(keepaliveAgent)
|
|
12393
|
-
.end(function(error, response) {
|
|
12394
|
-
if (error) {
|
|
12395
|
-
var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
12396
|
-
reject(err);
|
|
12397
|
-
} else {
|
|
12398
|
-
resolve(response.body);
|
|
12399
|
-
}
|
|
12400
|
-
});
|
|
12401
|
-
} else {
|
|
12402
|
-
var err = {};
|
|
12403
|
-
err.description = 'Mandatory field \'ext_user_id\' or \'body\' in request options.';
|
|
12404
|
-
err.message = err.description;
|
|
12405
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
12406
|
-
reject(err);
|
|
12407
|
-
}
|
|
12408
|
-
});
|
|
12409
|
-
}
|
|
12410
12234
|
|
|
12411
12235
|
},{"../../helpers":3,"agentkeepalive":31,"q":36,"superagent":39}],25:[function(require,module,exports){
|
|
12412
12236
|
/*************************************************************************
|
|
@@ -13426,8 +13250,7 @@ function xapi(accountId) {
|
|
|
13426
13250
|
this.accountId = accountId;
|
|
13427
13251
|
return {
|
|
13428
13252
|
postStatement: postStatements.bind(this),
|
|
13429
|
-
postExternalStatements: postExternalStatements.bind(this)
|
|
13430
|
-
postSchoolStatement: postSchoolStatements.bind(this)
|
|
13253
|
+
postExternalStatements: postExternalStatements.bind(this)
|
|
13431
13254
|
};
|
|
13432
13255
|
}
|
|
13433
13256
|
|
|
@@ -13501,35 +13324,7 @@ function postExternalStatements(options) {
|
|
|
13501
13324
|
});
|
|
13502
13325
|
return dfd.promise;
|
|
13503
13326
|
}
|
|
13504
|
-
|
|
13505
|
-
/**
|
|
13506
|
-
* Wiki Link for SDK params
|
|
13507
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/08_XAPI-Adapter#postschoolstatementsparams
|
|
13508
|
-
*/
|
|
13509
|
-
function postSchoolStatements(options) {
|
|
13510
|
-
var self = this;
|
|
13511
|
-
var dfd = q.defer();
|
|
13512
|
-
|
|
13513
|
-
var url = self.config.DEFAULT_HOSTS.XAPI + self.config.XAPI_API_URLS.postSchoolStatements;
|
|
13514
|
-
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
|
|
13515
|
-
//Passed all validations, Construct API url
|
|
13516
|
-
|
|
13517
|
-
//Setup request with URL and Params
|
|
13518
|
-
var requestAPI = request.post(url).send(options);
|
|
13519
|
-
|
|
13520
|
-
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
13521
|
-
|
|
13522
|
-
//Call Product Timespent Api
|
|
13523
|
-
|
|
13524
|
-
requestAPI.end(function(err, response) {
|
|
13525
|
-
if(err) {
|
|
13526
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
13527
|
-
dfd.reject(err);
|
|
13528
|
-
}
|
|
13529
|
-
else { dfd.resolve(response.body); }
|
|
13530
|
-
});
|
|
13531
|
-
return dfd.promise;
|
|
13532
|
-
}
|
|
13327
|
+
|
|
13533
13328
|
},{"../../helpers":3,"q":36,"superagent":39}],29:[function(require,module,exports){
|
|
13534
13329
|
/*************************************************************************
|
|
13535
13330
|
*
|