use thinkingdata::TDAnalytics;
use thinkingdata::TDError;
use thinkingdata::consumer::LogConsumer;
fn main() -> Result<(), TDError> {
let directory = std::env::temp_dir().join("thinkingdata-facade-quickstart");
let consumer = LogConsumer::new(directory.to_str().expect("utf-8 temp dir"))?;
let ta = TDAnalytics::new(consumer)?;
ta.set_super_properties(serde_json::json!({ "channel": "rust" }))?;
ta.track(
"account_id_123",
"purchase",
serde_json::json!({ "product_name": "Rust SDK", "price": 99.0 }),
)?;
ta.close()?;
println!("events written to {}", directory.display());
Ok(())
}