From 44428f1f9aea1c84307a9bfd3d86e95ae36cc332 Mon Sep 17 00:00:00 2001 From: Tim Coelho Date: Thu, 9 Sep 2021 02:51:40 -0400 Subject: [PATCH] Refactored enums to resolve compilation error in Windows for msvc (DELETE already defined in winnt.h) --- src/accounts/accounts.cpp | 8 ++++---- src/orders/orders.cpp | 12 ++++++------ src/util/httpclient.cpp | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/accounts/accounts.cpp b/src/accounts/accounts.cpp index d465720..75ac0df 100644 --- a/src/accounts/accounts.cpp +++ b/src/accounts/accounts.cpp @@ -10,7 +10,7 @@ namespace accounts { std::string target = "/accounts/"; target += accountId; target += "/ledger"; - auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::GET); + auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::E_GET); std::vector entries; for (const auto &item : resp) { @@ -25,7 +25,7 @@ namespace accounts { const auto &httpClient = auth.getHttpClientPtr(); std::string target = "/accounts"; - auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::GET); + auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::E_GET); std::vector accounts; for (const auto &item : resp) { @@ -40,7 +40,7 @@ namespace accounts { const auto &httpClient = auth.getHttpClientPtr(); std::string target = "/accounts/"; target += accountId; - auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::GET); + auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::E_GET); responses::account account(resp); return account; @@ -52,7 +52,7 @@ namespace accounts { std::string target = "/accounts/"; target += accountId; target += "/holds"; - auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::GET); + auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::E_GET); std::vector holds; for (const auto &item : resp) { diff --git a/src/orders/orders.cpp b/src/orders/orders.cpp index 48a4467..dbb4fc7 100644 --- a/src/orders/orders.cpp +++ b/src/orders/orders.cpp @@ -19,7 +19,7 @@ namespace orders { target += productId; } - auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::DELETE); + auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::E_DELETE); return !resp.get_optional("error"); } @@ -34,7 +34,7 @@ namespace orders { } std::vector orders; - auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::DELETE); + auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::E_DELETE); for (auto &order : resp) { orders.push_back(order.second.data()); } @@ -89,7 +89,7 @@ namespace orders { auto jsonBody = jsonStream.str(); boost::replace_all(jsonBody, "\n", ""); - auto resp = httpClient->makeRequest(target, jsonBody, HttpClient::RequestVerb::POST); + auto resp = httpClient->makeRequest(target, jsonBody, HttpClient::RequestVerb::E_POST); responses::order order(resp); return order; } @@ -156,7 +156,7 @@ namespace orders { auto jsonBody = jsonStream.str(); boost::replace_all(jsonBody, "\n", ""); - auto resp = httpClient->makeRequest(target, jsonBody, HttpClient::RequestVerb::POST); + auto resp = httpClient->makeRequest(target, jsonBody, HttpClient::RequestVerb::E_POST); responses::order order(resp); return order; } @@ -189,7 +189,7 @@ namespace orders { } std::vector orders; - auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::GET); + auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::E_GET); for (const auto &ord : resp) { responses::order order(ord.second); orders.push_back(order); @@ -207,7 +207,7 @@ namespace orders { target += "client:"; } target += orderId; - auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::GET); + auto resp = httpClient->makeRequest(target, "", HttpClient::RequestVerb::E_GET); responses::order order(resp); return order; } diff --git a/src/util/httpclient.cpp b/src/util/httpclient.cpp index 054b033..41b3d65 100644 --- a/src/util/httpclient.cpp +++ b/src/util/httpclient.cpp @@ -36,10 +36,10 @@ pt::ptree HttpClient::makeRequest(const std::string &target, const std::string &body, HttpClient::RequestVerb rv) { http::verb boostVerb; std::string messageVerb; - if (rv == HttpClient::RequestVerb::GET) { + if (rv == HttpClient::RequestVerb::E_GET) { messageVerb = "GET"; boostVerb = http::verb::get; - } else if (rv == HttpClient::RequestVerb::POST) { + } else if (rv == HttpClient::RequestVerb::E_POST) { messageVerb = "POST"; boostVerb = http::verb::post; } else {