listWebhooksPage method

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

Corresponds to: GET /accounts/projects/{project_id}/webhooks Returns a JSON dict like { "webhooks": { ... }, ... }.

Implementation

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

  if (response.statusCode >= 400) {
    throw MeshagentException(
      'Failed to list project webhooks. '
      'Status code: ${response.statusCode}, body: ${response.body}',
    );
  }
  return MeshagentWebhooksPage.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
}