1use futures::stream::StreamExt;
15
16use crate::client::LichessApi;
17use crate::error::Result;
18use crate::model::board::*;
19
20impl LichessApi<reqwest::Client> {
21 pub async fn board_abort_game(&self, request: impl Into<abort::PostRequest>) -> Result<bool> {
22 self.get_ok(request.into()).await
23 }
24
25 pub async fn board_berserk_game(
26 &self,
27 request: impl Into<berserk::PostRequest>,
28 ) -> Result<bool> {
29 self.get_ok(request.into()).await
30 }
31
32 pub async fn board_stream_game_chat(
33 &self,
34 request: impl Into<chat::GetRequest>,
35 ) -> Result<impl StreamExt<Item = Result<Vec<chat::ChatLine>>>> {
36 self.get_streamed_models(request.into()).await
37 }
38
39 pub async fn board_write_in_chat(&self, request: impl Into<chat::PostRequest>) -> Result<bool> {
40 self.get_ok(request.into()).await
41 }
42
43 pub async fn board_claim_draw(
44 &self,
45 request: impl Into<claim_draw::PostRequest>,
46 ) -> Result<bool> {
47 self.get_ok(request.into()).await
48 }
49
50 pub async fn board_claim_victory(
51 &self,
52 request: impl Into<claim_victory::PostRequest>,
53 ) -> Result<bool> {
54 self.get_ok(request.into()).await
55 }
56
57 pub async fn board_handle_draw(&self, request: impl Into<draw::PostRequest>) -> Result<bool> {
58 self.get_ok(request.into()).await
59 }
60
61 pub async fn board_make_move(&self, request: impl Into<r#move::PostRequest>) -> Result<bool> {
62 self.get_ok(request.into()).await
63 }
64
65 pub async fn board_resign_game(&self, request: impl Into<resign::PostRequest>) -> Result<bool> {
66 self.get_ok(request.into()).await
67 }
68
69 pub async fn board_create_a_seek(
70 &self,
71 request: impl Into<seek::PostRequest>,
72 ) -> Result<impl StreamExt<Item = Result<serde_json::Value>>> {
73 self.get_streamed_models(request.into()).await
74 }
75
76 pub async fn board_stream_incoming_events(
77 &self,
78 request: impl Into<stream::events::GetRequest>,
79 ) -> Result<impl StreamExt<Item = Result<stream::events::Event>>> {
80 self.get_streamed_models(request.into()).await
81 }
82
83 pub async fn board_stream_board_state(
84 &self,
85 request: impl Into<stream::game::GetRequest>,
86 ) -> Result<impl StreamExt<Item = Result<stream::game::Event>>> {
87 self.get_streamed_models(request.into()).await
88 }
89
90 pub async fn board_handle_takeback(
91 &self,
92 request: impl Into<takeback::PostRequest>,
93 ) -> Result<bool> {
94 self.get_ok(request.into()).await
95 }
96}