listMessages method

Future<ListMessagesResponse> listMessages({
  1. required String assistantId,
  2. required String sessionId,
  3. MessageFilterType? filter,
  4. int? maxResults,
  5. String? nextToken,
})

Lists messages on an Amazon Q in Connect session.

May throw AccessDeniedException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter assistantId : The identifier of the Amazon Q in Connect assistant.

Parameter sessionId : The identifier of the Amazon Q in Connect session.

Parameter filter : The filter criteria for listing messages.

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.

Implementation

Future<ListMessagesResponse> listMessages({
  required String assistantId,
  required String sessionId,
  MessageFilterType? filter,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    if (filter != null) 'filter': [filter.value],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/assistants/${Uri.encodeComponent(assistantId)}/sessions/${Uri.encodeComponent(sessionId)}/messages',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListMessagesResponse.fromJson(response);
}