31 #ifndef LEDGER_CORE_HTTPJSONHANDLER_HPP 32 #define LEDGER_CORE_HTTPJSONHANDLER_HPP 34 #include <rapidjson/reader.h> 35 #include "HttpClient.hpp" 36 #include "../utils/Either.hpp" 40 template <
typename Success,
typename Failure,
class Handler>
41 class HttpJsonHandler :
public rapidjson::BaseReaderHandler<rapidjson::UTF8<>, Handler> {
46 Either<Failure, Success> build() {
47 throw std::exception();
50 std::string getStatusText()
const {
51 return _connection->getStatusText();
53 int32_t getStatusCode()
const {
54 return _connection->getStatusCode();
56 std::unordered_map<std::string, std::string> getHttpHeaders()
const {
57 return _connection->getHeaders();
59 void attach(
const std::shared_ptr<api::HttpUrlConnection>& connection)
const {
60 _connection = connection;
64 mutable std::shared_ptr<api::HttpUrlConnection> _connection;
70 #endif //LEDGER_CORE_HTTPJSONHANDLER_HPP Definition: Account.cpp:8