diff options
Diffstat (limited to 'include/hearthstoneAPIHandler.h')
| -rw-r--r-- | include/hearthstoneAPIHandler.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/hearthstoneAPIHandler.h b/include/hearthstoneAPIHandler.h new file mode 100644 index 0000000..718b98c --- /dev/null +++ b/include/hearthstoneAPIHandler.h @@ -0,0 +1,29 @@ +#pragma once +#include <chrono> +#include <string> + +class HearthstoneAPIHandler { + public: + HearthstoneAPIHandler(); + void get_cards(const std::string &t_card_parameters); + + private: + static size_t curl_callback_token_request(void *t_contents, size_t t_size, + size_t t_nmemb, std::string *t_s); + std::chrono::hours 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 &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); + void make_api_request(const char *t_url, const char *t_header); + void make_api_request(const std::string &t_url, + const std::string &t_header); + + std::string m_access_token; + std::string m_header; +}; |
