chore: update api for cancel request

This commit is contained in:
Zack Fu Zi Xiang 2024-07-14 01:12:53 +08:00
parent e626917d71
commit 8186b3836b
No known key found for this signature in database
1 changed files with 3 additions and 8 deletions

View File

@ -1,7 +1,6 @@
use crate::Client;
use client_api_entity::billing_dto::WorkspaceUsageAndLimit;
use client_api_entity::billing_dto::{SubscriptionCancelRequest, WorkspaceUsageAndLimit};
use reqwest::Method;
use serde_json::json;
use shared_entity::{
dto::billing_dto::{RecurringInterval, SubscriptionPlan, WorkspaceSubscriptionStatus},
response::{AppResponse, AppResponseError},
@ -68,8 +67,7 @@ impl Client {
pub async fn cancel_subscription(
&self,
workspace_id: &str,
plan: &SubscriptionPlan,
req: &SubscriptionCancelRequest,
) -> Result<(), AppResponseError> {
let url = format!(
"{}/billing/api/v1/cancel-subscription",
@ -78,10 +76,7 @@ impl Client {
let resp = self
.http_client_with_auth(Method::POST, &url)
.await?
.json(&json!({
"workspace_id": workspace_id,
"plan": plan.as_ref(),
}))
.json(req)
.send()
.await?;
AppResponse::<()>::from_response(resp).await?.into_error()