summaryrefslogtreecommitdiff
path: root/battleNetApi/include/token.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'battleNetApi/include/token.hpp')
-rw-r--r--battleNetApi/include/token.hpp16
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