View - script API
Fetch a list of views.
This page describes StackState version 4.3.

Function getAll

Returns a list of all views.
Args:
None
Return type:
AsyncScriptResult[List[QueryViewResponse]]
Fields:
  • QueryViewResponse.view - the QueryView object
  • QueryViewResponse.viewInfo - (optional) ViewInfo structure holding extra information that can be requested using builder methods
The QueryView type has the following fields:
  • QueryView.name - the name of the view
  • QueryView.description - the description of the view
  • QueryView.state - View state object, holding view state
  • QueryView.query - STQL query which can be used subsequently in getting topology using Topology Script Api
The ViewInfo type has the following fields:
  • ViewInfo.stars.count - the number of times a star was given by any user to the view
Builder methods
withStarCount - adds the number of times a star was given by any user to the view info of each view.
If this flag is set the query response will contain the viewInfo holding star count. The stars count is available on this path viewResponse.viewInfo.stars.count
Examples:
The following example collects the names of all components in all views.
1
View.getAll()
2
.thenInject([]) { componentNames, view ->
3
Topology.query(view.view.query)
4
.components()
5
.then {
6
components -> componentNames + components.collect { it.name }
7
}
8
}
9
.then {
10
it.unique()
11
}
Copied!
Last modified 2mo ago
Copy link