church-core/test_sermon_json.rs
RTSDA 4d6b23beb3
Some checks are pending
iOS UniFFI Build / build-ios (push) Waiting to run
Initial commit: Church Core Rust library
Add church management API library with cross-platform support for iOS, Android, and WASM.
Features include event management, bulletin handling, contact forms, and authentication.
2025-08-16 19:25:01 -04:00

31 lines
1 KiB
Rust

use church_core::{ChurchApiClient, ChurchCoreConfig};
#[tokio::main]
async fn main() {
let config = ChurchCoreConfig::new();
match ChurchApiClient::new(config) {
Ok(client) => {
match client.get_recent_sermons(Some(5)).await {
Ok(sermons) => {
let client_sermons: Vec<church_core::ClientSermon> = sermons
.into_iter()
.map(church_core::ClientSermon::from)
.collect();
println!("🎬 Raw JSON output:");
match serde_json::to_string_pretty(&client_sermons) {
Ok(json) => println!("{}", json),
Err(e) => println!("❌ JSON serialization error: {}", e),
}
},
Err(e) => {
println!("❌ Failed to get sermons: {}", e);
}
}
}
Err(e) => {
println!("❌ Failed to create client: {}", e);
}
}
}