summaryrefslogtreecommitdiff
path: root/makima/src/daemon/api/chain.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-03 23:19:40 +0000
committersoryu <soryu@soryu.co>2026-02-03 23:19:40 +0000
commitbfa3af9ef16fd5e255bdb606a99a5ebb535ba7cc (patch)
tree53da855b4ca61a5c0856fc15112daa7a3748c637 /makima/src/daemon/api/chain.rs
parent1ce281adb89683a5fccfd153706383b14b944f32 (diff)
parentdcbf8c834626870a43b633b099f409d69d4f9b87 (diff)
downloadsoryu-bfa3af9ef16fd5e255bdb606a99a5ebb535ba7cc.tar.gz
soryu-bfa3af9ef16fd5e255bdb606a99a5ebb535ba7cc.zip
fix: Resolve merge conflict in server/mod.rsmakima/discuss-contract-feature
Combine imports from both branches - include both chains and contract_discuss handlers. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/src/daemon/api/chain.rs')
-rw-r--r--makima/src/daemon/api/chain.rs52
1 files changed, 52 insertions, 0 deletions
diff --git a/makima/src/daemon/api/chain.rs b/makima/src/daemon/api/chain.rs
new file mode 100644
index 0000000..7f7826f
--- /dev/null
+++ b/makima/src/daemon/api/chain.rs
@@ -0,0 +1,52 @@
+//! Chain API methods.
+
+use uuid::Uuid;
+
+use super::client::{ApiClient, ApiError};
+use super::supervisor::JsonValue;
+use crate::db::models::CreateChainRequest;
+
+impl ApiClient {
+ /// Create a new chain with contracts.
+ pub async fn create_chain(&self, req: CreateChainRequest) -> Result<JsonValue, ApiError> {
+ self.post("/api/v1/chains", &req).await
+ }
+
+ /// List all chains for the authenticated user.
+ pub async fn list_chains(
+ &self,
+ status: Option<&str>,
+ limit: i32,
+ ) -> Result<JsonValue, ApiError> {
+ let mut params = Vec::new();
+ if let Some(s) = status {
+ params.push(format!("status={}", s));
+ }
+ params.push(format!("limit={}", limit));
+ let query_string = format!("?{}", params.join("&"));
+ self.get(&format!("/api/v1/chains{}", query_string)).await
+ }
+
+ /// Get a chain by ID.
+ pub async fn get_chain(&self, chain_id: Uuid) -> Result<JsonValue, ApiError> {
+ self.get(&format!("/api/v1/chains/{}", chain_id)).await
+ }
+
+ /// Get contracts in a chain.
+ pub async fn get_chain_contracts(&self, chain_id: Uuid) -> Result<JsonValue, ApiError> {
+ self.get(&format!("/api/v1/chains/{}/contracts", chain_id))
+ .await
+ }
+
+ /// Get chain DAG structure for visualization.
+ pub async fn get_chain_graph(&self, chain_id: Uuid) -> Result<JsonValue, ApiError> {
+ self.get(&format!("/api/v1/chains/{}/graph", chain_id))
+ .await
+ }
+
+ /// Archive a chain.
+ pub async fn archive_chain(&self, chain_id: Uuid) -> Result<JsonValue, ApiError> {
+ self.delete_with_response(&format!("/api/v1/chains/{}", chain_id))
+ .await
+ }
+}