lichess_api/api/
relations.rs1use futures::stream::StreamExt;
9
10use crate::client::LichessApi;
11use crate::error::Result;
12use crate::model::relations::*;
13use crate::model::users::UserExtended;
14
15impl LichessApi<reqwest::Client> {
16 pub async fn get_following(
17 &self,
18 request: impl Into<following::GetRequest>,
19 ) -> Result<impl StreamExt<Item = Result<UserExtended>>> {
20 self.get_streamed_models(request.into()).await
21 }
22
23 pub async fn follow_user(&self, request: impl Into<follow::PostRequest>) -> Result<bool> {
24 self.get_ok(request.into()).await
25 }
26
27 pub async fn unfollow_user(&self, request: impl Into<unfollow::PostRequest>) -> Result<bool> {
28 self.get_ok(request.into()).await
29 }
30
31 pub async fn block_user(&self, request: impl Into<block::PostRequest>) -> Result<bool> {
32 self.get_ok(request.into()).await
33 }
34
35 pub async fn unblock_user(&self, request: impl Into<unblock::PostRequest>) -> Result<bool> {
36 self.get_ok(request.into()).await
37 }
38}