diff options
| author | Aotrix <[email protected]> | 2025-11-01 19:04:16 +0100 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2025-11-01 19:04:16 +0100 |
| commit | 3baa8fa322dbc8f2a2183e8ac027387c75eb9180 (patch) | |
| tree | e70c83e40d762d34451353efedd6413af8e3bc5c /subprojects/battleNetApi/include/token.hpp | |
| parent | db533729ce52c9c7a5d1de5393426c0f76de3693 (diff) | |
added Token class
Diffstat (limited to 'subprojects/battleNetApi/include/token.hpp')
| -rw-r--r-- | subprojects/battleNetApi/include/token.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/subprojects/battleNetApi/include/token.hpp b/subprojects/battleNetApi/include/token.hpp new file mode 100644 index 0000000..9c1eb18 --- /dev/null +++ b/subprojects/battleNetApi/include/token.hpp @@ -0,0 +1,21 @@ +#include <chrono> +#include <string> + +class Token { + public: + Token(const std::string &iTokenFilePath); + std::string getValidToken() const; + + private: + std::string mFilePath; //!< Path to the token file + + void refreshToken() const; + void writeNewTokenToFile() const; + void writeTokenToFile(const std::string &iToken) const; + std::string getValidTokenWithApi() const; + std::chrono::seconds getCurrentTime() const; + std::string extractFirstMatchRegex(const std::string &t_str, const std::string &t_regex) const; + static size_t curlCallbackStringOutput(void *t_contents, size_t t_size, size_t t_nmemb, std::string *t_s); + + friend class TokenTests; +}; |
