From 8186b3836b3a820d8744fbc59eb9d1ed68a18e7b Mon Sep 17 00:00:00 2001 From: Zack Fu Zi Xiang Date: Sun, 14 Jul 2024 01:12:53 +0800 Subject: [PATCH] chore: update api for cancel request --- libs/client-api/src/http_billing.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libs/client-api/src/http_billing.rs b/libs/client-api/src/http_billing.rs index 3b36fad0..45c8e765 100644 --- a/libs/client-api/src/http_billing.rs +++ b/libs/client-api/src/http_billing.rs @@ -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()