Improve StarTransactionPartner class name.

This commit is contained in:
levlam 2024-06-16 23:09:04 +03:00
parent e059564184
commit a92a3785a6
2 changed files with 23 additions and 23 deletions

View File

@ -850,28 +850,28 @@ starTransactionDirectionIncoming = StarTransactionDirection;
starTransactionDirectionOutgoing = StarTransactionDirection; starTransactionDirectionOutgoing = StarTransactionDirection;
//@class StarTransactionSource @description Describes source or recipient of a transaction with Telegram stars //@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram stars
//@description The transaction is a transaction with Telegram through a bot //@description The transaction is a transaction with Telegram through a bot
starTransactionSourceTelegram = StarTransactionSource; starTransactionPartnerTelegram = StarTransactionPartner;
//@description The transaction is a transaction with App Store //@description The transaction is a transaction with App Store
starTransactionSourceAppStore = StarTransactionSource; starTransactionPartnerAppStore = StarTransactionPartner;
//@description The transaction is a transaction with Google Play //@description The transaction is a transaction with Google Play
starTransactionSourceGooglePlay = StarTransactionSource; starTransactionPartnerGooglePlay = StarTransactionPartner;
//@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment //@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment
starTransactionSourceFragment withdrawal_state:RevenueWithdrawalState = StarTransactionSource; starTransactionPartnerFragment withdrawal_state:RevenueWithdrawalState = StarTransactionPartner;
//@description The transaction is a transaction with another user @user_id Identifier of the user @product_info Information about the bought product; may be null if none //@description The transaction is a transaction with another user @user_id Identifier of the user @product_info Information about the bought product; may be null if none
starTransactionSourceUser user_id:int53 product_info:productInfo = StarTransactionSource; starTransactionPartnerUser user_id:int53 product_info:productInfo = StarTransactionPartner;
//@description The transaction is a transaction with a channel chat @chat_id Identifier of the chat //@description The transaction is a transaction with a channel chat @chat_id Identifier of the chat
starTransactionSourceChannel chat_id:int53 = StarTransactionSource; starTransactionPartnerChannel chat_id:int53 = StarTransactionPartner;
//@description The transaction is a transaction with unknown source //@description The transaction is a transaction with unknown partner
starTransactionSourceUnsupported = StarTransactionSource; starTransactionPartnerUnsupported = StarTransactionPartner;
//@description Represents a transaction changing the amount of owned Telegram stars //@description Represents a transaction changing the amount of owned Telegram stars
@ -879,8 +879,8 @@ starTransactionSourceUnsupported = StarTransactionSource;
//@star_count The amount of added owned Telegram stars; negative for outgoing transactions //@star_count The amount of added owned Telegram stars; negative for outgoing transactions
//@is_refund True, if the transaction is a refund of a previous transaction //@is_refund True, if the transaction is a refund of a previous transaction
//@date Point in time (Unix timestamp) when the transaction was completed //@date Point in time (Unix timestamp) when the transaction was completed
//@source Source of the transaction, or its recipient for outgoing transactions //@partner Source of the incoming transaction, or its recipient for outgoing transactions
starTransaction id:string star_count:int53 is_refund:Bool date:int32 source:StarTransactionSource = StarTransaction; starTransaction id:string star_count:int53 is_refund:Bool date:int32 partner:StarTransactionPartner = StarTransaction;
//@description Represents a list of Telegram star transactions //@description Represents a list of Telegram star transactions
//@star_count The amount of owned Telegram stars //@star_count The amount of owned Telegram stars

View File

@ -115,16 +115,16 @@ class GetStarsTransactionsQuery final : public Td::ResultHandler {
auto photo = get_web_document_photo(td_->file_manager_.get(), std::move(transaction->photo_), DialogId()); auto photo = get_web_document_photo(td_->file_manager_.get(), std::move(transaction->photo_), DialogId());
product_info = get_product_info_object(td_, transaction->title_, transaction->description_, photo); product_info = get_product_info_object(td_, transaction->title_, transaction->description_, photo);
} }
auto source = [&]() -> td_api::object_ptr<td_api::StarTransactionSource> { auto partner = [&]() -> td_api::object_ptr<td_api::StarTransactionPartner> {
switch (transaction->peer_->get_id()) { switch (transaction->peer_->get_id()) {
case telegram_api::starsTransactionPeerUnsupported::ID: case telegram_api::starsTransactionPeerUnsupported::ID:
return td_api::make_object<td_api::starTransactionSourceUnsupported>(); return td_api::make_object<td_api::starTransactionPartnerUnsupported>();
case telegram_api::starsTransactionPeerPremiumBot::ID: case telegram_api::starsTransactionPeerPremiumBot::ID:
return td_api::make_object<td_api::starTransactionSourceTelegram>(); return td_api::make_object<td_api::starTransactionPartnerTelegram>();
case telegram_api::starsTransactionPeerAppStore::ID: case telegram_api::starsTransactionPeerAppStore::ID:
return td_api::make_object<td_api::starTransactionSourceAppStore>(); return td_api::make_object<td_api::starTransactionPartnerAppStore>();
case telegram_api::starsTransactionPeerPlayMarket::ID: case telegram_api::starsTransactionPeerPlayMarket::ID:
return td_api::make_object<td_api::starTransactionSourceGooglePlay>(); return td_api::make_object<td_api::starTransactionPartnerGooglePlay>();
case telegram_api::starsTransactionPeerFragment::ID: { case telegram_api::starsTransactionPeerFragment::ID: {
auto state = [&]() -> td_api::object_ptr<td_api::RevenueWithdrawalState> { auto state = [&]() -> td_api::object_ptr<td_api::RevenueWithdrawalState> {
if (transaction->transaction_date_ > 0) { if (transaction->transaction_date_ > 0) {
@ -142,21 +142,21 @@ class GetStarsTransactionsQuery final : public Td::ResultHandler {
} }
return nullptr; return nullptr;
}(); }();
return td_api::make_object<td_api::starTransactionSourceFragment>(std::move(state)); return td_api::make_object<td_api::starTransactionPartnerFragment>(std::move(state));
} }
case telegram_api::starsTransactionPeer::ID: { case telegram_api::starsTransactionPeer::ID: {
DialogId dialog_id( DialogId dialog_id(
static_cast<const telegram_api::starsTransactionPeer *>(transaction->peer_.get())->peer_); static_cast<const telegram_api::starsTransactionPeer *>(transaction->peer_.get())->peer_);
if (dialog_id.get_type() == DialogType::User) { if (dialog_id.get_type() == DialogType::User) {
return td_api::make_object<td_api::starTransactionSourceUser>( return td_api::make_object<td_api::starTransactionPartnerUser>(
td_->user_manager_->get_user_id_object(dialog_id.get_user_id(), "starTransactionSourceUser"), td_->user_manager_->get_user_id_object(dialog_id.get_user_id(), "starTransactionPartnerUser"),
std::move(product_info)); std::move(product_info));
} }
if (td_->dialog_manager_->is_broadcast_channel(dialog_id)) { if (td_->dialog_manager_->is_broadcast_channel(dialog_id)) {
return td_api::make_object<td_api::starTransactionSourceChannel>( return td_api::make_object<td_api::starTransactionPartnerChannel>(
td_->dialog_manager_->get_chat_id_object(dialog_id, "starTransactionSourceUser")); td_->dialog_manager_->get_chat_id_object(dialog_id, "starTransactionPartnerChannel"));
} }
return td_api::make_object<td_api::starTransactionSourceUnsupported>(); return td_api::make_object<td_api::starTransactionPartnerUnsupported>();
} }
default: default:
UNREACHABLE(); UNREACHABLE();
@ -164,7 +164,7 @@ class GetStarsTransactionsQuery final : public Td::ResultHandler {
}(); }();
transactions.push_back(td_api::make_object<td_api::starTransaction>( transactions.push_back(td_api::make_object<td_api::starTransaction>(
transaction->id_, StarManager::get_star_count(transaction->stars_, true), transaction->refund_, transaction->id_, StarManager::get_star_count(transaction->stars_, true), transaction->refund_,
transaction->date_, std::move(source))); transaction->date_, std::move(partner)));
} }
promise_.set_value(td_api::make_object<td_api::starTransactions>( promise_.set_value(td_api::make_object<td_api::starTransactions>(