Add class td_api::chatRevenueAmount.

This commit is contained in:
levlam 2024-04-23 12:07:48 +03:00
parent 7be2966e27
commit e812370dc5
2 changed files with 19 additions and 9 deletions

View File

@ -6627,15 +6627,19 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_
chatStatisticsChannel period:dateRange member_count:statisticalValue mean_message_view_count:statisticalValue mean_message_share_count:statisticalValue mean_message_reaction_count:statisticalValue mean_story_view_count:statisticalValue mean_story_share_count:statisticalValue mean_story_reaction_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_interactions:vector<chatStatisticsInteractionInfo> = ChatStatistics;
//@description Contains information about revenue earned from sponsored messages in a chat
//@cryptocurrency Cryptocurrency in which revenue is calculated
//@total_amount Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency
//@balance_amount Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency
//@available_amount Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency
chatRevenueAmount cryptocurrency:string total_amount:int64 balance_amount:int64 available_amount:int64 = ChatRevenueAmount;
//@description A detailed statistics about revenue earned from sponsored messages in a chat
//@revenue_by_hour_graph A graph containing amount of revenue in a given hour
//@revenue_graph A graph containing amount of revenue
//@cryptocurrency Cryptocurrency in which revenue is calculated
//@cryptocurrency_total_amount Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency
//@cryptocurrency_balance_amount Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency
//@cryptocurrency_available_amount Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency
//@usd_rate Current conversion rate of the cryptocurrency to USD
chatRevenueStatistics revenue_by_hour_graph:StatisticalGraph revenue_graph:StatisticalGraph cryptocurrency:string cryptocurrency_total_amount:int64 cryptocurrency_balance_amount:int64 cryptocurrency_available_amount:int64 usd_rate:double = ChatRevenueStatistics;
//@revenue_amount Amount of earned revenue
//@usd_rate Current conversion rate of the cryptocurrency in which revenue is calculated to USD
chatRevenueStatistics revenue_by_hour_graph:StatisticalGraph revenue_graph:StatisticalGraph revenue_amount:chatRevenueAmount usd_rate:double = ChatRevenueStatistics;
//@description A detailed statistics about a message
//@message_interaction_graph A graph containing number of message views and shares

View File

@ -274,13 +274,19 @@ static int64 get_amount(int64 amount, bool allow_negative = false) {
return amount;
}
static td_api::object_ptr<td_api::chatRevenueAmount> convert_broadcast_revenue_balances(
telegram_api::object_ptr<telegram_api::broadcastRevenueBalances> obj) {
CHECK(obj != nullptr);
return td_api::make_object<td_api::chatRevenueAmount>(
"TON", get_amount(obj->overall_revenue_), get_amount(obj->current_balance_), get_amount(obj->available_balance_));
}
static td_api::object_ptr<td_api::chatRevenueStatistics> convert_broadcast_revenue_stats(
telegram_api::object_ptr<telegram_api::stats_broadcastRevenueStats> obj) {
CHECK(obj != nullptr);
return td_api::make_object<td_api::chatRevenueStatistics>(
convert_stats_graph(std::move(obj->top_hours_graph_)), convert_stats_graph(std::move(obj->revenue_graph_)), "TON",
get_amount(obj->balances_->overall_revenue_), get_amount(obj->balances_->current_balance_),
get_amount(obj->balances_->available_balance_),
convert_stats_graph(std::move(obj->top_hours_graph_)), convert_stats_graph(std::move(obj->revenue_graph_)),
convert_broadcast_revenue_balances(std::move(obj->balances_)),
obj->usd_rate_ > 0 ? clamp(obj->usd_rate_ * 1e-7, 1e-18, 1e18) : 1.0);
}