use std::sync::Arc;
use earthmc::{
client::ClientBuilder, model::query::SimpleQueryBuilder,
retry_strategy::NeverRetry,
};
use parking_lot::Mutex;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = ClientBuilder::default()
.retry_strategy(Arc::new(Mutex::new(NeverRetry)))
.build();
let query = SimpleQueryBuilder::default()
.insert("London")
.insert_many(["Berlin", "Paris", "Rome"])
.insert("this town doesn't exist") .build()?;
let towns = client.towns(query).await?;
for town in &towns {
println!(
"{}'s town, {}, has {} gold, {} residents, and {} town blocks.",
town.mayor.name,
town.name,
town.stats.balance,
town.stats.num_residents,
town.stats.num_town_blocks
);
}
Ok(())
}