listOAuthClients method
GET /accounts/projects/{project_id}/oauth/clients Returns a list of OAuthClient (no secrets).
Implementation
Future<List<OAuthClient>> listOAuthClients(String projectId) async {
final encodedProjectId = Uri.encodeComponent(projectId);
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/oauth/clients');
final response = await httpClient.get(uri);
if (response.statusCode >= 400) {
throw MeshagentException(
'Failed to list OAuth clients. '
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
final decoded = jsonDecode(response.body) as Map<String, dynamic>;
final list = decoded['clients'] as List<dynamic>? ?? const [];
return list.whereType<Map<String, dynamic>>().map(OAuthClient.fromJson).toList();
}