Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored RequestVerb enums to resolve DELETE redefinition on Windows #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/accounts/accounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<responses::entry> entries;
for (const auto &item : resp) {
Expand All @@ -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<responses::account> accounts;
for (const auto &item : resp) {
Expand All @@ -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;
Expand All @@ -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<responses::hold> holds;
for (const auto &item : resp) {
Expand Down
12 changes: 6 additions & 6 deletions src/orders/orders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>("error");

}
Expand All @@ -34,7 +34,7 @@ namespace orders {
}

std::vector<std::string> 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());
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -189,7 +189,7 @@ namespace orders {
}

std::vector<responses::order> 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);
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/util/httpclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down