| | |
| | | |
| | | json::Message* addOrder(json::AddMessage& order) |
| | | { |
| | | std::string message = "{\"message\": " + order.as_string() + ", " + |
| | | "\"username\": \"" + std::string(USER) + |
| | | "\", \"password\": \"" + std::string(PASS) + "\"}"; |
| | | std::string message = order.as_string(); |
| | | return send(message); |
| | | } |
| | | |
| | | json::Message* deleteOrder(json::DeleteMessage& order) |
| | | { |
| | | std::string message = "{\"message\": " + order.as_string() + |
| | | ", \"username\": \"" + std::string(USER) + |
| | | "\", \"password\": \"" + std::string(PASS) + "\"}"; |
| | | std::string message = order.as_string(); |
| | | return send(message); |
| | | } |
| | | |
| | |
| | | |
| | | json::Message* send(std::string& message) |
| | | { |
| | | auto res = cli.Post("/execution", message, "text/plain"); |
| | | std::queue<json::Message*> a = json::parse(res->body); |
| | | return a.front(); |
| | | httplib::MultipartFormDataItems a = {{"message", message, "", ""}, |
| | | {"username", USER, "", ""}, |
| | | {"password", PASS, "", ""}}; |
| | | auto res = cli.Post("/execution", a); |
| | | std::string b = res->body; |
| | | std::queue<json::Message*> c = json::parse(b); |
| | | return c.front(); |
| | | } |
| | | |
| | | } // namespace protocol |