You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.6 KiB

// Copyright (C) 2024 Simon Quigley <tsimonq2@ubuntu.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef BUILD_H
#define BUILD_H
#include <string>
#include <optional>
#include <nlohmann/json.hpp>
#include "source_package_publishing_history.h"
class launchpad;
#ifndef LAUNCHPAD_API
#ifdef BUILDING_LAUNCHPAD
#define LAUNCHPAD_API __attribute__((visibility("default")))
#else
#define LAUNCHPAD_API
#endif
#endif
class LAUNCHPAD_API build {
public:
build();
~build();
// Parse method
static std::optional<build> parse(const std::string& json_data);
void parse_json(const std::string& json_data);
// Public member variables
std::string arch_tag;
std::string buildstate;
std::string build_log_url;
std::string upload_log_url;
std::string duration;
std::string changesfile_url;
std::string buildinfo_url;
std::string external_dependencies;
std::string pocket;
std::string title;
std::string self_link;
long id;
bool can_be_cancelled;
bool can_be_retried;
// Methods
bool cancel();
bool retry();
bool rescore(int score);
void set_lp(launchpad* lp_ptr);
// Read-only fields
std::string archive_link;
std::string builder_link;
std::string current_source_publication_link;
std::string distribution_link;
std::string http_etag;
std::string resource_type_link;
std::string score;
std::string source_package_name;
std::string source_package_version;
std::string web_link;
std::chrono::system_clock::time_point date_first_dispatched;
std::chrono::system_clock::time_point date_started;
std::chrono::system_clock::time_point datebuilt;
std::chrono::system_clock::time_point datecreated;
// Object collections
std::optional<source_package_publishing_history> current_source_publication = getCurrentSourcePublication();
private:
launchpad* lp;
const std::optional<source_package_publishing_history> getCurrentSourcePublication();
};
#endif // BUILD_H