diff options
| author | Aotrix <[email protected]> | 2026-01-04 17:38:51 +0100 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2026-01-04 17:38:51 +0100 |
| commit | 06109ce40a8b8a9eecf359a006e06227200e768b (patch) | |
| tree | d3ba493e887f61413a012d1e030e5ccb7b3a92e2 /battleNetApi/include | |
| parent | 89f360d5b14d183ae4f131852ad15fdbd080cc47 (diff) | |
Refactoring of Token class
Diffstat (limited to 'battleNetApi/include')
| -rw-r--r-- | battleNetApi/include/token.hpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/battleNetApi/include/token.hpp b/battleNetApi/include/token.hpp index e2e3088..f529a08 100644 --- a/battleNetApi/include/token.hpp +++ b/battleNetApi/include/token.hpp @@ -10,13 +10,17 @@ class Token { const std::string mFilePath; //!< Path to the token file const std::string mUsername; //!< Username for Battle.net API const std::string mPassword; //!< Password for Battle.net API - const std::string mToken; //!< Token value + std::string mToken; //!< Token value - std::string getValidToken() const; - void refreshToken() const; - void writeNewTokenToFile() const; - void writeTokenToFile(const std::string &iToken) const; - std::string getValidTokenWithApi() const; + /** + * @return A token that a user can use to perform API requests. + * A new token might be computed if the current token lifetime expired. + */ + std::string getValidToken(); + const bool hasTokenExpired() const; + std::string writeNewTokenToLocalFile() const; + std::string getTokenFromLocalFile() const; + std::string getTokenWithApi() const; std::chrono::seconds getCurrentTime() const; std::string extractTokenWithRegex(const std::string &iText, const std::string &iRegex) const; static size_t curlCallbackStringOutput(void *iPtr, size_t iSize, size_t iNmemb, std::string *iUserData); |
