lolapi 0.5.0

Rate limited League of Legends API wrapper (WIP)
Documentation
use {request, StatusCode};
use ratelimit_meter::LeakyBucket;
use std::fmt::Display;

pub struct Subclient<'a, K: 'a> {
	region: &'static str,
	key: &'a K,
	method_limits: &'a mut MethodLimits,
}
impl<'a, K: Display> Subclient<'a, K> {
	pub(super) fn new(region: &'static str, key: &'a K, method_limits: &'a mut MethodLimits) -> Self {
		Self { region: region, key: key, method_limits: method_limits }
	}

	/// "Retrieve supported languages data"
	///
	/// **Endpoint**: `/lol/static-data/v3/languages`
	pub fn get(&mut self) -> Result<Vec<String>, StatusCode> {
		let path = "/lol/static-data/v3/languages";
		request(self.region, self.key, path, &mut vec![], &mut self.method_limits.get)
	}
}

pub(super) struct MethodLimits {
	get: Vec<LeakyBucket>,
}
impl MethodLimits {
	pub fn new() -> Self {
		Self { get: vec![] }
	}
}

#[cfg(test)]
mod tests {
	#[test]
	fn get() {
		::CLIENT.lock().unwrap().static_data_v3().languages().get().unwrap();
	}
}