// Copyright (C) 2024 Simon Quigley // // 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 . #ifndef ARCHIVE_H #define ARCHIVE_H #include "source.h" #include #include #include #include #include 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 parse(const std::string& json_data); void parse_json(const std::string& json_data); std::optional getAuthorizedSize() const; std::optional getBuildDebugSymbols() const; std::optional getDescription() const; std::optional getDisplayName() const; std::optional getDistributionLink() const; std::optional getExternalDependencies() const; std::optional getMetadataOverrides() const; std::optional getName() const; std::optional getOwnerLink() const; std::optional getPermitObsoleteSeriesUploads() const; std::optional getPrivate() const; std::optional getPublish() const; std::optional getPublishDebugSymbols() const; std::optional getPublishingMethod() const; std::optional getRelativeBuildScore() const; std::optional getRepositoryFormat() const; std::optional getRequireVirtualized() const; std::optional getSigningKeyFingerprint() const; std::optional getSuppressSubscriptionNotifications() const; std::optional getArchiveInfo() const; std::generator 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