searchAgents method

Future<SearchAgentsResponse> searchAgents({
  1. required String awsAccountId,
  2. required List<AgentSearchFilter> filters,
  3. int? maxResults,
  4. String? nextToken,
})

Searches for agents based on specified filters.

May throw AccessDeniedException. May throw InternalFailureException. May throw InvalidParameterValueException. May throw PreconditionNotMetException. May throw ResourceExistsException. May throw ThrottlingException.

Parameter awsAccountId : The ID of the Amazon Web Services account that contains the agents.

Parameter filters : The filters to apply when searching agents.

Parameter maxResults : The maximum number of results to return.

Parameter nextToken : The token for the next set of results, or null if there are no more results.

Implementation

Future<SearchAgentsResponse> searchAgents({
  required String awsAccountId,
  required List<AgentSearchFilter> filters,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'max-results': [maxResults.toString()],
    if (nextToken != null) 'next-token': [nextToken],
  };
  final $payload = <String, dynamic>{
    'Filters': filters,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/accounts/${Uri.encodeComponent(awsAccountId)}/search/agents',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return SearchAgentsResponse.fromJson(response);
}