summaryrefslogtreecommitdiff
path: root/makima/src/daemon/api
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/daemon/api')
-rw-r--r--makima/src/daemon/api/supervisor.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/makima/src/daemon/api/supervisor.rs b/makima/src/daemon/api/supervisor.rs
index c67c9ca..675b0bb 100644
--- a/makima/src/daemon/api/supervisor.rs
+++ b/makima/src/daemon/api/supervisor.rs
@@ -83,6 +83,20 @@ pub struct AskQuestionRequest {
pub question_type: String,
}
+/// Request to create an order for future work.
+#[derive(Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateOrderRequest {
+ pub title: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
+ pub priority: String,
+ pub order_type: String,
+ pub labels: serde_json::Value,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub repository_url: Option<String>,
+}
+
// Generic response type for JSON output
#[derive(Deserialize, Serialize)]
pub struct JsonValue(pub serde_json::Value);
@@ -228,6 +242,18 @@ impl ApiClient {
self.post("/api/v1/mesh/supervisor/questions", &req).await
}
+ /// Poll for a question response by question_id.
+ ///
+ /// Used after a still_pending response from supervisor_ask. Blocks for up to
+ /// 5 minutes on the server side. Returns still_pending if no response yet.
+ pub async fn supervisor_poll_question(
+ &self,
+ question_id: Uuid,
+ ) -> Result<JsonValue, ApiError> {
+ self.get(&format!("/api/v1/mesh/supervisor/questions/{}/poll", question_id))
+ .await
+ }
+
/// Advance contract to a new phase.
///
/// When `confirmed` is false and phase_guard is enabled, returns a response with
@@ -312,6 +338,11 @@ impl ApiClient {
.await
}
+ /// Create an order for future work from a directive task.
+ pub async fn create_order(&self, req: &CreateOrderRequest) -> Result<JsonValue, ApiError> {
+ self.post("/api/v1/mesh/supervisor/orders", req).await
+ }
+
/// Delete a task.
pub async fn delete_task(&self, task_id: Uuid) -> Result<(), ApiError> {
self.delete(&format!("/api/v1/mesh/tasks/{}", task_id)).await