use serde_json::json;
use crate::proxy::DaemonClient;
pub async fn capabilities(client: &DaemonClient) -> Result<String, String> {
client
.call("parslee.capabilities", json!({}))
.await
.and_then(|v| serde_json::to_string(&v).map_err(|e| e.to_string()))
}
#[allow(clippy::too_many_arguments)]
pub async fn m365_generate_document(
client: &DaemonClient,
content_brief: &str,
output_file_path: &str,
document_type: Option<&str>,
title: Option<&str>,
author: Option<&str>,
) -> Result<String, String> {
let mut params = json!({
"content_brief": content_brief,
"output_file_path": output_file_path,
});
if let Some(v) = document_type {
params["document_type"] = json!(v);
}
if let Some(v) = title {
params["title"] = json!(v);
}
if let Some(v) = author {
params["author"] = json!(v);
}
client
.call("parslee.m365.generate_document", params)
.await
.and_then(|v| serde_json::to_string(&v).map_err(|e| e.to_string()))
}