comprodls-sdk 2.111.0-thor.1 → 2.112.0-thor.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.
@@ -416,7 +416,11 @@ exports.ANALYTICS_API_URLS = {
416
416
  getClassCustomComponentUserSubmission: '/{orgId}/class/custom-component/class-record/evaluations',
417
417
 
418
418
  //CrossProductAggregation Related APIs
419
- getCrossProductAggregation: '/{orgId}/class/cross-product-aggregation'
419
+ getCrossProductAggregation: '/{orgId}/class/cross-product-aggregation',
420
+
421
+ // MAP Aggregation Related APIs
422
+ getStudentAggregation: '/{orgId}/student/aggregation',
423
+ getTeacherAggregation: '/{orgId}/teacher/aggregation'
420
424
  };
421
425
 
422
426
  exports.PRODUCT_API_URLS = {
@@ -470,7 +474,8 @@ exports.INTEGRATIONS_API_URLS = {
470
474
  auditTrail: '/accounts/{accountId}/audit-trail',
471
475
  customEvents: '/accounts/{accountId}/custom-events',
472
476
  schedules: '/accounts/{accountId}/context/{context}/schedule',
473
- particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}'
477
+ particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}',
478
+ lifecycleEvents: '/accounts/{accountId}/lifecycle-events'
474
479
  };
475
480
 
476
481
  exports.DRIVE_API_URLS = {
@@ -1327,6 +1332,7 @@ var q = require('q');
1327
1332
  var request = require('superagent');
1328
1333
  var Agent = require('agentkeepalive');
1329
1334
 
1335
+ var requestLayer = require('../../helpers/lib/requestLayer');
1330
1336
  var helpers = require('../../helpers');
1331
1337
  var DLSError = helpers.errors.DLSError;
1332
1338
 
@@ -1373,7 +1379,11 @@ function analytics() {
1373
1379
  getClassCustomComponentUserSubmission: getClassCustomComponentUserSubmission.bind(this),
1374
1380
 
1375
1381
  //CrossProductAggregation Related APIs
1376
- getCrossProductAggregation: getCrossProductAggregation.bind(this)
1382
+ getCrossProductAggregation: getCrossProductAggregation.bind(this),
1383
+
1384
+ //MAP Aggregation Related APIs
1385
+ getStudentAggregation: getStudentAggregation.bind(this),
1386
+ getTeacherAggregation: getTeacherAggregation.bind(this)
1377
1387
  };
1378
1388
  }
1379
1389
 
@@ -2663,8 +2673,85 @@ function getCrossProductAggregation(options) {
2663
2673
  }
2664
2674
  return dfd.promise;
2665
2675
  }
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
+ }
2666
2753
 
2667
- },{"../../helpers":3,"agentkeepalive":31,"q":36,"superagent":39}],11:[function(require,module,exports){
2754
+ },{"../../helpers":3,"../../helpers/lib/requestLayer":7,"agentkeepalive":31,"q":36,"superagent":39}],11:[function(require,module,exports){
2668
2755
  /*************************************************************************
2669
2756
  *
2670
2757
  * COMPRO CONFIDENTIAL
@@ -8378,6 +8465,7 @@ var q = require('q');
8378
8465
  var request = require('superagent');
8379
8466
  var Agent = require('agentkeepalive');
8380
8467
 
8468
+ var requestLayer = require('../../helpers/lib/requestLayer');
8381
8469
  var helpers = require('../../helpers');
8382
8470
  var converter = require('../../helpers/lib/api/converter');
8383
8471
 
@@ -8403,7 +8491,8 @@ function integrations(accountId) {
8403
8491
  createSchedule: createSchedule.bind(this),
8404
8492
  getSchedule: getSchedule.bind(this),
8405
8493
  updateSchedule: updateSchedule.bind(this),
8406
- deleteSchedule: deleteSchedule.bind(this)
8494
+ deleteSchedule: deleteSchedule.bind(this),
8495
+ publishLifecycleEvent: publishLifecycleEvent.bind(this)
8407
8496
  };
8408
8497
  }
8409
8498
 
@@ -8829,8 +8918,44 @@ function deleteSchedule(options) {
8829
8918
 
8830
8919
  return deferred.promise;
8831
8920
  }
8921
+
8922
+ /**
8923
+ * Wiki Link for SDK params
8924
+ * https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#publishlifecycleeventparams
8925
+ */
8926
+ function publishLifecycleEvent(options) {
8927
+ let self = this;
8928
+
8929
+ // Validate productcode
8930
+ if (!(options && options.category && options.action && options.timestamp &&
8931
+ options.data && options.ext_actor_id)) {
8932
+ let err = {};
8933
+ err.message = err.description = 'Mandatory params: category/action/timestamp' +
8934
+ '/data/ext_actor_id not found in request options.';
8935
+ return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
8936
+ }
8937
+
8938
+ // Construct API URL
8939
+ let url = helpers.api.constructAPIUrl(
8940
+ self.config.DEFAULT_HOSTS.INTEGRATION + self.config.INTEGRATIONS_API_URLS.lifecycleEvents,
8941
+ { accountId: self.accountId }
8942
+ );
8943
+
8944
+ // Prepare request parameters & execute request
8945
+ let reqOptions = {
8946
+ params: options,
8947
+ headers: { traceid: self.traceid }
8948
+ };
8949
+ return requestLayer.post(url, reqOptions)
8950
+ .then(function (response) {
8951
+ return response.body;
8952
+ })
8953
+ .catch(function (err) {
8954
+ throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
8955
+ });
8956
+ }
8832
8957
 
8833
- },{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":31,"q":36,"superagent":39}],17:[function(require,module,exports){
8958
+ },{"../../helpers":3,"../../helpers/lib/api/converter":4,"../../helpers/lib/requestLayer":7,"agentkeepalive":31,"q":36,"superagent":39}],17:[function(require,module,exports){
8834
8959
  /*************************************************************************
8835
8960
  *
8836
8961
  * COMPRO CONFIDENTIAL