1use futures::stream::StreamExt;
16
17use crate::client::LichessApi;
18use crate::error::Result;
19use crate::model::bot::online::OnlineBot;
20use crate::model::bot::*;
21
22impl LichessApi<reqwest::Client> {
23 pub async fn bot_abort_game(&self, request: impl Into<abort::PostRequest>) -> Result<bool> {
24 self.get_ok(request.into()).await
25 }
26
27 pub async fn bot_stream_game_chat(
28 &self,
29 request: impl Into<chat::GetRequest>,
30 ) -> Result<impl StreamExt<Item = Result<chat::ChatLine>>> {
31 self.get_streamed_models(request.into()).await
32 }
33
34 pub async fn bot_write_in_chat(&self, request: impl Into<chat::PostRequest>) -> Result<bool> {
35 self.get_ok(request.into()).await
36 }
37
38 pub async fn bot_claim_draw(
39 &self,
40 request: impl Into<claim_draw::PostRequest>,
41 ) -> Result<bool> {
42 self.get_ok(request.into()).await
43 }
44
45 pub async fn bot_claim_victory(
46 &self,
47 request: impl Into<claim_victory::PostRequest>,
48 ) -> Result<bool> {
49 self.get_ok(request.into()).await
50 }
51
52 pub async fn bot_draw_game(&self, request: impl Into<draw::PostRequest>) -> Result<bool> {
53 self.get_ok(request.into()).await
54 }
55
56 pub async fn bot_make_move(&self, request: impl Into<r#move::PostRequest>) -> Result<bool> {
57 self.get_ok(request.into()).await
58 }
59
60 pub async fn bot_get_online(
61 &self,
62 request: impl Into<online::GetRequest>,
63 ) -> Result<impl StreamExt<Item = Result<OnlineBot>>> {
64 self.get_streamed_models(request.into()).await
65 }
66
67 pub async fn bot_resign_game(&self, request: impl Into<resign::PostRequest>) -> Result<bool> {
68 self.get_ok(request.into()).await
69 }
70
71 pub async fn bot_stream_incoming_events(
72 &self,
73 request: impl Into<stream::events::GetRequest>,
74 ) -> Result<impl StreamExt<Item = Result<stream::events::Event>>> {
75 self.get_streamed_models(request.into()).await
76 }
77
78 pub async fn bot_stream_board_state(
79 &self,
80 request: impl Into<stream::game::GetRequest>,
81 ) -> Result<impl StreamExt<Item = Result<stream::game::Event>>> {
82 self.get_streamed_models(request.into()).await
83 }
84
85 pub async fn bot_handle_takeback(
86 &self,
87 request: impl Into<takeback::PostRequest>,
88 ) -> Result<bool> {
89 self.get_ok(request.into()).await
90 }
91
92 pub async fn bot_upgrade_account(
93 &self,
94 request: impl Into<upgrade::PostRequest>,
95 ) -> Result<bool> {
96 self.get_ok(request.into()).await
97 }
98}