blob: c3fbfac82cd9d99daebb92c00b216f89e64d8bfd (
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
|
#pragma once
#include "token.hpp"
#include <apiUrl.hpp>
#include <nlohmann/json.hpp>
#include <string>
using json = nlohmann::json;
class HearthstoneApi {
public:
HearthstoneApi(const Token &iToken);
HearthstoneApi(Token &&iToken);
json makeApiRequest(const std::string &iUrl) const;
std::vector<json> makeApiRequest(const std::vector<std::string> &iUrls) const;
void downloadAllCards(ApiUrl &iApiUrl, const std::string &iOutputJsonPath) const;
private:
std::string authorizationHeader() const;
static size_t curlCallbackStringOutput(void *iContent, size_t iSize, size_t iNmemb, std::string *iS);
Token mToken;
std::string mAuthorizationHeader; //<! Bearer authorization string for OAuth 2.0 header
friend class HearthstoneApiMock;
};
|