use super::Client;
use crate::{error::Result, requests::streaming::Request, responses::streaming as responses};
pub struct Streaming<'a> {
pub(super) client: &'a Client,
}
impl Streaming<'_> {
#[doc(alias = "GetStreamStatus")]
pub async fn status(&self) -> Result<responses::StreamStatus> {
self.client.send_message(Request::GetStreamStatus).await
}
#[doc(alias = "ToggleStream")]
pub async fn toggle(&self) -> Result<bool> {
self.client
.send_message::<_, responses::OutputActive>(Request::ToggleStream)
.await
.map(|ts| ts.active)
}
#[doc(alias = "StartStream")]
pub async fn start(&self) -> Result<()> {
self.client.send_message(Request::StartStream).await
}
#[doc(alias = "StopStream")]
pub async fn stop(&self) -> Result<()> {
self.client.send_message(Request::StopStream).await
}
#[doc(alias = "SendStreamCaption")]
pub async fn send_caption(&self, caption_text: &str) -> Result<()> {
self.client
.send_message(Request::SendStreamCaption { caption_text })
.await
}
}