use crate::core::{DeviceResponse, IntoBody, Result};
platform_service! {
EvolutionService
}
impl EvolutionService {
pub async fn request(
&self,
controller: &str,
action: &str,
body: impl IntoBody,
) -> Result<DeviceResponse> {
self.call(&format!("{controller}/{action}"), body).await
}
pub async fn call(&self, path: &str, body: impl IntoBody) -> Result<DeviceResponse> {
let path = format!("evolution/{}", path.trim_matches('/'));
Ok(DeviceResponse(self.base.post(&path, body).await?))
}
pub async fn queue(
&self,
controller: &str,
action: &str,
body: impl IntoBody,
) -> Result<DeviceResponse> {
self.call(&format!("{controller}/{action}/queue"), body)
.await
}
}