Add the build property for binary_package_publishing_history

main
Simon Quigley 7 days ago
parent e99b2ef058
commit 5d803c4345

@ -176,3 +176,15 @@ bool binary_package_publishing_history::requestDeletion(const std::optional<std:
auto resp=lp->api_post(self_link,params); auto resp=lp->api_post(self_link,params);
return resp.has_value(); return resp.has_value();
} }
const std::optional<class build> 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;
}

@ -5,6 +5,7 @@
#include <optional> #include <optional>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <generator> #include <generator>
#include "build.h"
#ifndef LAUNCHPAD_API #ifndef LAUNCHPAD_API
#ifdef BUILDING_LAUNCHPAD #ifdef BUILDING_LAUNCHPAD
@ -69,8 +70,10 @@ public:
const std::optional<std::string>& new_priority, const std::optional<std::string>& new_priority,
const std::optional<std::string>& new_section) const; const std::optional<std::string>& new_section) const;
bool requestDeletion(const std::optional<std::string>& removal_comment) const; bool requestDeletion(const std::optional<std::string>& removal_comment) const;
std::optional<class build> build = getBuild();
private: private:
const std::optional<class build> getBuild();
launchpad* lp; launchpad* lp;
}; };

@ -20,10 +20,10 @@
#include <optional> #include <optional>
#include <generator> #include <generator>
#include "distro_series.h" #include "distro_series.h"
#include "binary_package_publishing_history.h"
class launchpad; class launchpad;
class build; class build;
class binary_package_publishing_history;
#ifndef LAUNCHPAD_API #ifndef LAUNCHPAD_API
#ifdef BUILDING_LAUNCHPAD #ifdef BUILDING_LAUNCHPAD

Loading…
Cancel
Save