Add starTransaction.product_info.

This commit is contained in:
levlam 2024-05-24 13:53:20 +03:00
parent c4ef2bbf91
commit 95e4a4f6d9
2 changed files with 10 additions and 3 deletions

View File

@ -876,7 +876,8 @@ starTransactionSourceUnsupported = StarTransactionSource;
//@star_count The amount of added owned Telegram stars; negative for outgoing transactions
//@date Point in time (Unix timestamp) when the transaction was completed
//@source Source of the transaction, or its recipient for outgoing transactions
starTransaction id:string star_count:int53 date:int32 source:StarTransactionSource = StarTransaction;
//@product_info Information about the product; may be null if unknown
starTransaction id:string star_count:int53 date:int32 source:StarTransactionSource product_info:productInfo = StarTransaction;
//@description Represents a list of Telegram star transactions
//@star_count The amount of owned Telegram stars

View File

@ -17,6 +17,7 @@
#include "td/telegram/DocumentsManager.h"
#include "td/telegram/GiveawayParameters.h"
#include "td/telegram/Global.h"
#include "td/telegram/InputInvoice.h"
#include "td/telegram/MessageEntity.h"
#include "td/telegram/MessageId.h"
#include "td/telegram/MessageSender.h"
@ -704,8 +705,13 @@ class GetStarsTransactionsQuery final : public Td::ResultHandler {
UNREACHABLE();
}
}();
transactions.push_back(td_api::make_object<td_api::starTransaction>(transaction->id_, transaction->stars_,
transaction->date_, std::move(source)));
td_api::object_ptr<td_api::productInfo> product_info;
if (!transaction->title_.empty() || !transaction->description_.empty() || transaction->photo_ != nullptr) {
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);
}
transactions.push_back(td_api::make_object<td_api::starTransaction>(
transaction->id_, transaction->stars_, transaction->date_, std::move(source), std::move(product_info)));
}
promise_.set_value(