addTagsToBinaryDataByIds method
Adds tags to binary data based on IDs.
_viam = await Viam.withApiKey(
dotenv.env['API_KEY_ID'] ?? '',
dotenv.env['API_KEY'] ?? ''
);
final dataClient = _viam.dataClient;
try {
// List of tags to add
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.addTagsToBinaryDataByIds(tags, binaryIDs);
print('Successfully added tags to binary IDs');
} catch (e) {
print('Error adding tags: $e');
}
For more information, see Data Client API.
Implementation
Future<void> addTagsToBinaryDataByIds(List<String> tags, List<BinaryID> binaryIds) async {
final request = AddTagsToBinaryDataByIDsRequest()
..tags.addAll(tags)
..binaryIds.addAll(binaryIds);
await _dataClient.addTagsToBinaryDataByIDs(request);
}