mirror of
				https://github.com/telegramdesktop/tdesktop
				synced 2025-10-29 15:19:53 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			113 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			113 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
| 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 "api/api_statistics_sender.h"
 | |
| #include "data/data_credits.h"
 | |
| #include "data/data_credits_earn.h"
 | |
| #include "mtproto/sender.h"
 | |
| 
 | |
| namespace Main {
 | |
| class Session;
 | |
| } // namespace Main
 | |
| 
 | |
| class UserData;
 | |
| 
 | |
| namespace Api {
 | |
| 
 | |
| class CreditsTopupOptions final {
 | |
| public:
 | |
| 	CreditsTopupOptions(not_null<PeerData*> peer);
 | |
| 
 | |
| 	[[nodiscard]] rpl::producer<rpl::no_value, QString> request();
 | |
| 	[[nodiscard]] Data::CreditTopupOptions options() const;
 | |
| 
 | |
| private:
 | |
| 	const not_null<PeerData*> _peer;
 | |
| 
 | |
| 	Data::CreditTopupOptions _options;
 | |
| 
 | |
| 	MTP::Sender _api;
 | |
| 
 | |
| };
 | |
| 
 | |
| class CreditsGiveawayOptions final {
 | |
| public:
 | |
| 	CreditsGiveawayOptions(not_null<PeerData*> peer);
 | |
| 
 | |
| 	[[nodiscard]] rpl::producer<rpl::no_value, QString> request();
 | |
| 	[[nodiscard]] Data::CreditsGiveawayOptions options() const;
 | |
| 
 | |
| private:
 | |
| 	const not_null<PeerData*> _peer;
 | |
| 
 | |
| 	Data::CreditsGiveawayOptions _options;
 | |
| 
 | |
| 	MTP::Sender _api;
 | |
| 
 | |
| };
 | |
| 
 | |
| class CreditsStatus final {
 | |
| public:
 | |
| 	CreditsStatus(not_null<PeerData*> peer);
 | |
| 
 | |
| 	void request(
 | |
| 		const Data::CreditsStatusSlice::OffsetToken &token,
 | |
| 		Fn<void(Data::CreditsStatusSlice)> done);
 | |
| 
 | |
| private:
 | |
| 	const not_null<PeerData*> _peer;
 | |
| 
 | |
| 	mtpRequestId _requestId = 0;
 | |
| 
 | |
| 	MTP::Sender _api;
 | |
| 
 | |
| };
 | |
| 
 | |
| class CreditsHistory final {
 | |
| public:
 | |
| 	CreditsHistory(not_null<PeerData*> peer, bool in, bool out);
 | |
| 
 | |
| 	void request(
 | |
| 		const Data::CreditsStatusSlice::OffsetToken &token,
 | |
| 		Fn<void(Data::CreditsStatusSlice)> done);
 | |
| 	void requestSubscriptions(
 | |
| 		const Data::CreditsStatusSlice::OffsetToken &token,
 | |
| 		Fn<void(Data::CreditsStatusSlice)> done);
 | |
| 
 | |
| private:
 | |
| 	using HistoryTL = MTPpayments_GetStarsTransactions;
 | |
| 	const not_null<PeerData*> _peer;
 | |
| 	const HistoryTL::Flags _flags;
 | |
| 
 | |
| 	mtpRequestId _requestId = 0;
 | |
| 
 | |
| 	MTP::Sender _api;
 | |
| 
 | |
| };
 | |
| 
 | |
| class CreditsEarnStatistics final : public StatisticsRequestSender {
 | |
| public:
 | |
| 	explicit CreditsEarnStatistics(not_null<PeerData*>);
 | |
| 
 | |
| 	[[nodiscard]] rpl::producer<rpl::no_value, QString> request();
 | |
| 	[[nodiscard]] Data::CreditsEarnStatistics data() const;
 | |
| 
 | |
| private:
 | |
| 	Data::CreditsEarnStatistics _data;
 | |
| 	bool _isUser = false;
 | |
| 
 | |
| 	mtpRequestId _requestId = 0;
 | |
| 
 | |
| };
 | |
| 
 | |
| [[nodiscard]] rpl::producer<not_null<PeerData*>> PremiumPeerBot(
 | |
| 	not_null<Main::Session*> session);
 | |
| 
 | |
| } // namespace Api
 |