Crate quickbooks_types

Crate quickbooks_types 

Source
Expand description

QuickBooks Online type models and helpers for Rust.

This crate defines strongly-typed data models for common QBO entities and reports, plus helper traits that validate local preconditions (for example, can_create and can_full_update). It does not make HTTP requests; bring your own client.

Modules and exports:

  • Top-level entities: Account, Attachable, Bill, BillPayment, CompanyInfo, Customer, Employee, Estimate, Invoice, Item, Payment, Preferences, SalesReceipt, Vendor
  • common: supporting types like NtRef, MetaData, addresses, phones, taxes, etc.
  • reports: report models and strongly-typed parameter builders

Features:

  • builder: derive builders and add an associated new() for most entities
  • polars: optional helpers for reports + Polars integration

Quick start (entities):

use chrono::NaiveDate;
use crate::{Invoice, Line, LineDetail, SalesItemLineDetail, QBCreatable};
use crate::common::NtRef;

let invoice = Invoice {
    customer_ref: Some(NtRef::from(("John Doe", "CUST-123"))),
    txn_date: NaiveDate::from_ymd_opt(2024, 10, 1),
    line: Some(vec![
        Line {
            amount: Some(100.0),
            line_detail: LineDetail::SalesItemLineDetail(SalesItemLineDetail {
                item_ref: Some(NtRef::from(("Widget A", "ITEM-001"))),
                qty: Some(1.0),
                unit_price: Some(100.0),
                ..Default::default()
            }),
            ..Default::default()
        }
    ]),
    ..Default::default()
};
assert!(invoice.can_create());

Reports parameters:

use chrono::NaiveDate;
use crate::reports::types::*;
use crate::reports::params::*;

let params = BalanceSheetParams::new()
    .accounting_method(AccountingMethod::Cash)
    .start_date(NaiveDate::from_ymd_opt(2024, 1, 1).unwrap())
    .end_date(NaiveDate::from_ymd_opt(2024, 12, 31).unwrap())
    .date_macro(DateMacro::ThisFiscalYear);
let query = params.to_query_string();
assert!(query.contains("accounting_method=Cash"));

Modules§

common
Common supporting value types used across QuickBooks entity models.
reports
QuickBooks Reports API types

Structs§

Account
Account
AccountBasedExpenseLineDetail
AccountBasedExpenseLineDetail
AccountingInfoPrefs
Accounting Info Preferences
Attachable
Attachable
AttachableRef
AttachableRef
Bill
Bill
BillPayment
BillPayment
CheckBillPayment
CheckBillPayment
CompanyInfo
CompanyInfo
ContactInfo
Contact Information
CreditCardBillPayment
CreditCardBillPayment
CurrencyPrefs
Currency Preferences
Customer
Customer
DescriptionLineDetail
DescriptionLineDetail
DiscountLineDetail
DiscountLineDetail
EmailMessagePrefs
Email Message Preferences
EmailMessageType
Email Message Type
Employee
Employee
Estimate
Estimate
GroupLineDetail
GroupLineDetail
Invoice
Invoice
Item
Item
ItemBasedExpenseLineDetail
ItemBasedExpenseLineDetail
Line
Line
OtherPrefs
Miscellaneous Other Preferences
Payment
Payment
Preferences
Preferences
ProductAndServicesPrefs
Product and Services Preferences
ReportPrefs
Report Preferences
SalesFormsPrefs
Sales Forms Preferences
SalesItemLineDetail
SalesItemLineDetail
SalesReceipt
SalesReceipt
SubTotalLineDetail
SubTotalLineDetail
TaxLineDetail
TaxLineDetail
TaxPrefs
Tax Preferences
TimeTrackingPrefs
Time Tracking Preferences
Vendor
Vendor
VendorAndPurchasesPrefs
Vendor and Purchases Preferences
VendorPaymentBankDetail
Vendor Payment Bank Detail

Enums§

AccountType
AccountType
AttachmentCategory
AttachmentCategory
BillableStatus
BillableStatus
ItemType
Item Type
LineDetail
LineDetail Enum
PayType
PayType
QBTypeError
Errors for Quickbooks validation / processing
TaxExemptStatus
TaxExemptStatus

Traits§

QBAttachable
Trait for all entities that can be attached as files/notes.
QBCreatable
Trait for entities that can be created in QuickBooks.
QBDeletable
Trait for entities that can be deleted from QuickBooks.
QBFullUpdatable
Trait for entities that support full update operations.
QBItem
Core trait for all QuickBooks entities.
QBPDFable
Trait for entities that can be generated as PDF documents.
QBQueryable
Trait for entities that can be queried from QuickBooks.
QBReadable
Trait for entities that can be read from QuickBooks by ID.
QBSendable
Trait for entities that can be sent via email from QuickBooks.
QBSparseUpdateable
Trait for entities that support sparse update operations.
QBToAttachableRef
Trait for entities that can be converted to a reference for an attachment.
QBToRef
Trait for entities that can be converted to QuickBooks entity references.
QBVoidable
Trait for entities that can be voided in QuickBooks.
TaxableLine
Trait for setting a line / line detail as taxable

Functions§

content_type_from_ext
Derives the content type from a file extension

Type Aliases§

LineField
LineField