searchContacts method

Future<SearchContactsResponse> searchContacts({
  1. required String instanceId,
  2. required SearchContactsTimeRange timeRange,
  3. int? maxResults,
  4. String? nextToken,
  5. SearchCriteria? searchCriteria,
  6. Sort? sort,
})

Searches contacts in an Connect Customer instance.

May throw InternalServiceException. May throw InvalidParameterException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter instanceId : The identifier of Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

Parameter timeRange : Time range that you want to search results.

Parameter maxResults : The maximum number of results to return per page.

Parameter nextToken : The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Parameter searchCriteria : The search criteria to be used to return contacts.

Parameter sort : Specifies a field to sort by and a sort order.

Implementation

Future<SearchContactsResponse> searchContacts({
  required String instanceId,
  required SearchContactsTimeRange timeRange,
  int? maxResults,
  String? nextToken,
  SearchCriteria? searchCriteria,
  Sort? sort,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $payload = <String, dynamic>{
    'InstanceId': instanceId,
    'TimeRange': timeRange,
    if (maxResults != null) 'MaxResults': maxResults,
    if (nextToken != null) 'NextToken': nextToken,
    if (searchCriteria != null) 'SearchCriteria': searchCriteria,
    if (sort != null) 'Sort': sort,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/search-contacts',
    exceptionFnMap: _exceptionFns,
  );
  return SearchContactsResponse.fromJson(response);
}