Skip to main content

hypixel/endpoints/
resources.rs

1use serde_json::Value;
2
3use crate::client::HypixelClient;
4use crate::error::Result;
5use crate::models::resources::*;
6
7impl HypixelClient {
8    /// Fetch the network game definitions. Keyless.
9    pub async fn resource_games(&self) -> Result<std::collections::HashMap<String, Game>> {
10        let resp: GamesResponse = self.request("/v2/resources/games", &[], false).await?;
11        Ok(resp.games)
12    }
13
14    /// Fetch the achievements resource as raw JSON. Keyless.
15    pub async fn resource_achievements(&self) -> Result<Value> {
16        self.request("/v2/resources/achievements", &[], false).await
17    }
18
19    /// Fetch the challenges resource as raw JSON. Keyless.
20    pub async fn resource_challenges(&self) -> Result<Value> {
21        self.request("/v2/resources/challenges", &[], false).await
22    }
23
24    /// Fetch the quests resource as raw JSON. Keyless.
25    pub async fn resource_quests(&self) -> Result<Value> {
26        self.request("/v2/resources/quests", &[], false).await
27    }
28
29    /// Fetch the guild achievements resource as raw JSON. Keyless.
30    pub async fn resource_guild_achievements(&self) -> Result<Value> {
31        self.request("/v2/resources/guilds/achievements", &[], false)
32            .await
33    }
34
35    /// Fetch the vanity pets resource as raw JSON. Keyless.
36    pub async fn resource_vanity_pets(&self) -> Result<Value> {
37        self.request("/v2/resources/vanity/pets", &[], false).await
38    }
39
40    /// Fetch the vanity companions resource as raw JSON. Keyless.
41    pub async fn resource_vanity_companions(&self) -> Result<Value> {
42        self.request("/v2/resources/vanity/companions", &[], false)
43            .await
44    }
45
46    /// Fetch the SkyBlock collections resource. Keyless.
47    pub async fn resource_skyblock_collections(&self) -> Result<CollectionsResource> {
48        self.request("/v2/resources/skyblock/collections", &[], false)
49            .await
50    }
51
52    /// Fetch the SkyBlock skills resource, including per-level XP tables. Keyless.
53    pub async fn resource_skyblock_skills(&self) -> Result<SkillsResource> {
54        self.request("/v2/resources/skyblock/skills", &[], false)
55            .await
56    }
57
58    /// Fetch the SkyBlock item definitions. Keyless.
59    pub async fn resource_skyblock_items(&self) -> Result<Vec<SkyBlockItem>> {
60        let resp: ItemsResponse = self
61            .request("/v2/resources/skyblock/items", &[], false)
62            .await?;
63        Ok(resp.items)
64    }
65
66    /// Fetch the current SkyBlock mayor and election state. Keyless.
67    pub async fn resource_skyblock_election(&self) -> Result<ElectionResource> {
68        self.request("/v2/resources/skyblock/election", &[], false)
69            .await
70    }
71
72    /// Fetch the currently deployed resource packs. Keyless.
73    pub async fn resource_packs(&self) -> Result<Vec<ResourcePack>> {
74        let resp: PacksResponse = self.request("/v2/resources/packs", &[], false).await?;
75        Ok(resp.packs)
76    }
77
78    /// Fetch the active SkyBlock bingo event as raw JSON. Keyless.
79    pub async fn resource_skyblock_bingo(&self) -> Result<Value> {
80        self.request("/v2/resources/skyblock/bingo", &[], false)
81            .await
82    }
83}