Welcome to Rust of Clans, the ultimate Clash of Clans API client for Rust! 🎮 Whether you're a seasoned clan leader, a strategy enthusiast, or simply love diving into the world of Clash of Clans, this package is here to make your life easier.
To use the Rust of Clans API client, you need to obtain an API key from the official Clash of Clans Developer Portal.
```rust use rustofclans::CoCClient;
async fn main() { // Create a new Clash of Clans API client let bearertoken = std::env::var("BEARERTOKEN").expect("env var BEARERTOKEN not set"); let cocclient = CoCClient::new(bearertoken.toowned(), None);
// Get information about a clan
let clan_tag = "#CLAN_TAG";
let clan_info = coc_client.get_clan_information(clan_tag).await;
match clan_info {
Ok(clan) => {
// Process clan information
println!("Clan Name: {}", clan.name);
println!("Clan Level: {}", clan.clan_level);
// ...
}
Err(error) => {
// Handle the error
eprintln!("Error: {}", error);
}
}
} ```
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
Before submitting a pull request, please ensure that your code adheres to the project's coding conventions and passes all tests.
This project is licensed under the MIT License.