diff options
author | George Hazan <george.hazan@gmail.com> | 2024-09-29 19:03:55 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-09-29 19:04:03 +0300 |
commit | cebfc5c8facbf6ae335499f7f4b3dc57a60af999 (patch) | |
tree | 4c39e613c87f6164df1fe80601e611987aaaec84 /protocols/Telegram/tdlib/td/td/telegram/StarSubscription.h | |
parent | 189164bebda4bca9bb3d672500d844bfe7f26517 (diff) |
TDLIB update up to the current state
Diffstat (limited to 'protocols/Telegram/tdlib/td/td/telegram/StarSubscription.h')
-rw-r--r-- | protocols/Telegram/tdlib/td/td/telegram/StarSubscription.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/protocols/Telegram/tdlib/td/td/telegram/StarSubscription.h b/protocols/Telegram/tdlib/td/td/telegram/StarSubscription.h new file mode 100644 index 0000000000..5238cce3f7 --- /dev/null +++ b/protocols/Telegram/tdlib/td/td/telegram/StarSubscription.h @@ -0,0 +1,47 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024 +// +// 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/DialogId.h" +#include "td/telegram/StarSubscriptionPricing.h" +#include "td/telegram/td_api.h" +#include "td/telegram/telegram_api.h" + +#include "td/utils/common.h" +#include "td/utils/StringBuilder.h" + +namespace td { + +class Td; + +class StarSubscription { + string id_; + DialogId dialog_id_; + int32 until_date_ = 0; + bool can_reuse_ = false; + bool is_canceled_ = false; + bool missing_balance_ = false; + string invite_hash_; + StarSubscriptionPricing pricing_; + + friend StringBuilder &operator<<(StringBuilder &string_builder, const StarSubscription &subscription); + + public: + StarSubscription() = default; + + explicit StarSubscription(telegram_api::object_ptr<telegram_api::starsSubscription> &&subscription); + + bool is_valid() const { + return !id_.empty() && dialog_id_.is_valid() && until_date_ >= 0 && !pricing_.is_empty(); + } + + td_api::object_ptr<td_api::starSubscription> get_star_subscription_object(Td *td) const; +}; + +StringBuilder &operator<<(StringBuilder &string_builder, const StarSubscription &subscription); + +} // namespace td |