chore: update api for cancel request
This commit is contained in:
parent
e626917d71
commit
8186b3836b
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue