listFeedsPage method

Future<FeedsPage> listFeedsPage(
  1. String projectId, {
  2. int pageSize = 100,
  3. String? continuationToken,
  4. String? filter,
  5. String? view,
})

Implementation

Future<FeedsPage> listFeedsPage(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 && filter.trim().isNotEmpty) query['filter'] = filter;
  if (view != null && view.trim().isNotEmpty) query['view'] = view;
  final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/feeds').replace(queryParameters: query);
  final response = await httpClient.get(uri);

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

  final data = jsonDecode(response.body) as Map<String, dynamic>;
  return FeedsPage.fromJson(data);
}