deleteRemoteMessagesBefore method

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

~english 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. ~end

~chinese 根据时间 单向删除服务器会话中的消息和本地消息。 Param conversationId 会话 ID。

Param type 会话类型。

Param timestamp 以毫秒为单位的UNIX时间戳。时间戳小于指定时间戳的消息将被删除。 ~end

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;
  }
}