comprodls-sdk 2.31.3 → 2.31.4

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.
@@ -242,7 +242,7 @@ exports.ANALYTICS_API_URLS = {
242
242
  getMyAssignedPathsOfClass: '/{orgId}/user/class/assigned-paths',
243
243
  getAssignedPathAnalytics: '/{orgId}/class/assigned-paths/aggregations',
244
244
 
245
- getTimeseriesAnalytics: '/progress/timeseries'
245
+ timeseriesAnalytics: '/progress/timeseries'
246
246
  };
247
247
 
248
248
  exports.SISEVENTS_API_URLS = {
@@ -81,7 +81,8 @@ function analytics() {
81
81
  getAssignedPathAnalytics: getAssignedPathAnalytics.bind(this),
82
82
  getMyParticularAssignedPathOfClass: getMyParticularAssignedPathOfClass.bind(this),
83
83
 
84
- getTimeseriesAnalytics: getTimeseriesAnalytics.bind(this)
84
+ getTimeseriesAnalytics: getTimeseriesAnalytics.bind(this),
85
+ postProgressTimeseries: postProgressTimeseries.bind(this)
85
86
  };
86
87
  }
87
88
 
@@ -1578,7 +1579,7 @@ function getTimeseriesAnalytics(options) {
1578
1579
 
1579
1580
  if(options && options.query) {
1580
1581
  //Passed all validations, Construct API url
1581
- var url = self.config.DEFAULT_HOSTS.ANALYTICS + self.config.ANALYTICS_API_URLS.getTimeseriesAnalytics;
1582
+ var url = self.config.DEFAULT_HOSTS.ANALYTICS + self.config.ANALYTICS_API_URLS.timeseriesAnalytics;
1582
1583
 
1583
1584
  // Contruct parameters
1584
1585
  var params = {
@@ -1608,4 +1609,50 @@ function getTimeseriesAnalytics(options) {
1608
1609
  dfd.reject(err);
1609
1610
  }
1610
1611
  return dfd.promise;
1612
+ }
1613
+
1614
+ /*
1615
+ options = {
1616
+ cursor: 'string' //optional
1617
+ body: {
1618
+ query: 'string', //mandatory
1619
+ }
1620
+ }
1621
+ */
1622
+ function postProgressTimeseries(options) {
1623
+ var self = this;
1624
+ var dfd = q.defer();
1625
+ var err;
1626
+
1627
+ if(options && options.body && options.body.query) {
1628
+ //Passed all validations, Construct API url
1629
+ var url = self.config.DEFAULT_HOSTS.ANALYTICS + self.config.ANALYTICS_API_URLS.timeseriesAnalytics;
1630
+
1631
+ //Setup request with URL and Params
1632
+ var requestAPI = request.post(url).send(options.body);
1633
+
1634
+ if(options.cursor) {
1635
+ var params = { cursor: options.cursor }
1636
+ requestAPI.query(params);
1637
+ };
1638
+
1639
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
1640
+
1641
+ requestAPI
1642
+ .agent(keepaliveAgent)
1643
+ .end(function (error, response) {
1644
+ if(error) {
1645
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
1646
+ dfd.reject(err);
1647
+ }
1648
+ else { dfd.resolve(response.body); }
1649
+ });
1650
+ }
1651
+ else {
1652
+ err = {};
1653
+ err.message = err.description = 'Mandatory options.body.query not found in request options.';
1654
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
1655
+ dfd.reject(err);
1656
+ }
1657
+ return dfd.promise;
1611
1658
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "comprodls-sdk",
3
3
  "description": "comproDLS SDK for JavaScript",
4
- "version": "2.31.3",
4
+ "version": "2.31.4",
5
5
  "author": {
6
6
  "name": "Compro Technologies Private Limited",
7
7
  "url": "http://www.comprotechnologies.com/"