removeTagsFromBinaryDataByIds method
Remove tags from binary data based on IDs.
Returns the number of tags deleted.
_viam = await Viam.withApiKey(
dotenv.env['API_KEY_ID'] ?? '',
dotenv.env['API_KEY'] ?? ''
);
final dataClient = _viam.dataClient;
try {
// List of tags to remove
final List<String> tags = ['tag_1', 'tag_2'];
final binaryDataIds = [
'<YOUR-BINARY-DATA-ID>',
'<YOUR-BINARY-DATA-ID>'
];
// Call the function with both tags and IDs
await dataClient.removeTagsFromBinaryDataByIds(tags, binaryDataIds);
print('Successfully removed tags from binary IDs');
} catch (e) {
print('Error removing tags: $e');
}
For more information, see Data Client API.
Implementation
Future<int> removeTagsFromBinaryDataByIds(List<String> tags, List<String> binaryDataIds) async {
final request = RemoveTagsFromBinaryDataByIDsRequest()
..tags.addAll(tags)
..binaryDataIds.addAll(binaryDataIds);
final response = await _dataClient.removeTagsFromBinaryDataByIDs(request);
return response.deletedCount.toInt();
}