listIndexes method
- String organizationId,
- IndexableCollection collectionType, {
- String? pipelineName,
ListIndexes returns all the indexes for a given collection.
_viam = await Viam.withApiKey(
dotenv.env['API_KEY_ID'] ?? '',
dotenv.env['API_KEY'] ?? ''
);
final dataClient = _viam.dataClient;
try {
// List indexes
final indexes = await this.listIndexes(
"<YOUR-ORG-ID>",
IndexableCollection.INDEXABLE_COLLECTION_PIPELINE_SINK,
);
print('Successfully retrieved indexes: $indexes');
} catch (e) {
print('Error retrieving indexes: $e');
}
For more information, see Data Client API.
Implementation
Future<List<Index>> listIndexes(String organizationId, IndexableCollection collectionType, {String? pipelineName}) async {
final request = ListIndexesRequest()
..organizationId = organizationId
..collectionType = collectionType;
if (pipelineName != null) {
request.pipelineName = pipelineName;
}
final resp = await _dataClient.listIndexes(request);
return resp.indexes;
}