listApiKeysPage method

Future<MeshagentApiKeysPage> listApiKeysPage(
  1. String projectId, {
  2. int count = 100,
  3. int offset = 0,
})

Corresponds to: GET /accounts/projects/{project_id}/api-keys Returns a JSON dict like: { "tokens": { ... }, ... }.

Implementation

Future<MeshagentApiKeysPage> listApiKeysPage(String projectId, {int count = 100, int offset = 0}) async {
  final encodedProjectId = Uri.encodeComponent(projectId);
  final uri = Uri.parse(
    '$baseUrl/accounts/projects/$encodedProjectId/api-keys',
  ).replace(queryParameters: {'count': '$count', 'offset': '$offset'});
  final response = await httpClient.get(uri);

  if (response.statusCode >= 400) {
    throw MeshagentException(
      'Failed to list project API keys. '
      'Status code: ${response.statusCode}, body: ${response.body}',
    );
  }

  return MeshagentApiKeysPage.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
}