diff --git a/src/binary_package_publishing_history.cpp b/src/binary_package_publishing_history.cpp index 7c7f13d..05ba800 100644 --- a/src/binary_package_publishing_history.cpp +++ b/src/binary_package_publishing_history.cpp @@ -176,3 +176,15 @@ bool binary_package_publishing_history::requestDeletion(const std::optionalapi_post(self_link,params); return resp.has_value(); } + +const std::optional binary_package_publishing_history::getBuild() { + auto response = lp->api_get(build_link); + if (!response) return std::nullopt; + auto data = nlohmann::json::parse(response.value()); + auto build = build::parse(data.dump()); + if (build) { + build->set_lp(lp); + return build; + } + return std::nullopt; +} diff --git a/src/binary_package_publishing_history.h b/src/binary_package_publishing_history.h index 1aebf18..1920ecc 100644 --- a/src/binary_package_publishing_history.h +++ b/src/binary_package_publishing_history.h @@ -5,6 +5,7 @@ #include #include #include +#include "build.h" #ifndef LAUNCHPAD_API #ifdef BUILDING_LAUNCHPAD @@ -69,8 +70,10 @@ public: const std::optional& new_priority, const std::optional& new_section) const; bool requestDeletion(const std::optional& removal_comment) const; + std::optional build = getBuild(); private: + const std::optional getBuild(); launchpad* lp; }; diff --git a/src/source_package_publishing_history.h b/src/source_package_publishing_history.h index e381170..8bc4387 100644 --- a/src/source_package_publishing_history.h +++ b/src/source_package_publishing_history.h @@ -20,10 +20,10 @@ #include #include #include "distro_series.h" -#include "binary_package_publishing_history.h" class launchpad; class build; +class binary_package_publishing_history; #ifndef LAUNCHPAD_API #ifdef BUILDING_LAUNCHPAD