DataSourcesAPI.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. "use strict";
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Business Analytics (C) Copyright IBM Corp. 2018, 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. /**
  9. * @class DataSourcesAPI
  10. * @hideconstructor
  11. *
  12. * @classdesc implementation of the DataSourcesAPI interface.
  13. */
  14. define([], function () {
  15. var DataSourcesAPI = function () {
  16. function DataSourcesAPI() {
  17. _classCallCheck(this, DataSourcesAPI);
  18. }
  19. /**
  20. * @function DataSourcesAPI#destroy
  21. * @description Used to destroy the DataSourcesAPI object
  22. */
  23. DataSourcesAPI.prototype.destroy = function destroy() {};
  24. /**
  25. * @function DataSourcesAPI#addDataSource
  26. * @description Add a source that can used as data sources in the dashboard
  27. * @public
  28. *
  29. * @param {DataSourceInfo} sourceInfo Describes the data source being added.
  30. * @param {Boolean} [allowDuplicateAssetIds=false] option to enable adding multiple data sources with the same asset Id.
  31. * @param {SetOptions} options
  32. * @return {string} The id of the source that was added
  33. */
  34. DataSourcesAPI.prototype.addDataSource = function addDataSource() {};
  35. /**
  36. * @function DataSourcesAPI#removeDataSource
  37. * @description Remove a source from the dashboard.
  38. * @public
  39. *
  40. * @param {String} sourceId The internal ID of the source to remove
  41. */
  42. DataSourcesAPI.prototype.removeDataSource = function removeDataSource() {};
  43. /**
  44. * @function DataSourcesAPI#getDataSource
  45. * @description Get a data source.
  46. * @public
  47. *
  48. * @param {String} sourceId unique data source identifier
  49. * @return {DataSourceAPI} Returns a {@link DataSourceAPI} object or null if the sourceId doesn't match any sources currently ready to use
  50. */
  51. DataSourcesAPI.prototype.getDataSource = function getDataSource() {};
  52. /**
  53. * @function DataSourcesAPI#getDataSourceList
  54. * @description Get all the data sources that are being used by the dashboard.
  55. * @public
  56. * @async
  57. *
  58. * @return {DataSourceAPI[]} Returns an array of {@link DataSourceAPI} objects.
  59. */
  60. DataSourcesAPI.prototype.getDataSourceList = function getDataSourceList() {};
  61. /**
  62. * @function DataSourcesAPI#setActiveDataSourceId
  63. * @description Flags a data source as 'active'. This is used for when we invoke the conversation panel so that smarts knows which data source takes priority
  64. * @param {String} sourceId unique data source identifier
  65. */
  66. DataSourcesAPI.prototype.setActiveDataSourceId = function setActiveDataSourceId() {};
  67. /**
  68. * @function DataSourcesAPI#getActiveDataSourceId
  69. * @description Get the id of the active data source
  70. * @return {String} The id of the active data source or null if no data source is currently marked as active
  71. */
  72. DataSourcesAPI.prototype.getActiveDataSourceId = function getActiveDataSourceId() {};
  73. /**
  74. * @function DataSourcesAPI#getSourcesInfo
  75. * @description Gets the data sources that are in use in the dashboard.<br>
  76. * Returns a promise that resolves to an array of datasource info:
  77. * [{ name: <localized name of datasource>,
  78. * assetId: <storeId of datasource>,
  79. * type: <datasource type e.g. uploadedFile>}],
  80. * active: <true if the datasource is used in selected widgets or selected in datasource panel>}],
  81. * @deprecated Use {@link DataSourcesAPI#getDataSourceList} to get the array of data sources and then APIs on those data sources to get the needed info
  82. */
  83. DataSourcesAPI.prototype.getSourcesInfo = function getSourcesInfo() {};
  84. /**
  85. * @function DataSourcesAPI#addSources
  86. * @description Add sources that can used as data sources in the dashboard.<br>
  87. * Once the source is successfully added, it will appear on the datasource list pane with the given name.
  88. * @param {String} sourceInfo.id Identifier for the source. Will be passed back for actions such as relink
  89. * @param {String} sourceInfo.name Name of the source
  90. * @param {String} sourceInfo.module The module definition
  91. * @example
  92. * DashboardApi.addDataSources([{
  93. * id: 'myUniqueId',
  94. * name: 'Sample datasource',
  95. * module: {...}
  96. * }, {
  97. * id: 'myUniqueId2',
  98. * name: 'Sample datasource 2',
  99. * module: {...}
  100. * }]);
  101. * @deprecated Use {@link DataSourcesAPI#addDataSource}
  102. */
  103. DataSourcesAPI.prototype.addDataSources = function addDataSources() {};
  104. return DataSourcesAPI;
  105. }();
  106. return DataSourcesAPI;
  107. });
  108. //# sourceMappingURL=DataSourcesAPI.js.map