hypixel-sdk 0.2.0

Async client for the Hypixel Public API with typed models and SkyBlock helpers
Documentation
use serde_json::Value;

use crate::client::HypixelClient;
use crate::error::Result;
use crate::models::resources::*;

impl HypixelClient {
    /// Fetch the network game definitions. Keyless.
    pub async fn resource_games(&self) -> Result<std::collections::HashMap<String, Game>> {
        let resp: GamesResponse = self.request("/v2/resources/games", &[], false).await?;
        Ok(resp.games)
    }

    /// Fetch the achievements resource as raw JSON. Keyless.
    pub async fn resource_achievements(&self) -> Result<Value> {
        self.request("/v2/resources/achievements", &[], false).await
    }

    /// Fetch the challenges resource as raw JSON. Keyless.
    pub async fn resource_challenges(&self) -> Result<Value> {
        self.request("/v2/resources/challenges", &[], false).await
    }

    /// Fetch the quests resource as raw JSON. Keyless.
    pub async fn resource_quests(&self) -> Result<Value> {
        self.request("/v2/resources/quests", &[], false).await
    }

    /// Fetch the guild achievements resource as raw JSON. Keyless.
    pub async fn resource_guild_achievements(&self) -> Result<Value> {
        self.request("/v2/resources/guilds/achievements", &[], false)
            .await
    }

    /// Fetch the vanity pets resource as raw JSON. Keyless.
    pub async fn resource_vanity_pets(&self) -> Result<Value> {
        self.request("/v2/resources/vanity/pets", &[], false).await
    }

    /// Fetch the vanity companions resource as raw JSON. Keyless.
    pub async fn resource_vanity_companions(&self) -> Result<Value> {
        self.request("/v2/resources/vanity/companions", &[], false)
            .await
    }

    /// Fetch the SkyBlock collections resource. Keyless.
    pub async fn resource_skyblock_collections(&self) -> Result<CollectionsResource> {
        self.request("/v2/resources/skyblock/collections", &[], false)
            .await
    }

    /// Fetch the SkyBlock skills resource, including per-level XP tables. Keyless.
    pub async fn resource_skyblock_skills(&self) -> Result<SkillsResource> {
        self.request("/v2/resources/skyblock/skills", &[], false)
            .await
    }

    /// Fetch the SkyBlock item definitions. Keyless.
    pub async fn resource_skyblock_items(&self) -> Result<Vec<SkyBlockItem>> {
        let resp: ItemsResponse = self
            .request("/v2/resources/skyblock/items", &[], false)
            .await?;
        Ok(resp.items)
    }

    /// Fetch the current SkyBlock mayor and election state. Keyless.
    pub async fn resource_skyblock_election(&self) -> Result<ElectionResource> {
        self.request("/v2/resources/skyblock/election", &[], false)
            .await
    }

    /// Fetch the currently deployed resource packs. Keyless.
    pub async fn resource_packs(&self) -> Result<Vec<ResourcePack>> {
        let resp: PacksResponse = self.request("/v2/resources/packs", &[], false).await?;
        Ok(resp.packs)
    }

    /// Fetch the active SkyBlock bingo event as raw JSON. Keyless.
    pub async fn resource_skyblock_bingo(&self) -> Result<Value> {
        self.request("/v2/resources/skyblock/bingo", &[], false)
            .await
    }
}