|
|
@ -24,7 +24,26 @@ distribution::distribution()
|
|
|
|
title(""),
|
|
|
|
title(""),
|
|
|
|
summary(""),
|
|
|
|
summary(""),
|
|
|
|
domain_name(""),
|
|
|
|
domain_name(""),
|
|
|
|
lp(nullptr) {}
|
|
|
|
lp(nullptr),
|
|
|
|
|
|
|
|
current_series([this]() -> std::optional<distro_series> {
|
|
|
|
|
|
|
|
if (current_series_link.empty()) return std::nullopt;
|
|
|
|
|
|
|
|
if (_current_series) return _current_series;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto response = lp ? lp->api_get(current_series_link) : std::nullopt;
|
|
|
|
|
|
|
|
if (!response) return std::nullopt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto data = nlohmann::json::parse(response.value());
|
|
|
|
|
|
|
|
auto ds = distro_series::parse(data.dump());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ds) {
|
|
|
|
|
|
|
|
ds->set_lp(lp);
|
|
|
|
|
|
|
|
_current_series = ds;
|
|
|
|
|
|
|
|
return ds;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
distribution::~distribution() {}
|
|
|
|
distribution::~distribution() {}
|
|
|
|
|
|
|
|
|
|
|
@ -47,6 +66,7 @@ void distribution::parse_json(const std::string& json_data) {
|
|
|
|
{"summary", [this](const nlohmann::json& val) { summary = val.get<std::string>(); }},
|
|
|
|
{"summary", [this](const nlohmann::json& val) { summary = val.get<std::string>(); }},
|
|
|
|
{"domain_name", [this](const nlohmann::json& val) { domain_name = val.get<std::string>(); }},
|
|
|
|
{"domain_name", [this](const nlohmann::json& val) { domain_name = val.get<std::string>(); }},
|
|
|
|
{"self_link", [this](const nlohmann::json& val) { self_link = val.get<std::string>(); }},
|
|
|
|
{"self_link", [this](const nlohmann::json& val) { self_link = val.get<std::string>(); }},
|
|
|
|
|
|
|
|
{"current_series_link", [this](const nlohmann::json& val) { current_series_link = val.get<std::string>(); }},
|
|
|
|
{"web_link", [this](const nlohmann::json& val) { web_link = val.get<std::string>(); }},
|
|
|
|
{"web_link", [this](const nlohmann::json& val) { web_link = val.get<std::string>(); }},
|
|
|
|
{"translationgroup_link", [this](const nlohmann::json& val) { translationgroup_link = val.get<std::string>(); }}
|
|
|
|
{"translationgroup_link", [this](const nlohmann::json& val) { translationgroup_link = val.get<std::string>(); }}
|
|
|
|
};
|
|
|
|
};
|
|
|
|