A complete, rate-limiting, asynchronous Rust implementation of the Hypixel Public API with extensive SkyBlock support.
toml
[dependencies]
rs-pixel = "0.1.0"
You will need a Hypixel Api Key to access most endpoints (official documentation).
Use the default configuration
rust
let mut api = RsPixel::new("API KEY").await.unwrap();
Or configure the client, Minecraft username/UUID API type, and the rate limit strategy
rust
let config = ConfigBuilder::default()
.client(surf::Config::new().try_into().unwrap())
.minecraft_api_type(ApiType::PlayerDb)
.rate_limit_strategy(RateLimitStrategy::Error)
.into();
let mut api = RsPixel::from_config("API KEY", config).await.unwrap();
Print a player's name and rank ```rust let response = api.getplayerby_username("USERNAME").await.unwrap();
println!( "{} has the {} rank", response.getname().unwrap(), response.getrank() ); ```
Print a skyblock player's statistics ```rust let response = api.getskyblockprofilesbyname("USERNAME").await.unwrap(); let profile = response.getlastplayed_profile().unwrap();
println!( "Enderman Slayer XP: {}\nCombat Skill Level: {}\nCatacombs LeveL: {}", profile.getslayer("enderman").unwrap().currentexp, profile.getskill("combat").unwrap().level, profile.getcatacombs().unwrap().level ); ```
Print a skyblock player's inventory contents (NBT parsed to JSON) ```rust let response = api.getskyblockprofilesbyuuid("uuid").await.unwrap(); let profile = response.getlastplayed_profile().unwrap();
println!("Inventory Contents: {}", profile.get_inventory().unwrap()); ```
Get the first page and print the first auction ```rust let response = api.getskyblockauctions(0).await.unwrap(); let auction = response.auctions.get(0).unwrap();
println!( "The starting bid for a {} is {} coins", auction.itemname, auction.startingbid ); ```
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.