Crates.io | rust_of_clans |
lib.rs | rust_of_clans |
version | 0.7.0 |
source | src |
created_at | 2023-05-24 19:59:55.571208 |
updated_at | 2023-08-03 19:19:26.378177 |
description | A Clash of Clans API client |
homepage | |
repository | https://github.com/MikkelAas/rust-of-clans |
max_upload_size | |
id | 873697 |
size | 62,661 |
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.
use rust_of_clans::CoCClient;
#[tokio::main]
async fn main() {
// Create a new Clash of Clans API client
let bearer_token = std::env::var("BEARER_TOKEN").expect("env var BEARER_TOKEN not set");
let coc_client = CoCClient::new(bearer_token.to_owned(), 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.