summaryrefslogtreecommitdiff
path: root/battleNetApi/include/token.hpp
diff options
context:
space:
mode:
authorAotrix <[email protected]>2026-04-28 03:49:41 +0200
committerAotrix <[email protected]>2026-04-28 03:49:41 +0200
commita0632d299b85dc4ef7c0e03898f38e6deca0edc2 (patch)
treecc83712ca644e8b5d1b9e1c0c49bdbdd8475d0a9 /battleNetApi/include/token.hpp
parent5582e994d39b16a6d61f05b13e78c30f4bac5d84 (diff)
add HearthstoneTokenBuilder class
Diffstat (limited to 'battleNetApi/include/token.hpp')
-rw-r--r--battleNetApi/include/token.hpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/battleNetApi/include/token.hpp b/battleNetApi/include/token.hpp
index b913b2b..cc909a8 100644
--- a/battleNetApi/include/token.hpp
+++ b/battleNetApi/include/token.hpp
@@ -1,32 +1,13 @@
#pragma once
-#include <chrono>
#include <string>
class Token {
public:
- explicit Token(const std::string &iTokenFilePath);
+ explicit Token(const std::string &iTokenText);
std::string text() const;
- const bool hasExpired() const;
+ void setText(const std::string &iTokenText);
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
- std::string mToken; //!< Token value
-
- /**
- * @return An access token that a user can use to perform API requests.
- * First, the cache file is checked.
- * A new token is computed if the current token lifetime expired,
- * or if there is no token at all.
- */
- std::string generateToken();
- void writeTokenToLocalFile(const std::pair<std::string, std::uint64_t> &iToken) const;
- std::string getTokenFromLocalFile() const;
- std::pair<std::string, std::uint64_t> getTokenWithApi() const;
- std::chrono::seconds getCurrentTime() const;
- static size_t curlCallbackStringOutput(void *iPtr, size_t iSize, size_t iNmemb, std::string *iUserData);
-
- static const std::uint16_t kTokenContentMinLength{10};
+ std::string mTokenText; //!< Token value
};