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 binaryIDs = [
BinaryID(fileId: '<YOUR-FILE-ID>', organizationId: '<YOUR-ORG-ID>', locationId: '<YOUR-LOCATION-ID>'),
BinaryID(fileId: '<YOUR-FILE-ID>', organizationId: '<YOUR-ORG-ID>', locationId: '<YOUR-LOCATION-ID>')
];
// Call the function with both tags and IDs
await dataClient.removeTagsFromBinaryDataByIds(tags, binaryIDs);
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<BinaryID> binaryIds) async {
final request = RemoveTagsFromBinaryDataByIDsRequest()
..tags.addAll(tags)
..binaryIds.addAll(binaryIds);
final response = await _dataClient.removeTagsFromBinaryDataByIDs(request);
return response.deletedCount.toInt();
}