mangadex_api/v5/custom_list/
id.rs

1pub mod batch_manga;
2#[cfg(feature = "custom_list_v2")]
3pub mod bookmark;
4#[cfg(feature = "custom_list_v2")]
5pub mod default;
6pub mod delete;
7pub mod feed;
8pub mod follow;
9pub mod get;
10#[cfg(feature = "custom_list_v2")]
11pub mod manga;
12#[cfg(feature = "custom_list_v2")]
13pub mod pin;
14pub mod put;
15#[cfg(feature = "custom_list_v2")]
16pub mod unpin;
17
18use batch_manga::BatchMangaEndpoint;
19#[cfg(feature = "custom_list_v2")]
20use bookmark::BookMarkEndpoint;
21#[cfg(feature = "custom_list_v2")]
22use default::DefaultEndpoint;
23use delete::DeleteCustomListBuilder;
24use feed::FeedEndPoint;
25use follow::FollowEndpoint;
26use get::GetCustomListBuilder;
27#[cfg(feature = "custom_list_v2")]
28use manga::MangaEndpoint;
29#[cfg(feature = "custom_list_v2")]
30use pin::PinEndpoint;
31use put::UpdateCustomListBuilder;
32#[cfg(feature = "custom_list_v2")]
33use unpin::UnPinEndpoint;
34
35use uuid::Uuid;
36
37use crate::HttpClientRef;
38
39pub struct IdEnpoint {
40    http_client: HttpClientRef,
41    id: Uuid,
42}
43
44impl IdEnpoint {
45    #[doc(hidden)]
46    pub fn new(http_client: HttpClientRef, id: Uuid) -> Self {
47        Self { http_client, id }
48    }
49    pub fn batch_manga(&self) -> BatchMangaEndpoint {
50        BatchMangaEndpoint::new(self.http_client.clone(), self.id)
51    }
52    cfg_custom_list_v2! {
53        pub fn bookmark(&self) -> BookMarkEndpoint {
54            BookMarkEndpoint::new(self.http_client.clone(), self.id)
55        }
56    }
57    cfg_custom_list_v2! {
58        pub fn default(&self) -> DefaultEndpoint {
59            DefaultEndpoint::new(self.http_client.clone(), self.id)
60        }
61    }
62    pub fn feed(&self) -> FeedEndPoint {
63        FeedEndPoint::new(self.http_client.clone(), self.id)
64    }
65    cfg_custom_list_v2! {
66        pub fn manga(&self) -> MangaEndpoint {
67            MangaEndpoint::new(self.http_client.clone(), self.id)
68        }
69    }
70    pub fn get(&self) -> GetCustomListBuilder {
71        GetCustomListBuilder::default()
72            .list_id(self.id)
73            .http_client(self.http_client.clone())
74    }
75    cfg_custom_list_v2! {
76        pub fn pin(&self) -> PinEndpoint {
77            PinEndpoint::new(self.http_client.clone(), self.id)
78        }
79    }
80    cfg_custom_list_v2! {
81        pub fn unpin(&self) -> UnPinEndpoint {
82            UnPinEndpoint::new(self.http_client.clone(), self.id)
83        }
84    }
85    pub fn delete(&self) -> DeleteCustomListBuilder {
86        DeleteCustomListBuilder::default()
87            .list_id(self.id)
88            .http_client(self.http_client.clone())
89    }
90    pub fn put(&self) -> UpdateCustomListBuilder {
91        UpdateCustomListBuilder::default()
92            .list_id(self.id)
93            .http_client(self.http_client.clone())
94    }
95    /// Pretty much the same as `.bookmark()`
96    #[cfg_attr(
97        feature = "custom_list_v2",
98        deprecated(since = "3.0.0-alpha.1", note = "Use `.bookmark()` instead")
99    )]
100    pub fn follow(&self) -> FollowEndpoint {
101        FollowEndpoint::new(self.http_client.to_owned(), self.id)
102    }
103}