deleteMessage method

Future<DeleteMessageResponse> deleteMessage({
  1. required String id,
  2. required String roomIdentifier,
  3. String? reason,
})

Sends an event to a specific room which directs clients to delete a specific message; that is, unrender it from view and delete it from the client’s chat history. This event’s EventName is aws:DELETE_MESSAGE. This replicates the DeleteMessage WebSocket operation in the Amazon IVS Chat Messaging API.

May throw AccessDeniedException. May throw PendingVerification. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter id : ID of the message to be deleted. This is the Id field in the received message (see Message (Subscribe) in the Chat Messaging API).

Parameter roomIdentifier : Identifier of the room where the message should be deleted. Currently this must be an ARN.

Parameter reason : Reason for deleting the message.

Implementation

Future<DeleteMessageResponse> deleteMessage({
  required String id,
  required String roomIdentifier,
  String? reason,
}) async {
  final $payload = <String, dynamic>{
    'id': id,
    'roomIdentifier': roomIdentifier,
    if (reason != null) 'reason': reason,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/DeleteMessage',
    exceptionFnMap: _exceptionFns,
  );
  return DeleteMessageResponse.fromJson(response);
}