From 1fbfd13f5d7220122b2a127627cc9105013b4893 Mon Sep 17 00:00:00 2001 From: Aotrix <9aotrix@protonmail.com> Date: Wed, 29 Jul 2026 18:31:43 +0200 Subject: Add tests for HearthstoneTokenBuilder --- battleNetApi/include/token.hpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'battleNetApi/include/token.hpp') diff --git a/battleNetApi/include/token.hpp b/battleNetApi/include/token.hpp index 4a66c53..f943b81 100644 --- a/battleNetApi/include/token.hpp +++ b/battleNetApi/include/token.hpp @@ -3,16 +3,21 @@ #include #include +namespace bnet { +using TokenText = std::string; + class Token { public: - explicit Token(const std::string &iTokenText, const std::chrono::seconds &iLifetime); - std::string text() const; - void setText(const std::string &iTokenText); - void setLifetime(const std::chrono::seconds &iLifetime); + explicit Token(); + std::optional text() const; + std::optional expirationTime() const; + Token &setText(const TokenText &iTokenText); + Token &setLifetime(const std::chrono::seconds &iLifetime); + Token &setExpirationTime(const std::chrono::seconds &iExpirationTime); bool isExpired(); private: - std::string _tokenText; + std::optional _tokenText; std::chrono::seconds _expirationTime; }; @@ -22,3 +27,4 @@ auto currentTime = [] { std::chrono::steady_clock::now().time_since_epoch()); }; } // namespace +} // namespace bnet -- cgit v1.2.3