diff options
| author | Aotrix <[email protected]> | 2026-01-01 03:35:41 +0100 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2026-01-01 03:35:41 +0100 |
| commit | c05901c38c6a77779807a6b224b9b624bfcaa5d3 (patch) | |
| tree | fb8d212cd9995e4eecd351de352ea6aab2295924 /submodules/battleNetApi/include/hearthstoneApi.hpp | |
| parent | a56ae1a7ad5f624b05570965bed76e928bbd945c (diff) | |
removed useless files
Diffstat (limited to 'submodules/battleNetApi/include/hearthstoneApi.hpp')
| -rw-r--r-- | submodules/battleNetApi/include/hearthstoneApi.hpp | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/submodules/battleNetApi/include/hearthstoneApi.hpp b/submodules/battleNetApi/include/hearthstoneApi.hpp deleted file mode 100644 index c11acc7..0000000 --- a/submodules/battleNetApi/include/hearthstoneApi.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once -#include "token.hpp" -#include <iostream> -#include <regex> -#include <string> - -class HearthstoneApi { - public: - HearthstoneApi(Token &&iToken); - std::uint64_t numberOfCards(const std::string &iApiResponse) const; - - private: - std::string authorizationHeader(); - std::string makeApiRequest(const std::string &iUrl) const; - static size_t curlCallbackStringOutput(void *iContent, size_t iSize, size_t iNmemb, std::string *iS); - - /** - * @brief - * @param[in] iJsonContent The std::string which contains Json (Battle.net API response for instance) - * @param[in] iKeyValueRegex The regex used to retrieve value from (key, value) pair - * An example: "\"cardCount\":(\\d+)" - */ - template <typename T> T valueInJson(const std::string &iJsonContent, const std::string &iKeyValueRegex) const { - const std::regex iRegex{iKeyValueRegex}; - std::smatch aMatches; - if (std::regex_search(iJsonContent, aMatches, iRegex)) { - const std::string kValueString{aMatches[1].str()}; - T aValue; - const auto kConversionStatus = - std::from_chars(kValueString.data(), kValueString.data() + kValueString.size(), aValue); - if (kConversionStatus.ec == std::errc{}) { - return aValue; - } - } - std::cerr << std::format("Unable to find value with regex: '{}'\n", iKeyValueRegex); - return 0; - } - - Token mToken; - std::string mAuthorizationHeader; //<! Bearer authorization string for OAuth 2.0 header - - friend class HearthstoneApiMock; -}; |
