/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "data/data_statistics.h" #include "mtproto/sender.h" class ApiWrap; class ChannelData; class PeerData; namespace Api { class Statistics final { public: explicit Statistics(not_null api); [[nodiscard]] rpl::producer request( not_null peer); using GraphResult = rpl::producer; [[nodiscard]] GraphResult requestZoom( not_null peer, const QString &token, float64 x); [[nodiscard]] GraphResult requestMessage( not_null peer, MsgId msgId); [[nodiscard]] Data::ChannelStatistics channelStats() const; [[nodiscard]] Data::SupergroupStatistics supergroupStats() const; private: Data::ChannelStatistics _channelStats; Data::SupergroupStatistics _supergroupStats; MTP::Sender _api; std::deque> _zoomDeque; }; class PublicForwards final { public: explicit PublicForwards(not_null channel, FullMsgId fullId); void request( const Data::PublicForwardsSlice::OffsetToken &token, Fn done); private: const not_null _channel; const FullMsgId _fullId; mtpRequestId _requestId = 0; int _lastTotal = 0; MTP::Sender _api; }; class MessageStatistics final { public: explicit MessageStatistics( not_null channel, FullMsgId fullId); void request(Fn done); [[nodiscard]] Data::PublicForwardsSlice firstSlice() const; private: PublicForwards _publicForwards; const not_null _channel; const FullMsgId _fullId; Data::PublicForwardsSlice _firstSlice; mtpRequestId _requestId = 0; MTP::Sender _api; }; } // namespace Api