pub struct Client { /* private fields */ }Expand description
CS2 API client. Cheap to clone; clones share one connection pool.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(api_key: impl Into<String>) -> Result<Self, Error>
pub fn new(api_key: impl Into<String>) -> Result<Self, Error>
Creates a client with an explicit API key.
Sourcepub fn from_env() -> Result<Self, Error>
pub fn from_env() -> Result<Self, Error>
Creates a client with the key from the CITO_API_KEY environment variable.
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Starts a ClientBuilder to set the base URL or timeout.
Sourcepub fn get_raw(
&self,
path: &str,
query: &[(&str, &str)],
) -> Result<Value, Error>
pub fn get_raw( &self, path: &str, query: &[(&str, &str)], ) -> Result<Value, Error>
Any endpoint. Returns the whole response envelope (success, data, meta).
Sourcepub fn get(&self, path: &str, query: &[(&str, &str)]) -> Result<Value, Error>
pub fn get(&self, path: &str, query: &[(&str, &str)]) -> Result<Value, Error>
Any endpoint. Returns data.
Sourcepub fn live(&self) -> Result<Value, Error>
pub fn live(&self) -> Result<Value, Error>
Every match being played now, with series score, current map and map score.
Sourcepub fn live_scoreboard(&self, match_id: &str) -> Result<Value, Error>
pub fn live_scoreboard(&self, match_id: &str) -> Result<Value, Error>
Round-level scoreboard for one live match: sides, round, player K/D/ADR, money.
Sourcepub fn upcoming(&self, limit: u32) -> Result<Value, Error>
pub fn upcoming(&self, limit: u32) -> Result<Value, Error>
Upcoming matches (the other clients default limit to 50).
Sourcepub fn results(&self, limit: u32) -> Result<Value, Error>
pub fn results(&self, limit: u32) -> Result<Value, Error>
Recent match results (the other clients default limit to 50).
Sourcepub fn match_player_stats(&self, match_id: &str) -> Result<Value, Error>
pub fn match_player_stats(&self, match_id: &str) -> Result<Value, Error>
Player stats for a match.
Sourcepub fn team(&self, team: &str) -> Result<Value, Error>
pub fn team(&self, team: &str) -> Result<Value, Error>
Team with roster and recent results. Accepts an id or a slug such as “vitality”.
Sourcepub fn team_matches(&self, team: &str, limit: u32) -> Result<Value, Error>
pub fn team_matches(&self, team: &str, limit: u32) -> Result<Value, Error>
A team’s matches (the other clients default limit to 20).
Sourcepub fn head_to_head(&self, team_a: &str, team_b: &str) -> Result<Value, Error>
pub fn head_to_head(&self, team_a: &str, team_b: &str) -> Result<Value, Error>
Head-to-head record between two teams.
Sourcepub fn player(&self, player: &str) -> Result<Value, Error>
pub fn player(&self, player: &str) -> Result<Value, Error>
Player profile. Accepts an id or a slug such as “donk”.
Sourcepub fn search_players(&self, query: &str, limit: u32) -> Result<Value, Error>
pub fn search_players(&self, query: &str, limit: u32) -> Result<Value, Error>
Search players by name (the other clients default limit to 10).
Sourcepub fn player_matches(&self, player: &str, limit: u32) -> Result<Value, Error>
pub fn player_matches(&self, player: &str, limit: u32) -> Result<Value, Error>
A player’s matches (the other clients default limit to 20).
Sourcepub fn events(&self, status: &str, limit: u32) -> Result<Value, Error>
pub fn events(&self, status: &str, limit: u32) -> Result<Value, Error>
status: “upcoming”, “live” or “recent” (anything else means “upcoming”).
Sourcepub fn world_ranking(&self, limit: u32) -> Result<Value, Error>
pub fn world_ranking(&self, limit: u32) -> Result<Value, Error>
World ranking (the other clients default limit to 30).
Sourcepub fn leaderboard(&self, metric: &str, limit: u32) -> Result<Value, Error>
pub fn leaderboard(&self, metric: &str, limit: u32) -> Result<Value, Error>
metric: e.g. “rating”, “adr”, “kast”, “kd”, “kills”, “opening-kills”.
Sourcepub fn transfers(&self, limit: u32) -> Result<Value, Error>
pub fn transfers(&self, limit: u32) -> Result<Value, Error>
Recent roster transfers (the other clients default limit to 50).
Sourcepub fn search(&self, query: &str) -> Result<Value, Error>
pub fn search(&self, query: &str) -> Result<Value, Error>
Teams, players, events and matches matching a name.
Sourcepub fn search_skins(
&self,
query: Option<&str>,
filters: &[(&str, &str)],
) -> Result<Value, Error>
pub fn search_skins( &self, query: Option<&str>, filters: &[(&str, &str)], ) -> Result<Value, Error>
Search one word at a time (“redline”), or pass filters such as
[("weapon", "AK-47"), ("skin_name", "Redline")] for an exact skin.
Sourcepub fn skin_prices(&self, slug: &str) -> Result<Value, Error>
pub fn skin_prices(&self, slug: &str) -> Result<Value, Error>
The skin’s price on every marketplace, with listing counts and buy links.