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:
Scott Werner 2026-08-22 10:29:32 -04:00
parent 96c6de0ab9
commit d978a6c89d

View file

@ -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)