Skip to main content

objectiveai_cli/command/swarms/
get.rs

1//! `swarms get <path>` — fetch a swarm by its remote path. The SDK's
2//! `TryFrom<Args>` has already parsed the docker-style
3//! `key=value,...` string into a `RemotePathCommitOptional`.
4
5use objectiveai_sdk::cli::command::swarms::get::{Request, Response};
6
7use crate::context::Context;
8use crate::error::Error;
9
10pub async fn execute(ctx: &Context, request: Request) -> Result<Response, Error> {
11    let path = request.path;
12    let response = objectiveai_sdk::swarm::get_swarm(ctx.api_client().await?, path).await?;
13    Ok(response)
14}
15
16pub mod request_schema {
17    use objectiveai_sdk::cli::command::swarms::get as sdk;
18    use objectiveai_sdk::cli::command::swarms::get::request_schema::{Request, Response};
19
20    use crate::context::Context;
21    use crate::error::Error;
22
23    pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
24        Ok(objectiveai_sdk::cli::command::ResponseSchema(schemars::schema_for!(sdk::Request)))
25    }
26}
27
28pub mod response_schema {
29    use objectiveai_sdk::cli::command::swarms::get as sdk;
30    use objectiveai_sdk::cli::command::swarms::get::response_schema::{Request, Response};
31
32    use crate::context::Context;
33    use crate::error::Error;
34
35    pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
36        Ok(objectiveai_sdk::cli::command::ResponseSchema(schemars::schema_for!(sdk::Response)))
37    }
38}