chore: add get subscription plan details

This commit is contained in:
Zack Fu Zi Xiang 2024-07-19 23:10:06 +08:00
parent 37a8b9bfc7
commit bacb7c4ae6
No known key found for this signature in database
1 changed files with 18 additions and 1 deletions

View File

@ -1,6 +1,7 @@
use crate::Client;
use client_api_entity::billing_dto::{
SetSubscriptionRecurringInterval, SubscriptionCancelRequest, WorkspaceUsageAndLimit,
SetSubscriptionRecurringInterval, SubscriptionCancelRequest, SubscriptionPlanDetail,
WorkspaceUsageAndLimit,
};
use reqwest::Method;
use shared_entity::{
@ -198,4 +199,20 @@ impl Client {
AppResponse::<()>::from_response(resp).await?.into_error()
}
/// get all subscription plan details
pub async fn get_subscription_plan_details(
&self,
) -> Result<Vec<SubscriptionPlanDetail>, AppResponseError> {
let url = format!("{}/billing/api/v1/subscriptions", self.base_billing_url(),);
let resp = self
.http_client_with_auth(Method::POST, &url)
.await?
.send()
.await?;
AppResponse::<Vec<SubscriptionPlanDetail>>::from_response(resp)
.await?
.into_data()
}
}