Add support for distribution::getSeries()

main
Simon Quigley 7 days ago
parent 6bcc090407
commit 4142757284

@ -68,6 +68,24 @@ void distribution::parse_json(const std::string& json_data) {
}
}
std::optional<distro_series> distribution::getSeries(const std::string& name_or_version) {
std::map<std::string, std::string> params = {
{"name_or_version", name_or_version},
{"ws.op", "getSeries"}
};
auto response = lp->api_get(self_link, params);
if (!response.has_value()) {
return std::nullopt;
}
std::optional<distro_series> ds_opt = distro_series::parse(response.value());
if (!ds_opt.has_value()) return std::nullopt;
// Set lp in the returned archive
ds_opt->set_lp(lp);
return ds_opt;
}
void distribution::set_lp(launchpad* lp_ptr) {
lp = lp_ptr;
}

@ -19,6 +19,7 @@
#include <string>
#include <optional>
#include <nlohmann/json.hpp>
#include "distro_series.h"
#ifndef LAUNCHPAD_API
#ifdef BUILDING_LAUNCHPAD
@ -38,6 +39,9 @@ public:
// Static method to parse JSON data
static std::optional<distribution> parse(const std::string& json_data);
// Public functions
std::optional<distro_series> distribution::getSeries(const std::string& name_or_version);
// Public member variables
std::string name;
std::string description;

Loading…
Cancel
Save