objectiveai_cli/command/agents/queue/read/
id.rs1use objectiveai_sdk::cli::command::agents::queue::read::id::{Request, Response};
6
7use crate::context::Context;
8use crate::db;
9use crate::error::Error;
10
11pub async fn execute(ctx: &Context, request: Request) -> Result<Response, Error> {
12 let row = db::message_queue::read_content(ctx.db_client().await?, request.id)
13 .await?
14 .ok_or_else(|| {
15 Error::Filesystem(crate::filesystem::Error::NotFound(format!(
16 "queue content id {}",
17 request.id
18 )))
19 })?;
20 Ok(db::message_queue::content_row_to_part(row))
23}
24
25pub mod request_schema {
26 use objectiveai_sdk::cli::command::agents::queue::read::id as sdk;
27 use objectiveai_sdk::cli::command::agents::queue::read::id::request_schema::{Request, Response};
28
29 use crate::context::Context;
30 use crate::error::Error;
31
32 pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
33 Ok(objectiveai_sdk::cli::command::ResponseSchema(
34 schemars::schema_for!(sdk::Request),
35 ))
36 }
37}
38
39pub mod response_schema {
40 use objectiveai_sdk::cli::command::agents::queue::read::id as sdk;
41 use objectiveai_sdk::cli::command::agents::queue::read::id::response_schema::{Request, Response};
42
43 use crate::context::Context;
44 use crate::error::Error;
45
46 pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
47 Ok(objectiveai_sdk::cli::command::ResponseSchema(
48 schemars::schema_for!(sdk::Response),
49 ))
50 }
51}