diff options
| author | Aotrix <[email protected]> | 2026-07-29 18:31:43 +0200 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2026-07-29 18:31:43 +0200 |
| commit | 1fbfd13f5d7220122b2a127627cc9105013b4893 (patch) | |
| tree | 0ca51f463996ea96eddc5b8939c07d3ef207a311 /battleNetApi/include/token.hpp | |
| parent | 2c286a812a3bdaa2531e8f87f5503988bb331a78 (diff) | |
Add tests for HearthstoneTokenBuilder
Diffstat (limited to 'battleNetApi/include/token.hpp')
| -rw-r--r-- | battleNetApi/include/token.hpp | 16 |
1 files changed, 11 insertions, 5 deletions
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 <chrono> #include <string> +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<std::string> text() const; + std::optional<std::chrono::seconds> 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> _tokenText; std::chrono::seconds _expirationTime; }; @@ -22,3 +27,4 @@ auto currentTime = [] { std::chrono::steady_clock::now().time_since_epoch()); }; } // namespace +} // namespace bnet |
