addTagsToBinaryDataByIds method

Future<void> addTagsToBinaryDataByIds(
  1. List<String> tags,
  2. List<String> binaryDataIds
)

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 binaryDataIds = [
  '<YOUR-BINARY-DATA-ID>',
  '<YOUR-BINARY-DATA-ID>'
  ];

  // Call the function with both tags and IDs
  await dataClient.addTagsToBinaryDataByIds(tags, binaryDataIds);

  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<String> binaryDataIds) async {
  final request = AddTagsToBinaryDataByIDsRequest()
    ..tags.addAll(tags)
    ..binaryDataIds.addAll(binaryDataIds);
  await _dataClient.addTagsToBinaryDataByIDs(request);
}