use crate::error::MisarDevError;
use crate::transport::Transport;
use crate::transport::body_or_empty;
use reqwest::Method;
use serde_json::Value;
#[derive(Debug, Clone, Copy)]
pub struct BillingResource<'a> {
pub(crate) t: &'a Transport,
}
impl BillingResource<'_> {
pub async fn checkout(self, body: Option<Value>) -> Result<Value, MisarDevError> {
self.t.request(Method::POST, "/billing/checkout", "", Some(body_or_empty(body))).await
}
pub async fn comparison(self) -> Result<Value, MisarDevError> {
self.t.request(Method::GET, "/billing/comparison", "", None).await
}
pub async fn plans(self) -> Result<Value, MisarDevError> {
self.t.request(Method::GET, "/billing/plans", "", None).await
}
pub async fn subscription(self) -> Result<Value, MisarDevError> {
self.t.request(Method::GET, "/billing/subscription", "", None).await
}
pub async fn switch_plan(self, body: Option<Value>) -> Result<Value, MisarDevError> {
self.t.request(Method::POST, "/billing/switch-plan", "", Some(body_or_empty(body))).await
}
}