mcsr-ranked-api 0.6.7

MCSR Ranked API wrapper in Rust
Documentation
#[cfg(feature = "blocking")]
use crate::helpers::make_request_blocking;
use crate::{Result, helpers::make_request, types::WeeklyRaceId};

use super::WeeklyRaceLeaderboardInfo;

impl WeeklyRaceLeaderboardInfo {
	/// GET the weekly race leaderboard using given weekly `race_id`
	pub async fn get_by_id(race_id: WeeklyRaceId) -> Result<Self> {
		make_request!("https://api.mcsrranked.com/weekly-race/{}"[race_id])
	}

	/// GET the current weekly race leaderboard
	pub async fn get_current() -> Result<Self> {
		make_request!("https://api.mcsrranked.com/weekly-race/"[])
	}
}

#[cfg(feature = "blocking")]
impl WeeklyRaceLeaderboardInfo {
	/// Synchronously GET the weekly race leaderboard using given weekly `race_id`
	pub fn get_by_id_blocking(race_id: WeeklyRaceId) -> Result<Self> {
		make_request_blocking!("https://api.mcsrranked.com/weekly-race/{}"[race_id])
	}

	/// Synchronously GET the current weekly race leaderboard
	pub fn get_current_blocking() -> Result<Self> {
		make_request_blocking!("https://api.mcsrranked.com/weekly-race/"[])
	}
}