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 /td/telegram/StarGiftAuctionRound.cpp | |
| parent | 5ca89cf68cd9ad31a8fa42f9b870863962e49a6a (diff) | |
Add td_api::auctionRound.
Diffstat (limited to 'td/telegram/StarGiftAuctionRound.cpp')
| -rw-r--r-- | td/telegram/StarGiftAuctionRound.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
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 |
