pub mod models;
use crate::apis::client::Client;
pub struct Modules<'c> {
client: &'c Client,
}
impl<'c> Modules<'c> {
pub fn new(client: &'c Client) -> Self {
Self { client }
}
}
impl Modules<'_> {
pub async fn list(&self) -> crate::errors::Result<Vec<models::Module>> {
self.client.get("/asterisk/modules").await
}
pub async fn get(
&self,
name: impl Into<String> + Send,
) -> crate::errors::Result<models::Module> {
self.client
.get(format!("/asterisk/modules/{}", name.into(),).as_str())
.await
}
pub async fn load(&self, name: impl Into<String> + Send) -> crate::errors::Result<()> {
self.client
.post(
format!("/asterisk/modules/{}", name.into(),).as_str(),
vec![] as Vec<String>,
)
.await
}
pub async fn unload(&self, name: impl Into<String> + Send) -> crate::errors::Result<()> {
self.client
.delete(format!("/asterisk/modules/{}", name.into()).as_str())
.await
}
pub async fn reload(&self, name: impl Into<String> + Send) -> crate::errors::Result<()> {
self.client
.put(
format!("/asterisk/modules/{}", name.into()).as_str(),
vec![] as Vec<String>,
)
.await
}
}