bachs-sdk 0.1.0

Unofficial Rust SDK for the Bachs API — payments and billing for internet businesses.
Documentation
use crate::client::Bachs;
use crate::common::{FlexObject, Money};
use crate::error::BachsResult;
use reqwest::Method;
use serde::Deserialize;

/// Your organization's Bachs account: balances and settlement details.
#[derive(Debug, Clone, Deserialize)]
pub struct Account {
    #[serde(default)]
    pub account_id: Option<String>,
    #[serde(default)]
    pub settlement_currency: Option<String>,
    #[serde(default)]
    pub balances: Vec<Money>,
    #[serde(flatten)]
    pub extra: FlexObject,
}

pub struct Accounts<'a> {
    pub(crate) client: &'a Bachs,
}

impl<'a> Accounts<'a> {
    /// Retrieve your organization's account: balances and settlement info.
    pub async fn retrieve(&self) -> BachsResult<Account> {
        self.client
            .send::<(), _>(Method::GET, "/v1/accounts/me", None, None, None)
            .await
    }
}