getRecommendations method
waitTimeSeconds parameter. Short poll is the default behavior
and only returns recommendations already available. To perform a manual
query against an assistant, use QueryAssistant.
May throw AccessDeniedException.
May throw ResourceNotFoundException.
May throw ValidationException.
Parameter assistantId :
The identifier of the Amazon Q in Connect assistant. Can be either the ID
or the ARN. URLs cannot contain the ARN.
Parameter sessionId :
The identifier of the session. Can be either the ID or the ARN. URLs
cannot contain the ARN.
Parameter maxResults :
The maximum number of results to return per page.
Parameter nextChunkToken :
The token for the next set of chunks. Use the value returned in the
previous response in the next request to retrieve the next set of chunks.
Parameter recommendationType :
The type of recommendation being requested.
Parameter waitTimeSeconds :
The duration (in seconds) for which the call waits for a recommendation to
be made available before returning. If a recommendation is available, the
call returns sooner than WaitTimeSeconds. If no messages are
available and the wait time expires, the call returns successfully with an
empty list.
Implementation
Future<GetRecommendationsResponse> getRecommendations({
required String assistantId,
required String sessionId,
int? maxResults,
String? nextChunkToken,
RecommendationType? recommendationType,
int? waitTimeSeconds,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
100,
);
_s.validateNumRange(
'waitTimeSeconds',
waitTimeSeconds,
0,
20,
);
final $query = <String, List<String>>{
if (maxResults != null) 'maxResults': [maxResults.toString()],
if (nextChunkToken != null) 'nextChunkToken': [nextChunkToken],
if (recommendationType != null)
'recommendationType': [recommendationType.value],
if (waitTimeSeconds != null)
'waitTimeSeconds': [waitTimeSeconds.toString()],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri:
'/assistants/${Uri.encodeComponent(assistantId)}/sessions/${Uri.encodeComponent(sessionId)}/recommendations',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return GetRecommendationsResponse.fromJson(response);
}