listActiveSessions method
GET /accounts/projects/{project_id}/sessions
Returns JSON: { "sessions": { "room_name", "started_at", "is_active" }, ... }
Implementation
Future<List<RoomSession>> listActiveSessions(String projectId) async {
final uri = Uri.parse('$baseUrl/accounts/projects/$projectId/sessions/active');
final response = await http.get(uri, headers: _getHeaders());
if (response.statusCode >= 400) {
throw MeshagentException(
'Failed to list active sessions. '
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
final data = jsonDecode(response.body) as Map<String, dynamic>;
final list = data['sessions'] as List<dynamic>? ?? [];
return list.whereType<Map<String, dynamic>>().map(RoomSession.fromJson).toList();
}