diff options
Diffstat (limited to 'makima/src/daemon/api/chain.rs')
| -rw-r--r-- | makima/src/daemon/api/chain.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/makima/src/daemon/api/chain.rs b/makima/src/daemon/api/chain.rs index 7f7826f..c37c980 100644 --- a/makima/src/daemon/api/chain.rs +++ b/makima/src/daemon/api/chain.rs @@ -49,4 +49,30 @@ impl ApiClient { self.delete_with_response(&format!("/api/v1/chains/{}", chain_id)) .await } + + /// Start a chain (creates root contracts and optionally a supervisor). + pub async fn start_chain(&self, chain_id: Uuid) -> Result<JsonValue, ApiError> { + self.post_empty(&format!("/api/v1/chains/{}/start", chain_id)) + .await + } + + /// Start a chain with supervisor enabled. + pub async fn start_chain_with_supervisor( + &self, + chain_id: Uuid, + repository_url: Option<&str>, + ) -> Result<JsonValue, ApiError> { + #[derive(serde::Serialize)] + #[serde(rename_all = "camelCase")] + struct StartRequest<'a> { + with_supervisor: bool, + repository_url: Option<&'a str>, + } + let req = StartRequest { + with_supervisor: true, + repository_url, + }; + self.post(&format!("/api/v1/chains/{}/start", chain_id), &req) + .await + } } |
