lichess_api/api/
board.rs

1use async_std::stream::StreamExt;
2
3use crate::client::LichessApi;
4use crate::error::Result;
5use crate::model::board::*;
6
7impl LichessApi<reqwest::Client> {
8    pub async fn board_abort_game(&self, request: impl Into<abort::PostRequest>) -> Result<bool> {
9        self.get_ok(request.into()).await
10    }
11
12    pub async fn board_berserk_game(
13        &self,
14        request: impl Into<berserk::PostRequest>,
15    ) -> Result<bool> {
16        self.get_ok(request.into()).await
17    }
18
19    pub async fn board_stream_game_chat(
20        &self,
21        request: impl Into<chat::GetRequest>,
22    ) -> Result<impl StreamExt<Item = Result<Vec<chat::ChatLine>>>> {
23        self.get_streamed_models(request.into()).await
24    }
25
26    pub async fn board_write_in_chat(&self, request: impl Into<chat::PostRequest>) -> Result<bool> {
27        self.get_ok(request.into()).await
28    }
29
30    pub async fn board_claim_victory(
31        &self,
32        request: impl Into<claim_victory::PostRequest>,
33    ) -> Result<bool> {
34        self.get_ok(request.into()).await
35    }
36
37    pub async fn board_handle_draw(&self, request: impl Into<draw::PostRequest>) -> Result<bool> {
38        self.get_ok(request.into()).await
39    }
40
41    pub async fn board_make_move(&self, request: impl Into<r#move::PostRequest>) -> Result<bool> {
42        self.get_ok(request.into()).await
43    }
44
45    pub async fn board_resign_game(&self, request: impl Into<resign::PostRequest>) -> Result<bool> {
46        self.get_ok(request.into()).await
47    }
48
49    pub async fn board_create_a_seek(
50        &self,
51        request: impl Into<seek::PostRequest>,
52    ) -> Result<impl StreamExt<Item = Result<serde_json::Value>>> {
53        self.get_streamed_models(request.into()).await
54    }
55
56    pub async fn board_stream_incoming_events(
57        &self,
58        request: impl Into<stream::events::GetRequest>,
59    ) -> Result<impl StreamExt<Item = Result<stream::events::Event>>> {
60        self.get_streamed_models(request.into()).await
61    }
62
63    pub async fn board_stream_board_state(
64        &self,
65        request: impl Into<stream::game::GetRequest>,
66    ) -> Result<impl StreamExt<Item = Result<stream::game::Event>>> {
67        self.get_streamed_models(request.into()).await
68    }
69
70    pub async fn board_handle_takeback(
71        &self,
72        request: impl Into<takeback::PostRequest>,
73    ) -> Result<bool> {
74        self.get_ok(request.into()).await
75    }
76}