31 lines
789 B
C++
31 lines
789 B
C++
#include "vendors/azure/models.h"
|
|
|
|
#include "vendors/azure/check.h"
|
|
|
|
namespace molo::azure {
|
|
|
|
using clients::body::Json;
|
|
|
|
Json ModelsService::list() { return call(Op::kListModels); }
|
|
|
|
std::vector<std::string> ModelsService::ids() {
|
|
std::vector<std::string> out;
|
|
Json doc = list();
|
|
if (const Json* data = doc.find("data"); data && data->is_array())
|
|
for (const Json& m : data->as_array())
|
|
if (const Json* id = m.find("id"); id && id->is_string()) out.push_back(id->as_string());
|
|
return out;
|
|
}
|
|
|
|
Json ModelsService::get(const std::string& id) {
|
|
Check::id("model", id);
|
|
return call(Op::kRetrieveModel, {"", {id}});
|
|
}
|
|
|
|
Json ModelsService::remove(const std::string& id) {
|
|
Check::id("model", id);
|
|
return call(Op::kDeleteModel, {"", {id}});
|
|
}
|
|
|
|
} // namespace molo::azure
|