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/src/token.cpp | |
| parent | 2c286a812a3bdaa2531e8f87f5503988bb331a78 (diff) | |
Add tests for HearthstoneTokenBuilder
Diffstat (limited to 'battleNetApi/src/token.cpp')
| -rw-r--r-- | battleNetApi/src/token.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/battleNetApi/src/token.cpp b/battleNetApi/src/token.cpp index 276c334..a54136c 100644 --- a/battleNetApi/src/token.cpp +++ b/battleNetApi/src/token.cpp @@ -1,14 +1,26 @@ #include "token.hpp" -Token::Token(const std::string &iTokenText, const std::chrono::seconds &iLifetime) - : _tokenText{iTokenText}, _expirationTime{iLifetime + currentTime()} {} +namespace bnet { +Token::Token() {} -std::string Token::text() const { return _tokenText; } +std::optional<TokenText> Token::text() const { return _tokenText; } -void Token::setText(const std::string &iTokenText) { _tokenText = iTokenText; } +std::optional<std::chrono::seconds> Token::expirationTime() const { return _expirationTime; } -void Token::setLifetime(const std::chrono::seconds &iExpirationTime) { - _expirationTime = iExpirationTime + currentTime(); +Token &Token::setText(const TokenText &iTokenText) { + _tokenText = iTokenText; + return *this; +} + +Token &Token::setLifetime(const std::chrono::seconds &iLifetime) { + _expirationTime = iLifetime + currentTime(); + return *this; +} + +Token &Token::setExpirationTime(const std::chrono::seconds &iExpirationTime) { + _expirationTime = iExpirationTime; + return *this; } bool Token::isExpired() { return _expirationTime <= currentTime(); } +} // namespace bnet |
