use std::sync::Arc;
use serde::Serialize;
use serde_json::Value;
use crate::client::Inner;
use crate::error::Result;
use crate::params;
#[derive(Clone, Debug)]
pub struct ContactProperties {
inner: Arc<Inner>,
}
impl ContactProperties {
pub(crate) fn new(inner: Arc<Inner>) -> Self {
Self { inner }
}
pub async fn create(&self, params: impl Serialize) -> Result<Value> {
self.inner
.call(
"POST",
"/v1/contact-properties",
crate::params::to_body(params)?,
)
.await
}
pub async fn list(&self, params: impl Serialize) -> Result<Value> {
self.inner
.call(
"GET",
&format!("/v1/contact-properties{}", params::query(params)?),
None,
)
.await
}
pub async fn update(&self, id: &str, params: impl Serialize) -> Result<Value> {
self.inner
.call(
"PATCH",
&format!("/v1/contact-properties/{}", crate::params::encode(id)),
crate::params::to_body(params)?,
)
.await
}
pub async fn delete(&self, id: &str) -> Result<Value> {
self.inner
.call(
"DELETE",
&format!("/v1/contact-properties/{}", crate::params::encode(id)),
None,
)
.await
}
}