listAlerts method

Future<ListAlertsResponse> listAlerts({
  1. required String channelId,
  2. int? maxResults,
  3. String? nextToken,
  4. String? stateFilter,
})

List the alerts for a channel with optional filtering based on alert state.

May throw BadGatewayException. May throw BadRequestException. May throw ForbiddenException. May throw GatewayTimeoutException. May throw InternalServerErrorException. May throw NotFoundException. May throw TooManyRequestsException.

Parameter channelId : The unique ID of the channel

Parameter maxResults : The maximum number of items to return

Parameter nextToken : The next pagination token

Parameter stateFilter : Specifies the set of alerts to return based on their state. SET - Return only alerts with SET state. CLEARED - Return only alerts with CLEARED state. ALL - Return all alerts.

Implementation

Future<ListAlertsResponse> listAlerts({
  required String channelId,
  int? maxResults,
  String? nextToken,
  String? stateFilter,
}) async {
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (stateFilter != null) 'stateFilter': [stateFilter],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/prod/channels/${Uri.encodeComponent(channelId)}/alerts',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListAlertsResponse.fromJson(response);
}