wave-api 0.1.0

Typed Rust client for the Wave Accounting GraphQL API
Documentation
use rust_decimal::Decimal;
use serde::Deserialize;

use super::common::Currency;
use crate::enums::{AccountNormalBalanceType, AccountSubtypeValue, AccountTypeValue};

/// An account from the Chart of Accounts.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Account {
    pub id: String,
    pub name: String,
    pub description: Option<String>,
    pub display_id: Option<String>,
    pub currency: Currency,
    #[serde(rename = "type")]
    pub account_type: AccountType,
    pub subtype: AccountSubtype,
    pub normal_balance_type: AccountNormalBalanceType,
    pub is_archived: bool,
    pub sequence: i64,
    pub balance: Option<Decimal>,
    pub balance_in_business_currency: Option<Decimal>,
}

/// Account type descriptor.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AccountType {
    pub name: String,
    pub value: AccountTypeValue,
    pub normal_balance_type: AccountNormalBalanceType,
}

/// Account subtype descriptor.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AccountSubtype {
    pub name: String,
    pub value: AccountSubtypeValue,
    #[serde(rename = "type")]
    pub account_type: Option<AccountType>,
}