summaryrefslogtreecommitdiff
path: root/battleNetApi/include/hearthstoneTokenBuilder.hpp
diff options
context:
space:
mode:
authorAotrix <[email protected]>2026-08-30 15:58:35 +0200
committerAotrix <[email protected]>2026-08-30 15:58:35 +0200
commitc31ccb5b03d4562fb91cc5672b82767ead0e26b8 (patch)
tree26e6fbcd991fd9808e207292029f56ff63f369b3 /battleNetApi/include/hearthstoneTokenBuilder.hpp
parentd7d8408a7ba5bf079c2a7378f8cb170a2359af8e (diff)
Fix CMakeLists.txt missing cpp file
Diffstat (limited to 'battleNetApi/include/hearthstoneTokenBuilder.hpp')
-rw-r--r--battleNetApi/include/hearthstoneTokenBuilder.hpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/battleNetApi/include/hearthstoneTokenBuilder.hpp b/battleNetApi/include/hearthstoneTokenBuilder.hpp
index 571554f..880d64d 100644
--- a/battleNetApi/include/hearthstoneTokenBuilder.hpp
+++ b/battleNetApi/include/hearthstoneTokenBuilder.hpp
@@ -6,12 +6,14 @@
#include <tokenBuilder.hpp>
#include <vector>
-namespace bnet {
+namespace bnet
+{
using nlohmann::json;
static constexpr std::uint64_t kTOKEN_CONTENT_MIN_LENGTH{10};
-class HearthstoneTokenBuilder : TokenBuilder {
+class HearthstoneTokenBuilder : TokenBuilder
+{
private:
std::shared_ptr<Token> _currentToken;
bool _allowBattleNetApiCall{false};
@@ -21,38 +23,46 @@ class HearthstoneTokenBuilder : TokenBuilder {
[[nodiscard]]
bool isUpdateSourceFileAllowed() const;
[[nodiscard]]
- bool isTokenValid(const json &iTokenJson) const;
- static size_t curlCallbackStringOutput(void *iPtr, size_t iSize, size_t iNmemb,
- std::string *iUserData);
+ bool isTokenValid(const json& iTokenJson) const;
+ static size_t curlCallbackStringOutput(void* iPtr,
+ size_t iSize,
+ size_t iNmemb,
+ std::string* iUserData);
[[nodiscard]]
std::chrono::seconds getCurrentTime() const;
[[nodiscard]]
- Token getTokenWithApi(const std::string &iCredentialsJsonFilePath) const;
+ Token getTokenWithApi(const std::string& iCredentialsJsonFilePath) const;
[[nodiscard]]
- Token getTokenWithApi(const json &iCredentials) const;
- void writeTokenToLocalFile(std::shared_ptr<Token> &iToken,
- const std::string &iTokenFileOutputPath) const;
+ Token getTokenWithApi(const json& iCredentials) const;
+ void writeTokenToLocalFile(std::shared_ptr<Token>& iToken,
+ const std::string& iTokenFileOutputPath) const;
public:
- HearthstoneTokenBuilder(const std::span<std::string> &iJsonPaths);
+ HearthstoneTokenBuilder(const std::span<std::string>& iJsonPaths);
+
template <typename... CredentialJsonPaths>
- HearthstoneTokenBuilder(CredentialJsonPaths... iCredentialJsonPaths) {
+ HearthstoneTokenBuilder(CredentialJsonPaths... iCredentialJsonPaths)
+ {
(_credentialJsonPaths.push_back(iCredentialJsonPaths), ...);
}
+
template <typename... CredentialJsonPaths>
- HearthstoneTokenBuilder &addCredentialJsonFiles(CredentialJsonPaths... iCredentialJsonPaths) {
+ HearthstoneTokenBuilder& addCredentialJsonFiles(CredentialJsonPaths... iCredentialJsonPaths)
+ {
(_credentialJsonPaths.push_back(iCredentialJsonPaths), ...);
+ return *this;
}
- HearthstoneTokenBuilder &allowBattleNetApiCall();
- HearthstoneTokenBuilder &allowUpdateSourceFile();
- HearthstoneTokenBuilder &allowExpiredToken();
+
+ HearthstoneTokenBuilder& allowBattleNetApiCall();
+ HearthstoneTokenBuilder& allowUpdateSourceFile();
+ HearthstoneTokenBuilder& allowExpiredToken();
/**
* @return Create an access token to perform API requests.
* First, the cache files are checked. (Which ones?)
* A new token is computed if the token lifetimes expired,
* or if there is no token at all.
*/
- HearthstoneTokenBuilder &buildToken() override;
+ HearthstoneTokenBuilder& buildToken() override;
[[nodiscard]]
std::shared_ptr<Token> getToken() override;
};