Skip to main content

lichess_api/api/
fide.rs

1//! Look up FIDE-rated players and their rating history.
2//!
3//! Search by name with [`LichessApi::search_fide_player`], fetch a single
4//! [`Player`] by FIDE ID with [`LichessApi::get_fide_player`], and get their
5//! historical standard, rapid, and blitz ratings with
6//! [`LichessApi::get_fide_player_ratings`]. This data is public and does not
7//! require a token.
8
9use crate::client::LichessApi;
10use crate::error::Result;
11use crate::model::fide::*;
12
13impl LichessApi<reqwest::Client> {
14    pub async fn search_fide_player(
15        &self,
16        request: impl Into<search::GetRequest>,
17    ) -> Result<Vec<Player>> {
18        self.get_single_model(request.into()).await
19    }
20
21    pub async fn get_fide_player(&self, request: impl Into<player::GetRequest>) -> Result<Player> {
22        self.get_single_model(request.into()).await
23    }
24
25    pub async fn get_fide_player_ratings(
26        &self,
27        request: impl Into<ratings::GetRequest>,
28    ) -> Result<ratings::PlayerRatings> {
29        self.get_single_model(request.into()).await
30    }
31}