deleteIndex method

Future<void> deleteIndex(
  1. String organizationId,
  2. IndexableCollection collectionType,
  3. String indexName, {
  4. String? pipelineName,
})

DeleteIndex drops the specified custom index from a collection.

_viam = await Viam.withApiKey(
     dotenv.env['API_KEY_ID'] ?? '',
     dotenv.env['API_KEY'] ?? ''
 );
 final dataClient = _viam.dataClient;

 try {
   // Delete index
   await this.deleteIndex(
     "<YOUR-ORG-ID>",
     IndexableCollection.INDEXABLE_COLLECTION_PIPELINE_SINK,
     "<YOUR-INDEX-NAME>"
   );
   print('Successfully deleted index');
 } catch (e) {
   print('Error deleting index: $e');
 }

For more information, see Data Client API.

Implementation

Future<void> deleteIndex(String organizationId, IndexableCollection collectionType, String indexName, {String? pipelineName}) async {
  final request = DeleteIndexRequest()
    ..organizationId = organizationId
    ..collectionType = collectionType
    ..indexName = indexName;
  if (pipelineName != null) {
    request.pipelineName = pipelineName;
  }
  await _dataClient.deleteIndex(request);
}