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