use crate::error::Error;
use crate::http::Client;
use crate::types::*;
pub struct Hub<'a> {
hub_id: String,
client: &'a Client,
}
impl<'a> Hub<'a> {
pub fn new(hub_id: impl Into<String>, client: &'a Client) -> Self {
Self {
hub_id: hub_id.into(),
client,
}
}
pub fn id(&self) -> &str {
&self.hub_id
}
pub async fn get(&self, expanded: Option<&[&str]>) -> Result<crate::types::Hub, Error> {
self.client.get_hub(&self.hub_id, expanded).await
}
pub async fn matches(
&self,
match_type: Option<&str>,
offset: Option<i64>,
limit: Option<i64>,
) -> Result<MatchesList, Error> {
self.client
.get_hub_matches(&self.hub_id, match_type, offset, limit)
.await
}
pub async fn members(
&self,
offset: Option<i64>,
limit: Option<i64>,
) -> Result<HubMembers, Error> {
self.client
.get_hub_members(&self.hub_id, offset, limit)
.await
}
pub async fn stats(&self, offset: Option<i64>, limit: Option<i64>) -> Result<HubStats, Error> {
self.client.get_hub_stats(&self.hub_id, offset, limit).await
}
}