From 15de61ad9fead748287537cdcc11fc82683a09ef Mon Sep 17 00:00:00 2001 From: Aotrix <9aotrix@protonmail.com> Date: Sun, 25 Jan 2026 01:52:23 +0100 Subject: Added JSON support for token generation --- battleNetApi/include/token.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'battleNetApi/include') diff --git a/battleNetApi/include/token.hpp b/battleNetApi/include/token.hpp index f529a08..34c6d3e 100644 --- a/battleNetApi/include/token.hpp +++ b/battleNetApi/include/token.hpp @@ -3,8 +3,8 @@ class Token { public: - Token(const std::string &iTokenFilePath, const std::string &iUsername, const std::string &iPassword); - std::string toString() const; + Token(const std::string &iTokenFilePath); + std::string text() const; private: const std::string mFilePath; //!< Path to the token file @@ -16,13 +16,12 @@ class Token { * @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(); + std::string generateToken(); const bool hasTokenExpired() const; - std::string writeNewTokenToLocalFile() const; + void writeNewTokenToLocalFile(const std::string &iTokenContent) 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); friend class TokenTests; -- cgit v1.2.3