fetchGroupAcks method

Future<EMCursorResult<EMGroupMessageAck>> fetchGroupAcks(
  1. String msgId,
  2. String groupId, {
  3. String? startAckId,
  4. int pageSize = 0,
})

~english Gets read receipts for group messages from the server with pagination.

For how to send read receipts for group messages, see sendConversationReadAck.

Param msgId The message ID.

Param startAckId The starting read receipt ID for query. If you set it as null, the SDK retrieves the read receipts in the in reverse chronological order.

Param pageSize The number of read receipts per page.

Return The list of obtained read receipts and the cursor for next query.

Throws A description of the exception. See EMError. ~end

~chinese 从服务器获取群组消息回执详情。

分页获取。

Note 发送群组消息回执,详见 sendConversationReadAck

Param msgId 消息 ID。

Param startAckId 已读回执的 ID,如果为空,从最新的回执向前开始获取。

Param pageSize 每页获取群消息已读回执的条数。

Return 返回回执列表和用于下次获取群消息回执的 EMCursorResult

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。 ~end

Implementation

Future<EMCursorResult<EMGroupMessageAck>> fetchGroupAcks(
  String msgId,
  String groupId, {
  String? startAckId,
  int pageSize = 0,
}) async {
  Map req = {"msg_id": msgId, "group_id": groupId};
  req["pageSize"] = pageSize;
  req.putIfNotNull("ack_id", startAckId);

  Map result =
      await ChatChannel.invokeMethod(ChatMethodKeys.asyncFetchGroupAcks, req);

  try {
    EMError.hasErrorFromResult(result);
    EMCursorResult<EMGroupMessageAck> cursorResult = EMCursorResult.fromJson(
      result[ChatMethodKeys.asyncFetchGroupAcks],
      dataItemCallback: (map) {
        return EMGroupMessageAck.fromJson(map);
      },
    );

    return cursorResult;
  } on EMError catch (e) {
    throw e;
  }
}