mcapi 0.3.0

Unified async Rust client for the Minecraft ecosystem (Mojang, Modrinth, CurseForge, Yggdrasil, Blessing Skin, Loaders, BMCLAPI, and Java Runtimes)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::models::{ForgeUpdates, Statistics};
use super::{ModrinthClient, encode_id_or_slug};
use crate::error::Result;

impl ModrinthClient {
    /// Fetches global Modrinth statistics via `GET /v2/statistics`.
    pub async fn statistics(&self) -> Result<Statistics> {
        self.get_json("/statistics").await
    }

    /// Fetches Forge update checker JSON for a project via
    /// `GET /updates/{id|slug}/forge_updates.json`.
    pub async fn forge_updates(&self, id_or_slug: &str) -> Result<ForgeUpdates> {
        let seg = encode_id_or_slug(id_or_slug)?;
        let url = format!("{}/updates/{seg}/forge_updates.json", self.base_url());
        self.http().get_json(&url).await
    }
}