aboutsummaryrefslogtreecommitdiff
path: root/oop2eindopdr/PokemonTCGAPIClient.h
blob: cbbcf0d8e993f97acecfdf23da04bb173a3febb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once

#include <nlohmann/json.hpp>
#include <cpr/cpr.h>

#include "PokemonCard.h"

/** @brief direct api access class */
class PokemonTCGAPIClient {
public:
	PokemonTCGAPIClient();
	virtual ~PokemonTCGAPIClient();

private:
	const char* API_URL = "https://api.pokemontcg.io/v2";
	virtual nlohmann::json raw_request(const char* endpoint, cpr::Parameters params);
	virtual nlohmann::json raw_get_cards(const char* query);
	virtual nlohmann::json raw_get_card(const char* id);
	virtual nlohmann::json raw_get_sets(const char* query);

public:
	virtual std::vector<PokemonCard*> get_cards_by_query(const char* query);
	virtual std::vector<PokemonCard*> get_set_cards(const char* set_name);
	virtual PokemonCard* get_full_card(const char* id);
	virtual std::vector<std::string> get_sets();
};