lichess_api/api/
openings.rs

1use async_std::stream::StreamExt;
2
3use crate::client::LichessApi;
4use crate::error::Result;
5use crate::model::openings::*;
6
7impl LichessApi<reqwest::Client> {
8    pub async fn openings_masters(
9        &self,
10        request: impl Into<masters::GetRequest>,
11    ) -> Result<OpeningExplorerJson> {
12        self.get_single_model(request.into()).await
13    }
14
15    pub async fn openings_lichess(
16        &self,
17        request: impl Into<lichess::GetRequest>,
18    ) -> Result<OpeningExplorerJson> {
19        self.get_single_model(request.into()).await
20    }
21
22    pub async fn openings_player(
23        &self,
24        request: impl Into<player::GetRequest>,
25    ) -> Result<OpeningExplorerJson> {
26        self.get_single_model(request.into()).await
27    }
28
29    pub async fn openings_otb(
30        &self,
31        request: impl Into<otb::GetRequest>,
32    ) -> Result<impl StreamExt<Item = Result<String>>> {
33        self.get_pgn(request.into()).await
34    }
35}