| 297 | } |
| 298 | |
| 299 | bool NetworkService::getNetworkResources(std::vector<NetworkResourceRawTO>& result, bool withRetry) |
| 300 | { |
| 301 | log(Priority::Important, "network: get resource list"); |
| 302 | |
| 303 | httplib::SSLClient client(_serverAddress); |
| 304 | configureClient(client); |
| 305 | |
| 306 | httplib::Params params; |
| 307 | params.emplace("version", Const::ProgramVersion); |
| 308 | if (_loggedInUserName && _password) { |
| 309 | params.emplace("userName", *_loggedInUserName); |
| 310 | params.emplace("password", *_password); |
| 311 | } |
| 312 | |
| 313 | try { |
| 314 | auto postResult = executeRequest([&] { return client.Post("/alien-server/getversionedsimulationlist.php", params); }, withRetry); |
| 315 | |
| 316 | std::stringstream stream(postResult->body); |
| 317 | boost::property_tree::ptree tree; |
| 318 | boost::property_tree::read_json(stream, tree); |
| 319 | result = NetworkResourceParserService::get().decodeRemoteSimulationData(tree); |
| 320 | return true; |
| 321 | } catch (...) { |
| 322 | logNetworkError(); |
| 323 | return false; |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | bool NetworkService::getUserList(std::vector<UserTO>& result, bool withRetry) |
| 328 | { |
no test coverage detected