pub trait QBItem:
Serialize
+ Default
+ Clone
+ Sized
+ DeserializeOwned
+ Debug
+ Send {
// Required methods
fn id(&self) -> Option<&String>;
fn clone_id(&self) -> Option<String>;
fn sync_token(&self) -> Option<&String>;
fn meta_data(&self) -> Option<&MetaData>;
fn name() -> &'static str;
fn qb_id() -> &'static str;
// Provided method
fn has_read(&self) -> bool { ... }
}Expand description
Core trait for all QuickBooks entities.
This trait defines the fundamental interface that all QuickBooks entities must implement.
It provides access to common fields like ID, sync token, and metadata that are present
on all QuickBooks objects, as well as type information for API operations.
§Required Methods
id(): Returns the entity’s unique identifierclone_id(): Returns a cloned copy of the IDsync_token(): Returns the synchronization token for updatesmeta_data(): Returns metadata about the entityname(): Returns the entity type name for API callsqb_id(): Returns the lowercase entity identifier for URLs
§Default Methods
has_read(): Returns true if the entity has both ID and sync token (indicates it was read from QB)
§Examples
use quickbooks_types::{QBItem, Customer};
let customer = Customer::default();
// Check if entity has been read from QuickBooks
if customer.has_read() {
println!("Customer ID: {:?}", customer.id());
println!("Sync Token: {:?}", customer.sync_token());
}
// Get type information
println!("Entity name: {}", Customer::name()); // "Customer"
println!("API identifier: {}", Customer::qb_id()); // "customer"Required Methods§
fn id(&self) -> Option<&String>
fn clone_id(&self) -> Option<String>
fn sync_token(&self) -> Option<&String>
fn meta_data(&self) -> Option<&MetaData>
fn name() -> &'static str
fn qb_id() -> &'static str
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.