1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use async_std::stream::StreamExt;

use crate::client::LichessApi;
use crate::error::Result;
use crate::model::openings::*;

impl LichessApi<reqwest::Client> {
    pub async fn openings_masters(
        &self,
        request: masters::GetRequest,
    ) -> Result<OpeningExplorerJson> {
        self.get_single_model(request).await
    }

    pub async fn openings_lichess(
        &self,
        request: lichess::GetRequest,
    ) -> Result<OpeningExplorerJson> {
        self.get_single_model(request).await
    }

    pub async fn openings_player(
        &self,
        request: player::GetRequest,
    ) -> Result<OpeningExplorerJson> {
        self.get_single_model(request).await
    }

    pub async fn openings_otb(
        &self,
        request: otb::GetRequest,
    ) -> Result<impl StreamExt<Item = Result<String>>> {
        self.get_pgn(request).await
    }
}