use serde::{Deserialize, Serialize};
use super::{ManagementClient, Result};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BalanceResponse {
pub balance_micro_usd: i64,
pub pending_debits_micro_usd: i64,
pub available_micro_usd: i64,
pub currency: String,
}
#[derive(Debug, Clone, Serialize)]
pub struct CheckoutSessionRequest {
pub amount_cents: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CheckoutSessionResponse {
pub id: String,
pub url: String,
}
impl ManagementClient {
pub async fn billing_balance(&self) -> Result<BalanceResponse> {
self.get_json("/v1/billing/balance").await
}
pub async fn create_checkout_session(
&self,
body: &CheckoutSessionRequest,
) -> Result<CheckoutSessionResponse> {
self.post_json("/v1/billing/checkout/sessions", body).await
}
}