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 encodedProjectId = Uri.encodeComponent(projectId);
final gid = Uri.encodeComponent(grantId ?? 'unused');
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/room-grants/$gid');
final body = {'room_id': roomId, 'user_id': userId, 'permissions': permissions.toJson()};
final response = await httpClient.put(uri, body: jsonEncode(body));
if (response.statusCode >= 400) {
throw MeshagentException(
'Failed to update room grant. '
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
}