|
|
|
@ -127,234 +127,10 @@ void archive::parse_json(const std::string& json_data) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<int> archive::getAuthorizedSize() const {
|
|
|
|
|
return authorized_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<bool> archive::getBuildDebugSymbols() const {
|
|
|
|
|
return build_debug_symbols;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> archive::getDescription() const {
|
|
|
|
|
return description.empty()?std::nullopt:std::optional<std::string>(description);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> archive::getDisplayName() const {
|
|
|
|
|
return displayname.empty()?std::nullopt:std::optional<std::string>(displayname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> archive::getDistributionLink() const {
|
|
|
|
|
return distribution_link.empty()?std::nullopt:std::optional<std::string>(distribution_link);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> archive::getExternalDependencies() const {
|
|
|
|
|
return external_dependencies.empty()?std::nullopt:std::optional<std::string>(external_dependencies);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<nlohmann::json> archive::getMetadataOverrides() const {
|
|
|
|
|
return metadata_overrides.empty()?std::nullopt:std::optional<nlohmann::json>(metadata_overrides);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> archive::getName() const {
|
|
|
|
|
return name.empty()?std::nullopt:std::optional<std::string>(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> archive::getOwnerLink() const {
|
|
|
|
|
return owner_link.empty()?std::nullopt:std::optional<std::string>(owner_link);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<bool> archive::getPermitObsoleteSeriesUploads() const {
|
|
|
|
|
return permit_obsolete_series_uploads;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<bool> archive::getPrivate() const {
|
|
|
|
|
return is_private;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<bool> archive::getPublish() const {
|
|
|
|
|
return publish;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<bool> archive::getPublishDebugSymbols() const {
|
|
|
|
|
return publish_debug_symbols;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> archive::getPublishingMethod() const {
|
|
|
|
|
return publishing_method.empty()?std::nullopt:std::optional<std::string>(publishing_method);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<int> archive::getRelativeBuildScore() const {
|
|
|
|
|
return relative_build_score;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> archive::getRepositoryFormat() const {
|
|
|
|
|
return repository_format.empty()?std::nullopt:std::optional<std::string>(repository_format);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<bool> archive::getRequireVirtualized() const {
|
|
|
|
|
return require_virtualized;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> archive::getSigningKeyFingerprint() const {
|
|
|
|
|
return signing_key_fingerprint.empty()?std::nullopt:std::optional<std::string>(signing_key_fingerprint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<bool> archive::getSuppressSubscriptionNotifications() const {
|
|
|
|
|
return suppress_subscription_notifications;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> archive::getArchiveInfo() const {
|
|
|
|
|
return std::nullopt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setAuthorizedSize(int size) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["authorized_size"] = size;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setBuildDebugSymbols(bool build) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["build_debug_symbols"] = build;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setDescription(const std::string& desc) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["description"] = desc;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setDisplayName(const std::string& name_) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["displayname"] = name_;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setDistributionLink(const std::string& link) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["distribution_link"] = link;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setExternalDependencies(const std::string& deps) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["external_dependencies"] = deps;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setMetadataOverrides(const nlohmann::json& overrides) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["metadata_overrides"] = overrides;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setName(const std::string& name_) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["name"] = name_;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setOwnerLink(const std::string& link) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["owner_link"] = link;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setPermitObsoleteSeriesUploads(bool permit) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["permit_obsolete_series_uploads"] = permit;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setPrivate(bool is_private_) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["private"] = is_private_;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setPublish(bool publish_) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["publish"] = publish_;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setPublishDebugSymbols(bool publish_debug_) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["publish_debug_symbols"] = publish_debug_;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setPublishingMethod(const std::string& method) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["publishing_method"] = method;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setRelativeBuildScore(int score) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["relative_build_score"] = score;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setRepositoryFormat(const std::string& format) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["repository_format"] = format;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setRequireVirtualized(bool require_) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["require_virtualized"] = require_;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setSigningKeyFingerprint(const std::string& fingerprint) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["signing_key_fingerprint"] = fingerprint;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::setSuppressSubscriptionNotifications(bool suppress) {
|
|
|
|
|
nlohmann::json update;
|
|
|
|
|
update["suppress_subscription_notifications"] = suppress;
|
|
|
|
|
return patchArchive(update);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string archive::build_archive_endpoint() const {
|
|
|
|
|
return "~" + url_encode(owner_name) + "/" + url_encode(ppa_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::patchArchive(const nlohmann::json& update_fields) {
|
|
|
|
|
if (!lp) {
|
|
|
|
|
std::cerr << "LP not set in archive::patchArchive.\n";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
std::string endpoint = build_archive_endpoint();
|
|
|
|
|
auto response = lp->api_patch(endpoint, update_fields);
|
|
|
|
|
return response.has_value();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::putArchive(const nlohmann::json& new_representation) {
|
|
|
|
|
if (!lp) {
|
|
|
|
|
std::cerr << "LP not set in archive::putArchive.\n";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
std::string endpoint = build_archive_endpoint();
|
|
|
|
|
auto response = lp->api_patch(endpoint, new_representation);
|
|
|
|
|
return response.has_value();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool archive::deleteArchive() {
|
|
|
|
|
if (!lp) {
|
|
|
|
|
std::cerr << "LP not set in archive::deleteArchive.\n";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
std::string endpoint = build_archive_endpoint();
|
|
|
|
|
auto response = lp->api_delete(endpoint);
|
|
|
|
|
return response.has_value();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::generator<source> archive::getPublishedSources(const std::string& status) const {
|
|
|
|
|
std::map<std::string, std::string> params;
|
|
|
|
|
params["ws.op"] = "getPublishedSources";
|
|
|
|
|