Bind build::current_source_publication to build::getCurrentSourcePublication()
This commit is contained in:
parent
b7011711b3
commit
b963524519
@ -14,6 +14,7 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
|
#include "source_package_publishing_history.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "launchpad.h"
|
#include "launchpad.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -110,3 +111,15 @@ bool build::rescore(int score) {
|
|||||||
void build::set_lp(launchpad* lp_ptr) {
|
void build::set_lp(launchpad* lp_ptr) {
|
||||||
lp = lp_ptr;
|
lp = lp_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::optional<source_package_publishing_history> build::getCurrentSourcePublication() {
|
||||||
|
auto response = lp->api_get(current_source_publication_link);
|
||||||
|
if (!response) return std::nullopt;
|
||||||
|
auto data = nlohmann::json::parse(response.value());
|
||||||
|
auto sp = source_package_publishing_history::parse(data.dump());
|
||||||
|
if (sp) {
|
||||||
|
sp->set_lp(lp);
|
||||||
|
return sp.value();
|
||||||
|
}
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
#include "source_package_publishing_history.h"
|
||||||
|
|
||||||
class launchpad;
|
class launchpad;
|
||||||
|
|
||||||
@ -78,8 +79,12 @@ public:
|
|||||||
std::string datebuilt;
|
std::string datebuilt;
|
||||||
std::string datecreated;
|
std::string datecreated;
|
||||||
|
|
||||||
|
// Object collections
|
||||||
|
std::optional<source_package_publishing_history> current_source_publication = getCurrentSourcePublication();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
launchpad* lp;
|
launchpad* lp;
|
||||||
|
const std::optional<source_package_publishing_history> getCurrentSourcePublication();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BUILD_H
|
#endif // BUILD_H
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "build.h"
|
||||||
#include "source_package_publishing_history.h"
|
#include "source_package_publishing_history.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "build.h"
|
|
||||||
#include "launchpad.h"
|
#include "launchpad.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <generator>
|
#include <generator>
|
||||||
#include "build.h"
|
|
||||||
|
|
||||||
class launchpad;
|
class launchpad;
|
||||||
|
class build;
|
||||||
|
|
||||||
#ifndef LAUNCHPAD_API
|
#ifndef LAUNCHPAD_API
|
||||||
#ifdef BUILDING_LAUNCHPAD
|
#ifdef BUILDING_LAUNCHPAD
|
||||||
|
Loading…
x
Reference in New Issue
Block a user