lichess_api/api/
relations.rs

1use async_std::stream::StreamExt;
2
3use crate::client::LichessApi;
4use crate::error::Result;
5use crate::model::relations::*;
6use crate::model::users::UserExtended;
7
8impl LichessApi<reqwest::Client> {
9    pub async fn get_following(
10        &self,
11        request: impl Into<following::GetRequest>,
12    ) -> Result<impl StreamExt<Item = Result<UserExtended>>> {
13        self.get_streamed_models(request.into()).await
14    }
15
16    pub async fn follow_user(&self, request: impl Into<follow::PostRequest>) -> Result<bool> {
17        self.get_ok(request.into()).await
18    }
19
20    pub async fn unfollow_user(&self, request: impl Into<unfollow::PostRequest>) -> Result<bool> {
21        self.get_ok(request.into()).await
22    }
23
24    pub async fn block_user(&self, request: impl Into<block::PostRequest>) -> Result<bool> {
25        self.get_ok(request.into()).await
26    }
27
28    pub async fn unblock_user(&self, request: impl Into<unblock::PostRequest>) -> Result<bool> {
29        self.get_ok(request.into()).await
30    }
31}