deleteRemoteMessagesBefore method

Future<void> deleteRemoteMessagesBefore(
  1. {required String conversationId,
  2. required ChatConversationType type,
  3. required int timestamp}
)

Unidirectionally removes historical message by timestamp from the server.

Param conversationId The conversation ID.

Param type The conversation type.

Param timestamp The UNIX timestamp in millisecond. Messages with a timestamp smaller than the specified one will be removed.

Implementation

Future<void> deleteRemoteMessagesBefore(
    {required String conversationId,
    required ChatConversationType type,
    required int timestamp}) async {
  Map request = {
    "convId": conversationId,
    "type": type.index,
    "timestamp": timestamp,
  };
  Map result = await ChatChannel.invokeMethod(
    ChatMethodKeys.removeMessagesFromServerWithTs,
    request,
  );
  try {
    ChatError.hasErrorFromResult(result);
  } on ChatError catch (e) {
    throw e;
  }
}