use crate::{gstd_types, Error, GstClient};
#[derive(Debug, Clone)]
pub struct Debug {
client: GstClient,
}
impl Debug {
pub(crate) fn new(client: &GstClient) -> Self {
Self {
client: client.clone(),
}
}
pub async fn enable(&self) -> Result<gstd_types::SuccessResponse, Error> {
let resp = self.client.put("debug/enable?name=true").await?;
self.client.process_resp(resp).await
}
pub async fn disable(&self) -> Result<gstd_types::SuccessResponse, Error> {
let resp = self.client.put("debug/enable?name=false").await?;
self.client.process_resp(resp).await
}
pub async fn reset(&self, value: bool) -> Result<gstd_types::SuccessResponse, Error> {
let val = if value { "true" } else { "false" };
let resp = self.client.put(&format!("debug/reset?name={val}")).await?;
self.client.process_resp(resp).await
}
pub async fn threshold(&self, value: &str) -> Result<gstd_types::SuccessResponse, Error> {
let resp = self
.client
.put(&format!("debug/threshold?name={value}"))
.await?;
self.client.process_resp(resp).await
}
pub async fn enable_color(&self) -> Result<gstd_types::SuccessResponse, Error> {
let resp = self.client.put("debug/color?name=true").await?;
self.client.process_resp(resp).await
}
pub async fn disable_color(&self) -> Result<gstd_types::SuccessResponse, Error> {
let resp = self.client.put("debug/color?name=false").await?;
self.client.process_resp(resp).await
}
}