summaryrefslogtreecommitdiff
path: root/submodules/battleNetApi/include/token.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'submodules/battleNetApi/include/token.hpp')
-rw-r--r--submodules/battleNetApi/include/token.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/submodules/battleNetApi/include/token.hpp b/submodules/battleNetApi/include/token.hpp
new file mode 100644
index 0000000..e2e3088
--- /dev/null
+++ b/submodules/battleNetApi/include/token.hpp
@@ -0,0 +1,25 @@
+#include <chrono>
+#include <string>
+
+class Token {
+ public:
+ Token(const std::string &iTokenFilePath, const std::string &iUsername, const std::string &iPassword);
+ std::string toString() const;
+
+ private:
+ 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 getValidToken() const;
+ void refreshToken() const;
+ void writeNewTokenToFile() const;
+ void writeTokenToFile(const std::string &iToken) const;
+ std::string getValidTokenWithApi() 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);
+
+ friend class TokenTests;
+};