mangadex_api/v5/user/
id.rs

1#[cfg(feature = "custom_list_v2")]
2pub mod bookmark;
3pub mod follow;
4pub mod get;
5pub mod list;
6
7use crate::HttpClientRef;
8#[cfg(feature = "custom_list_v2")]
9use bookmark::BookmarkEndpoint;
10use follow::FollowEndpoint;
11use get::GetUserBuilder;
12use list::ListEndpoint;
13use uuid::Uuid;
14
15#[derive(Debug)]
16pub struct IdEndpoint {
17    http_client: HttpClientRef,
18    id: Uuid,
19}
20
21impl IdEndpoint {
22    pub fn new(http_client: HttpClientRef, id: Uuid) -> Self {
23        Self { http_client, id }
24    }
25
26    pub fn get(&self) -> GetUserBuilder {
27        GetUserBuilder::default()
28            .user_id(self.id)
29            .http_client(self.http_client.clone())
30    }
31
32    #[cfg_attr(
33        feature = "custom_list_v2",
34        deprecated(since = "3.0.0-alpha.1", note = "use .bookmark() instead")
35    )]
36    pub fn follow(&self) -> FollowEndpoint {
37        FollowEndpoint::new(self.http_client.clone(), self.id)
38    }
39
40    cfg_custom_list_v2! {
41        pub fn bookmark(&self) -> BookmarkEndpoint {
42            BookmarkEndpoint::new(self.http_client.clone(), self.id)
43        }
44    }
45
46    pub fn list(&self) -> ListEndpoint {
47        ListEndpoint::new(self.http_client.clone(), self.id)
48    }
49}