MCPcopy Create free account
hub / github.com/chrxh/alien / getNetworkResources

Method getNetworkResources

source/Network/NetworkService.cpp:299–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299bool 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
327bool NetworkService::getUserList(std::vector<UserTO>& result, bool withRetry)
328{

Callers 1

processRequestMethod · 0.80

Calls 6

logFunction · 0.85
configureClientFunction · 0.85
executeRequestFunction · 0.85
logNetworkErrorFunction · 0.85
PostMethod · 0.80

Tested by

no test coverage detected