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.
133 lines
4.6 KiB
133 lines
4.6 KiB
1 week ago
|
// 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 ARCHIVE_H
|
||
|
#define ARCHIVE_H
|
||
|
|
||
|
#include "source.h"
|
||
|
#include <generator>
|
||
|
#include <nlohmann/json.hpp>
|
||
|
#include <optional>
|
||
|
#include <string>
|
||
|
#include <vector>
|
||
|
|
||
|
class launchpad;
|
||
|
|
||
|
#ifndef LAUNCHPAD_API
|
||
|
#ifdef BUILDING_LAUNCHPAD
|
||
|
#define LAUNCHPAD_API __attribute__((visibility("default")))
|
||
|
#else
|
||
|
#define LAUNCHPAD_API
|
||
|
#endif
|
||
|
#endif
|
||
|
|
||
|
class LAUNCHPAD_API archive {
|
||
|
public:
|
||
|
archive();
|
||
|
~archive();
|
||
|
|
||
|
static std::optional<archive> parse(const std::string& json_data);
|
||
|
void parse_json(const std::string& json_data);
|
||
|
|
||
|
std::optional<int> getAuthorizedSize() const;
|
||
|
std::optional<bool> getBuildDebugSymbols() const;
|
||
|
std::optional<std::string> getDescription() const;
|
||
|
std::optional<std::string> getDisplayName() const;
|
||
|
std::optional<std::string> getDistributionLink() const;
|
||
|
std::optional<std::string> getExternalDependencies() const;
|
||
|
std::optional<nlohmann::json> getMetadataOverrides() const;
|
||
|
std::optional<std::string> getName() const;
|
||
|
std::optional<std::string> getOwnerLink() const;
|
||
|
std::optional<bool> getPermitObsoleteSeriesUploads() const;
|
||
|
std::optional<bool> getPrivate() const;
|
||
|
std::optional<bool> getPublish() const;
|
||
|
std::optional<bool> getPublishDebugSymbols() const;
|
||
|
std::optional<std::string> getPublishingMethod() const;
|
||
|
std::optional<int> getRelativeBuildScore() const;
|
||
|
std::optional<std::string> getRepositoryFormat() const;
|
||
|
std::optional<bool> getRequireVirtualized() const;
|
||
|
std::optional<std::string> getSigningKeyFingerprint() const;
|
||
|
std::optional<bool> getSuppressSubscriptionNotifications() const;
|
||
|
std::optional<std::string> getArchiveInfo() const;
|
||
|
std::generator<source> getPublishedSources(const std::string& status) const;
|
||
|
|
||
|
bool setAuthorizedSize(int size);
|
||
|
bool setBuildDebugSymbols(bool build);
|
||
|
bool setDescription(const std::string& desc);
|
||
|
bool setDisplayName(const std::string& name_);
|
||
|
bool setDistributionLink(const std::string& link);
|
||
|
bool setExternalDependencies(const std::string& deps);
|
||
|
bool setMetadataOverrides(const nlohmann::json& overrides);
|
||
|
bool setName(const std::string& name_);
|
||
|
bool setOwnerLink(const std::string& link);
|
||
|
bool setPermitObsoleteSeriesUploads(bool permit);
|
||
|
bool setPrivate(bool is_private_);
|
||
|
bool setPublish(bool publish_);
|
||
|
bool setPublishDebugSymbols(bool publish_debug_);
|
||
|
bool setPublishingMethod(const std::string& method);
|
||
|
bool setRelativeBuildScore(int score);
|
||
|
bool setRepositoryFormat(const std::string& format);
|
||
|
bool setRequireVirtualized(bool require_);
|
||
|
bool setSigningKeyFingerprint(const std::string& fingerprint);
|
||
|
bool setSuppressSubscriptionNotifications(bool suppress);
|
||
|
|
||
|
bool patchArchive(const nlohmann::json& update_fields);
|
||
|
bool putArchive(const nlohmann::json& new_representation);
|
||
|
bool deleteArchive();
|
||
|
|
||
|
void set_lp(launchpad* lp_ptr);
|
||
|
|
||
|
// New public member variables
|
||
|
int authorized_size;
|
||
|
bool build_debug_symbols;
|
||
|
std::string description;
|
||
|
std::string displayname;
|
||
|
std::string distribution_link;
|
||
|
std::string external_dependencies;
|
||
|
nlohmann::json metadata_overrides;
|
||
|
std::string name;
|
||
|
std::string owner_link;
|
||
|
bool permit_obsolete_series_uploads;
|
||
|
bool is_private;
|
||
|
bool publish;
|
||
|
bool publish_debug_symbols;
|
||
|
std::string publishing_method;
|
||
|
int relative_build_score;
|
||
|
std::string repository_format;
|
||
|
bool require_virtualized;
|
||
|
std::string signing_key_fingerprint;
|
||
|
bool suppress_subscription_notifications;
|
||
|
std::string owner_name;
|
||
|
std::string ppa_name;
|
||
|
std::string self_link;
|
||
|
|
||
|
// Read-only fields
|
||
|
std::string dependencies_collection_link;
|
||
|
std::string enabled_restricted_processors_collection_link;
|
||
|
std::string http_etag;
|
||
|
std::string processors_collection_link;
|
||
|
std::string reference;
|
||
|
std::string resource_type_link;
|
||
|
std::string status;
|
||
|
std::string web_link;
|
||
|
|
||
|
launchpad* lp;
|
||
|
|
||
|
private:
|
||
|
std::string build_archive_endpoint() const;
|
||
|
};
|
||
|
|
||
|
#endif // ARCHIVE_H
|