From 3baa8fa322dbc8f2a2183e8ac027387c75eb9180 Mon Sep 17 00:00:00 2001 From: Aotrix <9aotrix@protonmail.com> Date: Sat, 1 Nov 2025 19:04:16 +0100 Subject: added Token class --- subprojects/battleNetApi/include/token.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 subprojects/battleNetApi/include/token.hpp (limited to 'subprojects/battleNetApi/include/token.hpp') 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 +#include + +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; +}; -- cgit v1.2.3