sl4f_lib/paver/
commands.rs1use super::facade::PaverFacade;
6use super::types::Method;
7use crate::server::Facade;
8use anyhow::Error;
9use async_trait::async_trait;
10use serde_json::{from_value, to_value, Value};
11
12#[async_trait(?Send)]
13impl Facade for PaverFacade {
14 async fn handle_request(&self, method: String, args: Value) -> Result<Value, Error> {
15 match method.parse()? {
16 Method::QueryActiveConfiguration => {
17 let result = self.query_active_configuration().await?;
18 Ok(to_value(result)?)
19 }
20 Method::QueryCurrentConfiguration => {
21 let result = self.query_current_configuration().await?;
22 Ok(to_value(result)?)
23 }
24 Method::QueryConfigurationStatus => {
25 let result = self.query_configuration_status(from_value(args)?).await?;
26 Ok(to_value(result)?)
27 }
28 Method::ReadAsset => {
29 let result = self.read_asset(from_value(args)?).await?;
30 Ok(to_value(result)?)
31 }
32 }
33 }
34}