use polynode::{PolyNodeClient, V3RequestOptions};
#[tokio::main]
async fn main() -> polynode::Result<()> {
let client = PolyNodeClient::new(std::env::var("POLYNODE_API_KEY").unwrap())?;
let stats = client.v3()
.execute_named("GET /v3/stats", V3RequestOptions::default())
.await?;
let health = client.healthz().await?;
let results = client.search_events("bitcoin", Some(5)).await?;
let typed_markets = match results.events.first() {
Some(event) => event.typed_markets()?,
None => Vec::new(),
};
let condition_id = typed_markets.first().and_then(|market| market.condition_id.as_deref());
println!("{stats:#} {health} {} {condition_id:?}", results.events.len());
Ok(())
}