listContacts method

Future<ListContactsResult> listContacts({
  1. String? aliasPrefix,
  2. int? maxResults,
  3. String? nextToken,
  4. ContactType? type,
})

Lists all contacts and escalation plans in Incident Manager.

May throw AccessDeniedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter aliasPrefix : Used to list only contacts who's aliases start with the specified prefix.

Parameter maxResults : The maximum number of contacts and escalation plans per page of results.

Parameter nextToken : The pagination token to continue to the next page of results.

Parameter type : The type of contact.

Implementation

Future<ListContactsResult> listContacts({
  String? aliasPrefix,
  int? maxResults,
  String? nextToken,
  ContactType? type,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    1024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SSMContacts.ListContacts'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (aliasPrefix != null) 'AliasPrefix': aliasPrefix,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (type != null) 'Type': type.value,
    },
  );

  return ListContactsResult.fromJson(jsonResponse.body);
}