lichess_api/api/analysis.rs
1//! Position analysis.
2//!
3//! Lichess maintains a database of cloud engine evaluations for positions it
4//! has already analyzed (mostly openings, around 320 million positions).
5//! [`LichessApi::get_cloud_evaluation`] looks one up by FEN and returns its
6//! principal variations if present, or an error if the position hasn't been
7//! evaluated. This endpoint is public and needs no bearer token; it's meant
8//! for occasional lookups, not bulk fetching — for that, use the exported
9//! evaluation database from lichess.org directly.
10
11use crate::client::LichessApi;
12use crate::error::Result;
13use crate::model::analysis::*;
14
15impl LichessApi<reqwest::Client> {
16 pub async fn get_cloud_evaluation(
17 &self,
18 request: impl Into<cloud::GetRequest>,
19 ) -> Result<cloud::Evaluation> {
20 self.get_single_model(request.into()).await
21 }
22}