#pragma once #include #include #include "PokemonCard.h" /** @brief direct api access class */ class PokemonTCGAPIClient { public: PokemonTCGAPIClient(); virtual ~PokemonTCGAPIClient(); private: const char* API_URL = "https://api.pokemontcg.io/v2"; /** * @brief send http(s) GET request to `endpoint` with `params` and return the * response as parsed JSON */ virtual nlohmann::json raw_request(const char* endpoint, cpr::Parameters params); /** @brief get minimal card info for parsing into card (no trading value) */ virtual nlohmann::json raw_get_cards(const char* query); /** @brief get full card info by card id */ virtual nlohmann::json raw_get_card(const char* id); /** @brief get list of valid sets */ virtual nlohmann::json raw_get_sets(const char* query); public: /** @brief get list of cards that contain `query` in name or id field */ virtual std::vector get_cards_by_query(const char* query); /** @brief get list of cards in set */ virtual std::vector get_set_cards(const char* set_name); /** @brief get full card info by card id */ virtual PokemonCard* get_full_card(const char* id); /** @brief get list of valid sets */ virtual std::vector get_sets(); };