Add support for many more optional arguments to archive::getPublishedSources
This commit is contained in:
parent
a64dc3a1dd
commit
2cbe2897a2
@ -153,10 +153,38 @@ std::generator<archive_permission> archive::getAllPermissions() const {
|
||||
}
|
||||
}
|
||||
|
||||
std::generator<source_package_publishing_history> archive::getPublishedSources(const std::string& status) const {
|
||||
std::map<std::string, std::string> params;
|
||||
params["ws.op"] = "getPublishedSources";
|
||||
params["status"] = status;
|
||||
std::generator<source_package_publishing_history> archive::getPublishedSources(
|
||||
const std::string& component_name,
|
||||
const std::string& created_since_date,
|
||||
std::optional<distro_series> ds,
|
||||
const bool exact_match,
|
||||
const bool order_by_date,
|
||||
const std::string& pocket,
|
||||
const std::string& source_name,
|
||||
const std::string& status,
|
||||
const std::string& version
|
||||
) const {
|
||||
std::map<std::string, std::string> params = {
|
||||
{"exact_match", exact_match ? "true" : ""},
|
||||
{"order_by_date", order_by_date ? "true" : ""},
|
||||
{"distro_series", ds ? ds.value().self_link : ""},
|
||||
{"component_name", !component_name.empty() ? component_name : ""},
|
||||
{"created_since_date", !created_since_date.empty() ? created_since_date : ""},
|
||||
{"pocket", !pocket.empty() ? pocket : ""},
|
||||
{"source_name", !source_name.empty() ? source_name : ""},
|
||||
{"status", !status.empty() ? status : ""},
|
||||
{"version", !version.empty() ? version : ""}
|
||||
};
|
||||
|
||||
// Remove empty entries
|
||||
for (auto it = params.begin(); it != params.end(); ) {
|
||||
if (it->second.empty()) {
|
||||
it = params.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
auto response = lp->api_get(self_link, params);
|
||||
if(!response) co_return;
|
||||
auto data = nlohmann::json::parse(response.value());
|
||||
|
@ -81,7 +81,17 @@ public:
|
||||
std::string status;
|
||||
std::string web_link;
|
||||
|
||||
std::generator<source_package_publishing_history> getPublishedSources(const std::string& status) const;
|
||||
std::generator<source_package_publishing_history> getPublishedSources(
|
||||
const std::string& component_name = "",
|
||||
const std::string& created_since_date = "",
|
||||
std::optional<distro_series> ds = std::nullopt,
|
||||
const bool exact_match = false,
|
||||
const bool order_by_date = false,
|
||||
const std::string& pocket = "",
|
||||
const std::string& source_name = "",
|
||||
const std::string& status = "",
|
||||
const std::string& version = ""
|
||||
) const;
|
||||
std::generator<archive_permission> getAllPermissions() const;
|
||||
|
||||
std::optional<nlohmann::json> checkUpload(const std::string& component,
|
||||
|
Loading…
x
Reference in New Issue
Block a user