listProjects method
Corresponds to: GET /accounts/projects
Returns JSON like { "projects": ... } on success.
Implementation
Future<List<Map<String, dynamic>>> listProjects() async {
final uri = Uri.parse('$baseUrl/accounts/projects');
final response = await http.get(uri, headers: _getHeaders());
if (response.statusCode >= 400) {
throw MeshagentException('Failed to list projects. Status code: ${response.statusCode}, body: ${response.body}');
}
return (jsonDecode(response.body)["projects"] as List).whereType<Map<String, dynamic>>().toList();
}