QBCreatable

Trait QBCreatable 

Source
pub trait QBCreatable {
    // Required method
    fn can_create(&self) -> bool;
}
Expand description

Trait for entities that can be created in QuickBooks.

This trait defines the validation logic for determining whether an entity has the required fields to be successfully created via the QuickBooks API. Each entity implements its own validation rules based on QuickBooks requirements.

§Required Methods

  • can_create(): Returns true if the entity has all required fields for creation

§Examples

use quickbooks_types::{Customer, QBCreatable};

let mut customer = Customer::default();

// Check if customer can be created (will be false - missing required fields)
assert!(!customer.can_create());

// Add required field
customer.display_name = Some("John Doe".to_string());

// Now it can be created
assert!(customer.can_create());

§Implementation Notes

Different entities have different creation requirements:

  • Customer/Vendor: Requires display_name or individual name components
  • Account: Requires name and account_type or account_sub_type
  • Invoice: Requires customer reference and line items
  • Item: Requires name and type

Required Methods§

Source

fn can_create(&self) -> bool

Implementations on Foreign Types§

Source§

impl QBCreatable for Option<LineField>

Implementors§