fetchGroupAcks method

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

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 ChatError.

Implementation

Future<ChatCursorResult<ChatGroupMessageAck>> 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 {
    ChatError.hasErrorFromResult(result);
    ChatCursorResult<ChatGroupMessageAck> cursorResult =
        ChatCursorResult.fromJson(
      result[ChatMethodKeys.asyncFetchGroupAcks],
      dataItemCallback: (map) {
        return ChatGroupMessageAck.fromJson(map);
      },
    );

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