putFeedback method

Future<void> putFeedback({
  1. required String applicationId,
  2. required String conversationId,
  3. required String messageId,
  4. DateTime? messageCopiedAt,
  5. MessageUsefulnessFeedback? messageUsefulness,
  6. String? userId,
})

Enables your end user to provide feedback on their Amazon Q Business generated chat responses.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter applicationId : The identifier of the application associated with the feedback.

Parameter conversationId : The identifier of the conversation the feedback is attached to.

Parameter messageId : The identifier of the chat message that the feedback was given for.

Parameter messageCopiedAt : The timestamp for when the feedback was recorded.

Parameter messageUsefulness : The feedback usefulness value given by the user to the chat message.

Parameter userId : The identifier of the user giving the feedback.

Implementation

Future<void> putFeedback({
  required String applicationId,
  required String conversationId,
  required String messageId,
  DateTime? messageCopiedAt,
  MessageUsefulnessFeedback? messageUsefulness,
  String? userId,
}) async {
  final $query = <String, List<String>>{
    if (userId != null) 'userId': [userId],
  };
  final $payload = <String, dynamic>{
    if (messageCopiedAt != null)
      'messageCopiedAt': unixTimestampToJson(messageCopiedAt),
    if (messageUsefulness != null) 'messageUsefulness': messageUsefulness,
  };
  await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/applications/${Uri.encodeComponent(applicationId)}/conversations/${Uri.encodeComponent(conversationId)}/messages/${Uri.encodeComponent(messageId)}/feedback',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
}