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