listContacts method

Future<ListContactsResponse> listContacts({
  1. required String contactListName,
  2. ListContactsFilter? filter,
  3. String? nextToken,
  4. int? pageSize,
})

Lists the contacts present in a specific contact list.

May throw BadRequestException. May throw TooManyRequestsException. May throw NotFoundException.

Parameter contactListName : The name of the contact list.

Parameter filter : A filter that can be applied to a list of contacts.

Parameter nextToken : A string token indicating that there might be additional contacts available to be listed. Use the token provided in the Response to use in the subsequent call to ListContacts with the same parameters to retrieve the next page of contacts.

Parameter pageSize : The number of contacts that may be returned at once, which is dependent on if there are more or less contacts than the value of the PageSize. Use this parameter to paginate results. If additional contacts exist beyond the specified limit, the NextToken element is sent in the response. Use the NextToken value in subsequent requests to retrieve additional contacts.

Implementation

Future<ListContactsResponse> listContacts({
  required String contactListName,
  ListContactsFilter? filter,
  String? nextToken,
  int? pageSize,
}) async {
  ArgumentError.checkNotNull(contactListName, 'contactListName');
  final $query = <String, List<String>>{
    if (nextToken != null) 'NextToken': [nextToken],
    if (pageSize != null) 'PageSize': [pageSize.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/v2/email/contact-lists/${Uri.encodeComponent(contactListName)}/contacts',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListContactsResponse.fromJson(response);
}