diff options
| author | levlam <levlam@telegram.org> | 2025-12-05 08:17:18 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2025-12-05 08:17:18 +0300 |
| commit | 183c8f1935c9b98652a96b1cd4b352b7192fca4e (patch) | |
| tree | 77e465ac8642443ec5f986958d5f20d10f3a9abf | |
| parent | 5ca89cf68cd9ad31a8fa42f9b870863962e49a6a (diff) | |
Add td_api::auctionRound.
| -rw-r--r-- | CMakeLists.txt | 2 | ||||
| -rw-r--r-- | SplitSource.php | 1 | ||||
| -rw-r--r-- | td/generate/scheme/td_api.tl | 7 | ||||
| -rw-r--r-- | td/telegram/StarGiftAuctionRound.cpp | 43 | ||||
| -rw-r--r-- | td/telegram/StarGiftAuctionRound.h | 38 |
5 files changed, 91 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b035a387b..353eafa19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -611,6 +611,7 @@ set(TDLIB_SOURCE_PART2 td/telegram/StarGift.cpp td/telegram/StarGiftAttribute.cpp td/telegram/StarGiftAttributeId.cpp + td/telegram/StarGiftAuctionRound.cpp td/telegram/StarGiftAuctionState.cpp td/telegram/StarGiftAuctionUserState.cpp td/telegram/StarGiftBackground.cpp @@ -1018,6 +1019,7 @@ set(TDLIB_SOURCE_PART2 td/telegram/StarGift.h td/telegram/StarGiftAttribute.h td/telegram/StarGiftAttributeId.h + td/telegram/StarGiftAuctionRound.h td/telegram/StarGiftAuctionState.h td/telegram/StarGiftAuctionUserState.h td/telegram/StarGiftBackground.h diff --git a/SplitSource.php b/SplitSource.php index 45c67b821..9bb6c43b2 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -430,6 +430,7 @@ function split_file($file, $chunks, $undo) { 'StarGift[^A-Z]' => 'StarGift', 'StarGiftAttribute[^I]' => 'StarGiftAttribute', 'StarGiftAttributeId' => 'StarGiftAttributeId', + 'StarGiftAuctionRound' => 'StarGiftAuctionRound', 'StarGiftAuctionState' => 'StarGiftAuctionState', 'StarGiftAuctionUserState' => 'StarGiftAuctionUserState', 'StarGiftBackground' => 'StarGiftBackground', diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 92071831a..f64d25da0 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1527,6 +1527,13 @@ auctionBid star_count:int53 bid_date:int32 position:int32 = AuctionBid; //@was_returned True, if the bid was returned to the user, because it was outbid and can't win anymore userAuctionBid star_count:int53 bid_date:int32 next_bid_star_count:int53 owner_id:MessageSender was_returned:Bool = UserAuctionBid; +//@description Describes a round of an auction +//@number 1-based number of the round +//@duration Duration of the round, in seconds +//@extend_time The number of seconds for which the round will be extended if there will be changes in the top winners +//@top_winner_count The number of top winners who trigger round extension if changed +auctionRound number:int32 duration:int32 extend_time:int32 top_winner_count:int32 = AuctionRound; + //@class AuctionState @description Describes state of an auction diff --git a/td/telegram/StarGiftAuctionRound.cpp b/td/telegram/StarGiftAuctionRound.cpp new file mode 100644 index 000000000..adb5e7067 --- /dev/null +++ b/td/telegram/StarGiftAuctionRound.cpp @@ -0,0 +1,43 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2025 +// +// 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) +// +#include "td/telegram/StarGiftAuctionRound.h" + +namespace td { + +StarGiftAuctionRound::StarGiftAuctionRound( + const telegram_api::object_ptr<telegram_api::StarGiftAuctionRound> &&round_ptr) { + CHECK(round_ptr != nullptr); + switch (round_ptr->get_id()) { + case telegram_api::starGiftAuctionRound::ID: { + auto *round = static_cast<const telegram_api::starGiftAuctionRound *>(round_ptr.get()); + num_ = round->num_; + duration_ = round->duration_; + break; + } + case telegram_api::starGiftAuctionRoundExtendable::ID: { + auto *round = static_cast<const telegram_api::starGiftAuctionRoundExtendable *>(round_ptr.get()); + num_ = round->num_; + duration_ = round->duration_; + extend_top_ = round->extend_top_; + extend_window_ = round->extend_window_; + break; + } + default: + UNREACHABLE(); + } +} + +td_api::object_ptr<td_api::auctionRound> StarGiftAuctionRound::get_auction_round_object() const { + return td_api::make_object<td_api::auctionRound>(num_, duration_, extend_window_, extend_top_); +} + +bool operator==(const StarGiftAuctionRound &lhs, const StarGiftAuctionRound &rhs) { + return lhs.num_ == rhs.num_ && lhs.duration_ == rhs.duration_ && lhs.extend_window_ == rhs.extend_window_ && + lhs.extend_top_ == rhs.extend_top_; +} + +} // namespace td diff --git a/td/telegram/StarGiftAuctionRound.h b/td/telegram/StarGiftAuctionRound.h new file mode 100644 index 000000000..96187a5b3 --- /dev/null +++ b/td/telegram/StarGiftAuctionRound.h @@ -0,0 +1,38 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2025 +// +// 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 + +#include "td/telegram/td_api.h" +#include "td/telegram/telegram_api.h" + +#include "td/utils/common.h" + +namespace td { + +class StarGiftAuctionRound { + int32 num_ = 0; + int32 duration_ = 0; + int32 extend_top_ = 0; + int32 extend_window_ = 0; + + friend bool operator==(const StarGiftAuctionRound &lhs, const StarGiftAuctionRound &rhs); + + public: + StarGiftAuctionRound() = default; + + explicit StarGiftAuctionRound(const telegram_api::object_ptr<telegram_api::StarGiftAuctionRound> &&round_ptr); + + td_api::object_ptr<td_api::auctionRound> get_auction_round_object() const; +}; + +bool operator==(const StarGiftAuctionRound &lhs, const StarGiftAuctionRound &rhs); + +inline bool operator!=(const StarGiftAuctionRound &lhs, const StarGiftAuctionRound &rhs) { + return !(lhs == rhs); +} + +} // namespace td |
