use std::sync::Arc;
use crate::client::HttpCore;
use crate::error::Result;
use crate::types::*;
#[derive(Debug, Clone)]
pub struct PriceAlerts {
pub(crate) core: Arc<HttpCore>,
}
impl PriceAlerts {
pub async fn list(&self) -> Result<PriceAlertListResponse> {
self.core.get("/price-alerts", &()).await
}
pub async fn create(
&self,
params: &PriceAlertCreateParams,
) -> Result<PriceAlertCreateResponse> {
self.core.post_json("/price-alerts", params).await
}
pub async fn get(&self, id: i64) -> Result<PriceAlertGetResponse> {
self.core
.get(&format!("/price-alerts/{}", id), &())
.await
}
pub async fn update(
&self,
id: i64,
params: &PriceAlertUpdateParams,
) -> Result<PriceAlertUpdateResponse> {
self.core
.patch_json(&format!("/price-alerts/{}", id), params)
.await
}
pub async fn delete(&self, id: i64) -> Result<PriceAlertDeleteResponse> {
self.core
.delete(&format!("/price-alerts/{}", id))
.await
}
pub async fn events(
&self,
params: &PriceAlertEventsParams,
) -> Result<PriceAlertEventsResponse> {
self.core.get("/price-alerts/events", params).await
}
}