updateGroup method
Future<void>
updateGroup(
- String groupId, {
- String? groupName,
- OperationType? operation,
- List<
String> ? nodeIds,
Updates an existing user device group.
Updates a group with the given
parameters. When changing nodes, both
the operation
and nodeIds
must be specified.
Implementation
Future<void> updateGroup(String groupId,
{String? groupName,
OperationType? operation,
List<String>? nodeIds}) async {
final uri = _urlBase.getPath(_devGroupBase, {
'group_id': groupId,
});
final body = await JsonIsolate().encodeJson({
'group_name': groupName,
'operation': operation?.toShortString(),
'nodes': nodeIds,
});
final resp = await put(uri, body: body, headers: {
URLBase.authHeader: accessToken,
});
final Map<String, dynamic> bodyResp =
await JsonIsolate().decodeJson(resp.body);
if (resp.statusCode != 200) {
throw bodyResp['description'];
}
}