@@ -26,29 +26,49 @@ export interface UnderlyingDataPoint {
26
26
}
27
27
28
28
/**
29
- * Class representing the answer service provided with the
30
- * custom action payload. This service could be used to run
31
- * graphql queries in the context of the answer on which the
32
- * custom action was triggered.
29
+ * AnswerService provides a simple way to work with ThoughtSpot Answers.
30
+ *
31
+ * This service allows you to interact with ThoughtSpot Answers programmatically,
32
+ * making it easy to customize visualizations, filter data, and extract insights
33
+ * directly from your application.
34
+ *
35
+ * You can use this service to:
36
+ * - Add or remove columns from Answers (`addColumns`, `removeColumns`, `addColumnsByName`)
37
+ * - Apply filters to Answers (`addFilter`)
38
+ * - Get data from Answers in different formats (JSON, CSV, PNG) (`fetchData`, `fetchCSVBlob`, `fetchPNGBlob`)
39
+ * - Get data for specific points in visualizations (`getUnderlyingDataForPoint`)
40
+ * - Run custom queries (`executeQuery`)
41
+ * - Add visualizations to liveboards (`addDisplayedVizToLiveboard`)
42
+ *
33
43
* @example
34
44
* ```js
35
- * embed.on(EmbedEvent.CustomAction, e => {
36
- * const underlying = await e.answerService.getUnderlyingDataForPoint([
37
- * 'col name 1'
38
- * ]);
39
- * const data = await underlying.fetchData(0, 100);
40
- * })
45
+ * // Get the answer service
46
+ * embed.on(EmbedEvent.Data, async (e) => {
47
+ * const service = await embed.getAnswerService();
48
+ *
49
+ * // Add columns to the answer
50
+ * await service.addColumnsByName(["Sales", "Region"]);
51
+ *
52
+ * // Get the data
53
+ * const data = await service.fetchData();
54
+ * console.log(data);
55
+ * });
41
56
* ```
57
+ *
42
58
* @example
43
59
* ```js
44
- * embed.on(EmbedEvent.Data, async (e) => {
45
- * const service = await embed.getAnswerService();
46
- * await service.addColumns([
47
- * "<column guid>"
60
+ * // Get data for a point in a visualization
61
+ * embed.on(EmbedEvent.CustomAction, async (e) => {
62
+ * const underlying = await e.answerService.getUnderlyingDataForPoint([
63
+ * 'Product Name',
64
+ * 'Sales Amount'
48
65
* ]);
49
- * console.log(await service.fetchData());
66
+ *
67
+ * const data = await underlying.fetchData(0, 100);
68
+ * console.log(data);
50
69
* });
51
70
* ```
71
+ *
52
72
* @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
53
73
* @group Events
54
74
*/
0 commit comments