Compare commits

..

2 Commits

Author SHA1 Message Date
2d2595b495 debug 2024-12-16 21:46:36 -06:00
374da51607 Move an error inside a conditional 2024-12-16 21:44:02 -06:00
4 changed files with 5 additions and 2 deletions

View File

@ -187,6 +187,7 @@ std::generator<source_package_publishing_history> archive::getPublishedSources(
} }
} }
std::cout << "Running a getPublishedSources() operation..." << std::endl;
auto response = lp->api_get(self_link, params); auto response = lp->api_get(self_link, params);
if(!response) co_return; if(!response) co_return;
auto data = nlohmann::json::parse(response.value()); auto data = nlohmann::json::parse(response.value());

View File

@ -125,6 +125,7 @@ bool build::cancel() {
if (self_link.empty()) return false; if (self_link.empty()) return false;
std::map<std::string, std::string> params; std::map<std::string, std::string> params;
params["ws.op"] = "cancel"; params["ws.op"] = "cancel";
std::cout << "Running a cancel operation..." << std::endl;
auto response = lp->api_post(self_link, params); auto response = lp->api_post(self_link, params);
return response.has_value(); return response.has_value();
} }

View File

@ -221,8 +221,8 @@ std::string launchpad::build_full_url(const std::string& endpoint) const {
std::optional<std::string> launchpad::api_get(const std::string& endpoint, const std::map<std::string, std::string>& params) const { std::optional<std::string> launchpad::api_get(const std::string& endpoint, const std::map<std::string, std::string>& params) const {
std::string url = build_full_url(endpoint); std::string url = build_full_url(endpoint);
if (url.empty()) { if (url.empty()) {
std::cerr << "Internal error: please include the following info in a bug report:" << std::endl;
if (!params.empty()) { if (!params.empty()) {
std::cerr << "Internal error: please include the following info in a bug report:" << std::endl;
for (const auto& [key, value] : params) { for (const auto& [key, value] : params) {
std::cerr << url_encode(key) + "=" + url_encode(value) + "&"; std::cerr << url_encode(key) + "=" + url_encode(value) + "&";
} }
@ -302,8 +302,8 @@ std::optional<std::string> launchpad::api_post(
const std::string& token_secret_override const std::string& token_secret_override
) { ) {
if (endpoint.empty()) { if (endpoint.empty()) {
std::cerr << "Internal error: please include the following info in a bug report:" << std::endl;
if (!params.empty()) { if (!params.empty()) {
std::cerr << "Internal error: please include the following info in a bug report:" << std::endl;
for (const auto& [key, value] : params) { for (const auto& [key, value] : params) {
std::cerr << url_encode(key) + "=" + url_encode(value) + "&"; std::cerr << url_encode(key) + "=" + url_encode(value) + "&";
} }

View File

@ -59,6 +59,7 @@ std::generator<build> source_package_publishing_history::getBuilds() const {
if (self_link.empty()) { co_return; } if (self_link.empty()) { co_return; }
std::map<std::string, std::string> params = {{"ws.op", "getBuilds"}}; std::map<std::string, std::string> params = {{"ws.op", "getBuilds"}};
std::cout << "Running a getBuilds() operation..." << std::endl;
auto response = lp->api_get(self_link, params); auto response = lp->api_get(self_link, params);
if (!response.has_value()) { co_return; } if (!response.has_value()) { co_return; }