use crate::runtime::{client, Result};
use serde::Serialize;
pub async fn emit_debug<T: Serialize>(guid: &str, name: &str, message: &T) -> Result<()> {
let value = serde_json::to_value(message)?;
client::debug(guid, name, &value).await
}
pub async fn emit_output(guid: &str, output: &[u8], port: i32) -> Result<()> {
client::emit_output(guid, output, port).await
}
pub async fn emit_input(guid: &str, input: &[u8]) -> Result<()> {
client::emit_input(guid, input).await
}
pub async fn emit_error(guid: &str, name: &str, message: &str) -> Result<()> {
client::emit_error(guid, name, message).await
}
pub async fn emit_flow_event(guid: &str, name: &str) -> Result<()> {
client::emit_flow_event(guid, name).await
}
pub async fn app_request(request: &[u8], timeout: i32) -> Result<Vec<u8>> {
client::app_request(request, timeout).await
}
pub async fn app_request_v2(request: &[u8]) -> Result<Vec<u8>> {
client::app_request_v2(request).await
}
pub async fn app_publish(request: &[u8]) -> Result<()> {
client::app_publish(request).await
}
pub async fn app_download(id: &str, dir: &str, file: &str) -> Result<String> {
client::app_download(id, dir, file).await
}
pub async fn app_upload(id: &str, path: &str) -> Result<String> {
client::app_upload(id, path).await
}
pub async fn gateway_request(
method: &str,
endpoint: &str,
body: &str,
headers: std::collections::HashMap<String, String>,
) -> Result<client::GatewayResponse> {
client::gateway_request(method, endpoint, body, headers).await
}
pub async fn proxy_request(req: client::HttpRequest) -> Result<client::HttpResponse> {
client::proxy_request(req).await
}
pub async fn is_running() -> Result<bool> {
client::is_running().await
}
pub async fn get_port_connections(guid: &str, port: i32) -> Result<Vec<crate::runtime::NodeInfo>> {
client::get_port_connections(guid, port).await
}
pub async fn get_instance_access() -> Result<client::InstanceAccess> {
client::get_instance_access().await
}