2023-09-19 20:24:19 +02:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2023-09-19 20:24:19 +02:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
2023-09-19 20:40:29 +02:00
|
|
|
#include "td/telegram/ChannelId.h"
|
|
|
|
#include "td/telegram/DialogId.h"
|
2023-09-21 18:11:17 +02:00
|
|
|
#include "td/telegram/MessageFullId.h"
|
2023-09-19 20:40:29 +02:00
|
|
|
#include "td/telegram/net/DcId.h"
|
2023-11-17 12:26:51 +01:00
|
|
|
#include "td/telegram/StoryFullId.h"
|
2023-09-19 20:40:29 +02:00
|
|
|
#include "td/telegram/td_api.h"
|
2023-09-25 20:39:02 +02:00
|
|
|
#include "td/telegram/telegram_api.h"
|
2023-09-19 20:40:29 +02:00
|
|
|
|
2023-09-19 20:24:19 +02:00
|
|
|
#include "td/actor/actor.h"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
2023-09-19 20:40:29 +02:00
|
|
|
#include "td/utils/Promise.h"
|
2023-09-19 20:24:19 +02:00
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class Td;
|
|
|
|
|
|
|
|
class StatisticsManager final : public Actor {
|
|
|
|
public:
|
|
|
|
StatisticsManager(Td *td, ActorShared<> parent);
|
|
|
|
|
2023-09-19 20:40:29 +02:00
|
|
|
void get_channel_statistics(DialogId dialog_id, bool is_dark,
|
|
|
|
Promise<td_api::object_ptr<td_api::ChatStatistics>> &&promise);
|
|
|
|
|
2024-04-03 15:49:51 +02:00
|
|
|
void get_channel_revenue_statistics(DialogId dialog_id, bool is_dark,
|
|
|
|
Promise<td_api::object_ptr<td_api::chatRevenueStatistics>> &&promise);
|
|
|
|
|
2024-04-05 15:41:35 +02:00
|
|
|
void get_channel_revenue_withdrawal_url(DialogId dialog_id, const string &password, Promise<string> &&promise);
|
|
|
|
|
2024-04-04 12:55:24 +02:00
|
|
|
void get_channel_revenue_transactions(DialogId dialog_id, int32 offset, int32 limit,
|
|
|
|
Promise<td_api::object_ptr<td_api::chatRevenueTransactions>> &&promise);
|
|
|
|
|
2024-05-07 12:45:35 +02:00
|
|
|
void on_update_dialog_revenue_transactions(DialogId dialog_id,
|
|
|
|
telegram_api::object_ptr<telegram_api::broadcastRevenueBalances> balances);
|
2024-04-26 00:15:24 +02:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void get_channel_message_statistics(MessageFullId message_full_id, bool is_dark,
|
2023-09-19 20:40:29 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::messageStatistics>> &&promise);
|
|
|
|
|
2023-11-17 12:26:51 +01:00
|
|
|
void get_channel_story_statistics(StoryFullId message_full_id, bool is_dark,
|
|
|
|
Promise<td_api::object_ptr<td_api::storyStatistics>> &&promise);
|
|
|
|
|
2023-09-19 20:40:29 +02:00
|
|
|
void load_statistics_graph(DialogId dialog_id, string token, int64 x,
|
|
|
|
Promise<td_api::object_ptr<td_api::StatisticalGraph>> &&promise);
|
|
|
|
|
2023-09-25 20:39:02 +02:00
|
|
|
void get_message_public_forwards(MessageFullId message_full_id, string offset, int32 limit,
|
2023-12-18 12:59:50 +01:00
|
|
|
Promise<td_api::object_ptr<td_api::publicForwards>> &&promise);
|
2023-09-25 20:39:02 +02:00
|
|
|
|
2023-11-30 15:21:56 +01:00
|
|
|
void get_story_public_forwards(StoryFullId story_full_id, string offset, int32 limit,
|
2023-12-18 12:59:50 +01:00
|
|
|
Promise<td_api::object_ptr<td_api::publicForwards>> &&promise);
|
2023-11-30 15:21:56 +01:00
|
|
|
|
2023-12-05 10:30:12 +01:00
|
|
|
void on_get_public_forwards(telegram_api::object_ptr<telegram_api::stats_publicForwards> &&public_forwards,
|
2023-12-18 12:59:50 +01:00
|
|
|
Promise<td_api::object_ptr<td_api::publicForwards>> &&promise);
|
2023-11-30 15:21:56 +01:00
|
|
|
|
2023-12-26 10:02:53 +01:00
|
|
|
void get_channel_differences_if_needed(telegram_api::object_ptr<telegram_api::stats_publicForwards> &&public_forwards,
|
|
|
|
Promise<td_api::object_ptr<td_api::publicForwards>> promise,
|
|
|
|
const char *source);
|
|
|
|
|
2024-06-16 21:28:07 +02:00
|
|
|
static td_api::object_ptr<td_api::StatisticalGraph> convert_stats_graph(
|
|
|
|
telegram_api::object_ptr<telegram_api::StatsGraph> obj);
|
|
|
|
|
2023-09-19 20:24:19 +02:00
|
|
|
private:
|
|
|
|
void tear_down() final;
|
|
|
|
|
2023-09-19 20:40:29 +02:00
|
|
|
void send_get_channel_stats_query(DcId dc_id, ChannelId channel_id, bool is_dark,
|
|
|
|
Promise<td_api::object_ptr<td_api::ChatStatistics>> &&promise);
|
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void send_get_channel_message_stats_query(DcId dc_id, MessageFullId message_full_id, bool is_dark,
|
2023-09-19 20:40:29 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::messageStatistics>> &&promise);
|
|
|
|
|
2023-11-17 12:26:51 +01:00
|
|
|
void send_get_channel_story_stats_query(DcId dc_id, StoryFullId story_full_id, bool is_dark,
|
|
|
|
Promise<td_api::object_ptr<td_api::storyStatistics>> &&promise);
|
|
|
|
|
2023-09-19 20:40:29 +02:00
|
|
|
void send_load_async_graph_query(DcId dc_id, string token, int64 x,
|
|
|
|
Promise<td_api::object_ptr<td_api::StatisticalGraph>> &&promise);
|
|
|
|
|
2023-09-25 20:39:02 +02:00
|
|
|
void send_get_message_public_forwards_query(DcId dc_id, MessageFullId message_full_id, string offset, int32 limit,
|
2023-12-18 12:59:50 +01:00
|
|
|
Promise<td_api::object_ptr<td_api::publicForwards>> &&promise);
|
2023-09-25 20:39:02 +02:00
|
|
|
|
2023-11-30 15:21:56 +01:00
|
|
|
void send_get_story_public_forwards_query(DcId dc_id, StoryFullId story_full_id, string offset, int32 limit,
|
2023-12-18 12:59:50 +01:00
|
|
|
Promise<td_api::object_ptr<td_api::publicForwards>> &&promise);
|
2023-11-30 15:21:56 +01:00
|
|
|
|
2024-04-05 15:41:35 +02:00
|
|
|
void send_get_channel_revenue_withdrawal_url_query(
|
|
|
|
ChannelId channel_id, telegram_api::object_ptr<telegram_api::InputCheckPasswordSRP> input_check_password,
|
|
|
|
Promise<string> &&promise);
|
|
|
|
|
2023-09-19 20:24:19 +02:00
|
|
|
Td *td_;
|
|
|
|
ActorShared<> parent_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|