1use futures::stream::StreamExt;
14
15use crate::client::LichessApi;
16use crate::error::Result;
17use crate::model::games::GameJson;
18use crate::model::tv::*;
19
20impl LichessApi<reqwest::Client> {
21 pub async fn tv_channels(&self) -> Result<Channels> {
22 self.get_single_model(channels::GetRequest::new()).await
23 }
24
25 pub async fn tv_stream_current(&self) -> Result<impl StreamExt<Item = Result<stream::Event>>> {
26 self.get_streamed_models(stream::current::GetRequest::new())
27 .await
28 }
29
30 pub async fn tv_stream_channel_current(
31 &self,
32 request: impl Into<stream::channel::GetRequest>,
33 ) -> Result<impl StreamExt<Item = Result<stream::Event>>> {
34 self.get_streamed_models(request.into()).await
35 }
36
37 pub async fn tv_channel_games(
38 &self,
39 request: impl Into<games::GetRequest>,
40 ) -> Result<impl StreamExt<Item = Result<GameJson>>> {
41 self.get_streamed_models(request.into()).await
42 }
43}