updateRoomGrant method
PUT /accounts/projects/{project_id}/room-grants/{grant_id} Body: { "room_name", "user_id", "permissions" } Note: Many servers ignore {grant_id} and update by (project_id, room_name, user_id).
Implementation
Future<void> updateRoomGrant({
required String projectId,
required String roomId,
required String userId,
required ApiScope permissions,
String? grantId,
}) async {
final gid = grantId ?? 'unused';
final uri = Uri.parse('$baseUrl/accounts/projects/$projectId/room-grants/$gid');
final body = {'room_id': roomId, 'user_id': userId, 'permissions': permissions.toJson()};
final response = await http.put(uri, headers: _getHeaders(), body: jsonEncode(body));
if (response.statusCode >= 400) {
throw MeshagentException(
'Failed to update room grant. '
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
}