39 lines
1.0 KiB
C++
39 lines
1.0 KiB
C++
#include "vendors/azure/batches.h"
|
|
|
|
#include "vendors/azure/check.h"
|
|
|
|
namespace molo::azure {
|
|
|
|
using clients::body::Json;
|
|
|
|
Json BatchesService::create(const Json& body) {
|
|
Check::has_string(body, "endpoint");
|
|
Check::has_string(body, "completion_window");
|
|
Check::require(body.find("input_file_id") || body.find("input_blob"),
|
|
"input_file_id (or input_blob) is required");
|
|
return call(Op::kCreateBatch, {}, &body);
|
|
}
|
|
|
|
Json BatchesService::get(const std::string& id) {
|
|
Check::id("batch", id);
|
|
return call(Op::kRetrieveBatch, {"", {id}});
|
|
}
|
|
|
|
Json BatchesService::list(const ListParams& params) {
|
|
params.validate();
|
|
Query q;
|
|
params.apply(q);
|
|
return call(Op::kListBatches, {}, nullptr, &q);
|
|
}
|
|
|
|
Listing BatchesService::list_all(const ListParams& params, std::size_t max_pages) {
|
|
return walk(Op::kListBatches, {}, params, Query(), max_pages);
|
|
}
|
|
|
|
Json BatchesService::cancel(const std::string& id) {
|
|
Check::id("batch", id);
|
|
return call(Op::kCancelBatch, {"", {id}});
|
|
}
|
|
|
|
} // namespace molo::azure
|