use crate::apis::client::Client;
pub mod models;
pub struct Recordings<'c> {
client: &'c Client,
}
impl<'c> Recordings<'c> {
pub fn new(client: &'c Client) -> Self {
Self { client }
}
pub fn stored(&self) -> StoredRecordings {
StoredRecordings::new(self.client)
}
pub fn live(&self) -> LiveRecordings {
LiveRecordings::new(self.client)
}
}
pub struct StoredRecordings<'c> {
client: &'c Client,
}
impl<'c> StoredRecordings<'c> {
pub fn new(client: &'c Client) -> Self {
Self { client }
}
}
impl StoredRecordings<'_> {
pub async fn list(&self) -> crate::errors::Result<Vec<models::StoredRecording>> {
self.client.get("/recordings/stored").await
}
pub async fn get(
&self,
recording_name: impl Into<String> + Send,
) -> crate::errors::Result<models::StoredRecording> {
self.client
.get(format!("/recordings/stored/{}", recording_name.into()).as_str())
.await
}
pub async fn delete(
&self,
recording_name: impl Into<String> + Send,
) -> crate::errors::Result<()> {
self.client
.delete(format!("/recordings/stored/{}", recording_name.into()).as_str())
.await
}
pub async fn file(
&self,
_recording_name: impl Into<String> + Send,
) -> crate::errors::Result<Vec<u8>> {
unimplemented!("This function is not implemented yet"); }
pub async fn copy(
&self,
recording_name: impl Into<String> + Send,
destination: impl Into<String> + Send,
) -> crate::errors::Result<models::StoredRecording> {
self.client
.post_with_query(
format!("/recordings/stored/{}/copy", recording_name.into()).as_str(),
vec![] as Vec<String>,
&[("destination", destination.into())],
)
.await
}
}
pub struct LiveRecordings<'c> {
client: &'c Client,
}
impl<'c> LiveRecordings<'c> {
pub fn new(client: &'c Client) -> Self {
Self { client }
}
}
impl LiveRecordings<'_> {
pub async fn list(&self) -> crate::errors::Result<Vec<models::LiveRecording>> {
self.client.get("/recordings/live").await
}
pub async fn get(
&self,
recording_name: impl Into<String> + Send,
) -> crate::errors::Result<models::LiveRecording> {
self.client
.get(format!("/recordings/live/{}", recording_name.into()).as_str())
.await
}
pub async fn discard(
&self,
recording_name: impl Into<String> + Send,
) -> crate::errors::Result<()> {
self.client
.delete(format!("/recordings/live/{}", recording_name.into()).as_str())
.await
}
pub async fn stop(
&self,
recording_name: impl Into<String> + Send,
) -> crate::errors::Result<models::StoredRecording> {
self.client
.post(
format!("/recordings/live/{}/stop", recording_name.into()).as_str(),
vec![] as Vec<String>,
)
.await
}
pub async fn pause(
&self,
recording_name: impl Into<String> + Send,
) -> crate::errors::Result<()> {
self.client
.post(
format!("/recordings/live/{}/pause", recording_name.into()).as_str(),
vec![] as Vec<String>,
)
.await
}
pub async fn unpause(
&self,
recording_name: impl Into<String> + Send,
) -> crate::errors::Result<()> {
self.client
.delete(format!("/recordings/live/{}/pause", recording_name.into()).as_str())
.await
}
pub async fn mute(
&self,
recording_name: impl Into<String> + Send,
) -> crate::errors::Result<()> {
self.client
.post(
format!("/recordings/live/{}/mute", recording_name.into()).as_str(),
vec![] as Vec<String>,
)
.await
}
pub async fn unmute(
&self,
recording_name: impl Into<String> + Send,
) -> crate::errors::Result<()> {
self.client
.delete(format!("/recordings/live/{}/mute", recording_name.into()).as_str())
.await
}
}