asterisk_ari/apis/asterisk/dynamic_config/
mod.rs1pub mod models;
2pub mod params;
3
4use crate::apis::client::Client;
5use std::fmt::Display;
6
7pub struct DynamicConfiguration<'c> {
8 client: &'c Client,
9}
10
11impl<'c> DynamicConfiguration<'c> {
12 pub fn new(client: &'c Client) -> Self {
13 Self { client }
14 }
15
16 pub async fn get(
18 &self,
19 config_class: impl Into<String> + Send,
20 object_type: impl Into<String> + Send,
21 id: impl Into<String> + Send,
22 ) -> crate::errors::Result<models::ConfigTuple> {
23 self.client
24 .get(
25 format!(
26 "/asterisk/config/dynamic/{}/{}/{}",
27 config_class.into(),
28 object_type.into(),
29 id.into()
30 )
31 .as_str(),
32 )
33 .await
34 }
35
36 pub async fn put(&self, request: params::CreateUpdateRequest) -> crate::errors::Result<()> {
38 self.client
39 .put(
40 format!(
41 "/asterisk/config/dynamic/{}/{}/{}",
42 request.config_class, request.object_type, request.id
43 )
44 .as_str(),
45 request,
46 )
47 .await
48 }
49
50 pub async fn delete(
52 &self,
53 config_class: impl Into<String> + Display + Send,
54 object_type: impl Into<String> + Display + Send,
55 id: impl Into<String> + Display + Send,
56 ) -> crate::errors::Result<()> {
57 self.client
58 .delete(format!("/asterisk/config/dynamic/{config_class}/{object_type}/{id}",).as_str())
59 .await
60 }
61}