diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/hearthstoneAPIHandler.hpp | 29 | ||||
| -rw-r--r-- | include/postgresHandler.hpp | 12 |
2 files changed, 4 insertions, 37 deletions
diff --git a/include/hearthstoneAPIHandler.hpp b/include/hearthstoneAPIHandler.hpp deleted file mode 100644 index 9d5ec58..0000000 --- a/include/hearthstoneAPIHandler.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include <chrono> -#include <string> - -class HearthstoneAPIHandler { - public: - HearthstoneAPIHandler(); - std::string get_cards(const std::string &t_card_parameters); - - private: - static size_t curl_callback_string_output(void *t_contents, size_t t_size, - size_t t_nmemb, std::string *t_s); - std::chrono::seconds get_current_time(); - std::string extract_string_with_regex(const std::string &t_str, - const std::string t_regex); - void write_new_token_info_to_file(const std::string &t_file_path); - void refresh_token_if_needed(); - std::string get_valid_token(); - std::string generate_request_header(); - const std::string get_url(const std::string &t_parameters); - const std::string - get_set_of_cards_url(const std::string &t_card_parameters); - std::string make_api_request(const char *t_url, const char *t_header); - std::string make_api_request(const std::string &t_url, - const std::string &t_header); - - std::string m_access_token; - std::string m_header; -}; diff --git a/include/postgresHandler.hpp b/include/postgresHandler.hpp index 2c3f6f4..444a50f 100644 --- a/include/postgresHandler.hpp +++ b/include/postgresHandler.hpp @@ -1,5 +1,5 @@ #pragma once -#include "hearthstoneAPIHandler.hpp" +#include "hearthstoneAPI.hpp" #include <pqxx/pqxx> #include <regex> @@ -10,8 +10,7 @@ * @param aQuery The SQL query * @return The result of the executed SQL query */ -const pqxx::result executeQuery(pqxx::work &aTransaction, - std::string_view aQuery); +const pqxx::result executeQuery(pqxx::work &aTransaction, std::string_view aQuery); /** * Get the type id of the value element in the "key": value regex match @@ -21,16 +20,13 @@ const pqxx::result executeQuery(pqxx::work &aTransaction, * @param kSregexIt the regex match for a "key": value card information * @return the type identifier of the value element */ -const unsigned int -getTypeIndexOfRegexIterator(const std::sregex_iterator &kSregexIt); +const unsigned int getTypeIndexOfRegexIterator(const std::sregex_iterator &kSregexIt); /** * Add a list of cards (TODO: Complete documentation and function) * * @param kCards * @param aTransaction */ -void addCardsToDatabase(HearthstoneAPIHandler &aAPIIntermediate, - pqxx::work &aTransaction, - const std::string &kURLOfCardsPage); +void addCardsToDatabase(HearthstoneAPI &aAPIIntermediate, pqxx::work &aTransaction, const std::string &kURLOfCardsPage); void refresh_cards_table(); |
