|
|
|
@ -13,9 +13,8 @@
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
#include "build.h"
|
|
|
|
|
#include "source_package_publishing_history.h"
|
|
|
|
|
#include "utils.h"
|
|
|
|
|
#include "build.h"
|
|
|
|
|
#include "launchpad.h"
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
@ -46,6 +45,10 @@ void source_package_publishing_history::parse_json(const std::string& json_data)
|
|
|
|
|
if (data.contains("self_link") && data["self_link"].is_string()) {
|
|
|
|
|
self_link = data["self_link"].get<std::string>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.contains("distro_series_link") && data["distro_series_link"].is_string()) {
|
|
|
|
|
distro_series_link = data["distro_series_link"].get<std::string>();
|
|
|
|
|
}
|
|
|
|
|
} catch (const std::exception& e) {
|
|
|
|
|
std::cerr << "Error parsing source JSON: " << e.what() << std::endl;
|
|
|
|
|
}
|
|
|
|
@ -76,3 +79,15 @@ std::generator<build> source_package_publishing_history::getBuilds() const {
|
|
|
|
|
void source_package_publishing_history::set_lp(launchpad* lp_ptr) {
|
|
|
|
|
lp = lp_ptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const std::optional<class distro_series> source_package_publishing_history::getDistroSeries() {
|
|
|
|
|
auto response = lp->api_get(distro_series_link);
|
|
|
|
|
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);
|
|
|
|
|
return ds;
|
|
|
|
|
}
|
|
|
|
|
return std::nullopt;
|
|
|
|
|
}
|
|
|
|
|