QueryServiceAPI.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. 'use strict';
  2. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4. /**
  5. * Licensed Materials - Property of IBM
  6. * IBM Business Analytics (C) Copyright IBM Corp. 2018, 2019
  7. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. /**
  10. * @class QueryServiceAPI
  11. * @hideconstructor
  12. * @classdesc API class that is used to run queries.
  13. */
  14. define([], function () {
  15. var QueryServiceAPI = function () {
  16. function QueryServiceAPI() {
  17. _classCallCheck(this, QueryServiceAPI);
  18. }
  19. /**
  20. * @function QueryServiceAPI#executeQuery
  21. * @description Execute query with query spec.
  22. * @public
  23. * @async
  24. *
  25. * @param {String} sourceId The data source Id
  26. * @param {Object} querySpec The query specification.
  27. * @param {String} senderId (optional) The unique string identifier of the the query sender
  28. * @return {Promise<QueryResultAPI>} Returns a promise that will be resolved with a {@link QueryResultAPI} object
  29. */
  30. QueryServiceAPI.prototype.executeQuery = function executeQuery() {};
  31. /**
  32. * @function QueryServiceAPI#createQuery
  33. * @description Creates and returns a QueryAPI object to construct and run queries
  34. * @public
  35. *
  36. * @param {String} type The query type. E.g: 'minmax'
  37. * @return {QueryAPI} Returns a QueryAPI object
  38. */
  39. QueryServiceAPI.prototype.createQuery = function createQuery() {};
  40. /**
  41. * @function QueryServiceAPI#getDataItemValues
  42. * @description Get values of a column.
  43. * @public
  44. * @async
  45. *
  46. * @param {String} sourceId The data source Id
  47. * @param {String[]} [itemIdList=[]] An array of column ids
  48. * @param {Object} [filterList=[]] List of filter specs
  49. * @param {String} [sort] The sort option. 'asc', 'desc' or 'none'
  50. * @param {String} [searchTermList=[]] List of search terms
  51. * @param {String} [aggregationList] An array of aggregation types parallel to the itemIdList
  52. * @return {Promise<QueryResultAPI>} Returns a promise that will be resolved with a {@link QueryResultAPI} object
  53. */
  54. QueryServiceAPI.prototype.getColumnValues = function getColumnValues() {};
  55. /**
  56. * @function QueryServiceAPI#getColumnMinMaxValues
  57. * @description Get min max values of a column.
  58. * @public
  59. * @async
  60. *
  61. * @param {String} sourceId The data source Id
  62. * @param {String} itemId The column id
  63. * @param {Object} [filters] The filter spec
  64. * @return {Promise<QueryResultAPI>} Returns a promise that will be resolved with a {@link QueryResultAPI} object
  65. */
  66. QueryServiceAPI.prototype.getColumnMinMaxValues = function getColumnMinMaxValues() {};
  67. /**
  68. * @function QueryServiceAPI#getDataItemsMinMaxValues
  69. * @description Get min max values of given dataItems and projections.
  70. * @public
  71. * @async
  72. *
  73. * @param {String} sourceId The data source Id
  74. * @param {Object} dataItems The data items spec
  75. * @param {String[]} projections The array of projected data item unique IDs
  76. * @param {Object} [filters] The filter spec
  77. * @return {Promise<QueryResultAPI>} Returns a promise that will be resolved with a {@link QueryResultAPI} object
  78. * @example
  79. * getDataItemsMinMaxValues(
  80. * 'dataSourceId',
  81. * [{
  82. * 'id': 'Sheet1.Product_line',
  83. * 'itemId': 'Sheet1.Product_line',
  84. * 'itemLabel': 'Product line'
  85. * },{
  86. * 'id': 'Sheet1.Quantity',
  87. * 'itemId': 'Sheet1.Quantity',
  88. * 'itemLabel': 'Quantity',
  89. * 'aggregate': 'sum'
  90. * },{
  91. * 'id': 'Sheet1.Unit_cost',
  92. * 'itemId': 'Quantity',
  93. * 'itemLabel': 'Unit cost',
  94. * 'aggregate': 'sum'
  95. * }],
  96. * [
  97. * 'Sheet1.Quantity',
  98. * 'Sheet1.Unit_cost'
  99. * ]).then(queryResultData => {});
  100. * The minmax query result will have 2 sets of minmax values, one for Sheet1.Quantity, and one for Sheet1.Unit_cost
  101. */
  102. QueryServiceAPI.prototype.getDataItemsMinMaxValues = function getDataItemsMinMaxValues() {};
  103. /**
  104. * @function QueryServiceAPI#getRootMembers
  105. * @description Get root members of a hierarchy.
  106. * @public
  107. * @async
  108. *
  109. * @param {String} sourceId The data source Id
  110. * @param {String|String[]} itemIds The hierarchy id or a list of hierarchy ids
  111. * @param {Object} [filters=[]] A list of filter specs
  112. * @param {Number} [rowLimit = 51] The number of rows to return
  113. * @return {Promise<QueryResultAPI>} Returns a promise that will be resolved with a {@link QueryResultAPI} object
  114. */
  115. QueryServiceAPI.prototype.getRootMembers = function getRootMembers() {};
  116. /**
  117. * @function QueryServiceAPI#getChildren
  118. * @description Get children of a member.
  119. * @public
  120. * @async
  121. *
  122. * @param {String} sourceId The data source Id
  123. * @param {String|String[]} [itemIds=[]] The hierarchy id or a list of hierarchy ids
  124. * @param {String} memberId The member id to get children
  125. * @param {Object} [filters] The filter spec
  126. * @param {Number} [rowLimit = 51] The number of rows to return
  127. * @param {Number} [offset = 0] The index to start from when fetching rows
  128. * @return {Promise<QueryResultAPI>} Returns a promise that will be resolved with a {@link QueryResultAPI} object
  129. */
  130. QueryServiceAPI.prototype.getChildren = function getChildren() {};
  131. /**
  132. * @function QueryServiceAPI#getChildren
  133. * @description Get siblings of a member.
  134. * @public
  135. * @async
  136. *
  137. * @param {String} sourceId The data source Id
  138. * @param {String|String[]} [itemId=[]] The hierarchy id or a list of hierarchy ids
  139. * @param {String} memberId The member id to get siblings
  140. * @param {Object} [filters=[]] The filter spec
  141. * @param {Number} [rowLimit = 51] The number of rows to return
  142. * @return {Promise<QueryResultAPI>} Returns a promise that will be resolved with a {@link QueryResultAPI} object
  143. */
  144. QueryServiceAPI.prototype.getSiblings = function getSiblings() {};
  145. /**
  146. * @function QueryServiceAPI#getAscendants
  147. * @description Get ascendants of an array of members.
  148. * @public
  149. * @async
  150. *
  151. * @param {String} sourceId The data source Id
  152. * @param {String|String[]} [itemIds=[]] The hierarchy id or a list of hierarchy ids
  153. * @param {String[]} memberIds An array of member IDs to get ascendants
  154. * @param {Object} [filters=[]] The filter spec
  155. * @return {Promise<QueryResultAPI>} Returns a promise that will be resolved with a {@link QueryResultAPI} object
  156. */
  157. QueryServiceAPI.prototype.getAscendants = function getAscendants() {};
  158. _createClass(QueryServiceAPI, null, [{
  159. key: 'TYPE',
  160. /**
  161. * @public
  162. * @readonly
  163. * @description Enumeration of Query type
  164. * @enum {String}
  165. * @memberof QueryServiceAPI
  166. */
  167. get: function get() {
  168. return {
  169. /** default */
  170. DEFAULT: undefined,
  171. /** min / max query */
  172. MINMAX: 'minmax',
  173. /** unaggregated detail query */
  174. DETAIL: 'detail'
  175. };
  176. }
  177. }]);
  178. return QueryServiceAPI;
  179. }();
  180. return QueryServiceAPI;
  181. });
  182. //# sourceMappingURL=QueryServiceAPI.js.map