listServiceAccountsPage method
Implementation
Future<ServiceAccountsPage> listServiceAccountsPage(
String projectId, {
int pageSize = 100,
String? continuationToken,
String? filter,
String? view,
}) async {
final encodedProjectId = Uri.encodeComponent(projectId);
final query = <String, String>{'page_size': '$pageSize'};
if (continuationToken != null) {
query['continuation_token'] = continuationToken;
}
if (filter != null) {
query['filter'] = filter;
}
if (view != null) {
query['view'] = view;
}
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/service-accounts').replace(queryParameters: query);
final response = await httpClient.get(uri);
if (response.statusCode >= 400) {
throw MeshagentException(
'Failed to list service accounts. '
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
return ServiceAccountsPage.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
}