mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-08-28 05:27:41 +00:00
Route both create-run client methods through one submission helper
create_run_from_manifest and create_run_from_intent were byte-identical apart from the body type; fold the shared request/retry plumbing into a private submit_create_run(CreateRunRequest) so the two public entry points stay thin. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
96c6de0ab9
commit
d978a6c89d
1 changed files with 6 additions and 8 deletions
|
|
@ -697,18 +697,16 @@ impl Client {
|
|||
}
|
||||
|
||||
pub async fn create_run_from_manifest(&self, manifest: types::RunManifest) -> Result<RunId> {
|
||||
let response = self
|
||||
.send_api(
|
||||
|client| async move { client.create_run().body(manifest.clone()).send().await },
|
||||
)
|
||||
.await?;
|
||||
let status = response.into_inner();
|
||||
Ok(status.id)
|
||||
self.submit_create_run(manifest.into()).await
|
||||
}
|
||||
|
||||
pub async fn create_run_from_intent(&self, intent: types::RunIntent) -> Result<RunId> {
|
||||
self.submit_create_run(intent.into()).await
|
||||
}
|
||||
|
||||
async fn submit_create_run(&self, body: types::CreateRunRequest) -> Result<RunId> {
|
||||
let response = self
|
||||
.send_api(|client| async move { client.create_run().body(intent.clone()).send().await })
|
||||
.send_api(|client| async move { client.create_run().body(body.clone()).send().await })
|
||||
.await?;
|
||||
let status = response.into_inner();
|
||||
Ok(status.id)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue