mangadex_api/v5/custom_list/
id.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
pub mod batch_manga;
#[cfg(feature = "custom_list_v2")]
pub mod bookmark;
#[cfg(feature = "custom_list_v2")]
pub mod default;
pub mod delete;
pub mod feed;
pub mod follow;
pub mod get;
#[cfg(feature = "custom_list_v2")]
pub mod manga;
#[cfg(feature = "custom_list_v2")]
pub mod pin;
pub mod put;
#[cfg(feature = "custom_list_v2")]
pub mod unpin;

use batch_manga::BatchMangaEndpoint;
#[cfg(feature = "custom_list_v2")]
use bookmark::BookMarkEndpoint;
#[cfg(feature = "custom_list_v2")]
use default::DefaultEndpoint;
use delete::DeleteCustomListBuilder;
use feed::FeedEndPoint;
use follow::FollowEndpoint;
use get::GetCustomListBuilder;
#[cfg(feature = "custom_list_v2")]
use manga::MangaEndpoint;
#[cfg(feature = "custom_list_v2")]
use pin::PinEndpoint;
use put::UpdateCustomListBuilder;
#[cfg(feature = "custom_list_v2")]
use unpin::UnPinEndpoint;

use uuid::Uuid;

use crate::HttpClientRef;

pub struct IdEnpoint {
    http_client: HttpClientRef,
    id: Uuid,
}

impl IdEnpoint {
    #[doc(hidden)]
    pub fn new(http_client: HttpClientRef, id: Uuid) -> Self {
        Self { http_client, id }
    }
    pub fn batch_manga(&self) -> BatchMangaEndpoint {
        BatchMangaEndpoint::new(self.http_client.clone(), self.id)
    }
    cfg_custom_list_v2! {
        pub fn bookmark(&self) -> BookMarkEndpoint {
            BookMarkEndpoint::new(self.http_client.clone(), self.id)
        }
    }
    cfg_custom_list_v2! {
        pub fn default(&self) -> DefaultEndpoint {
            DefaultEndpoint::new(self.http_client.clone(), self.id)
        }
    }
    pub fn feed(&self) -> FeedEndPoint {
        FeedEndPoint::new(self.http_client.clone(), self.id)
    }
    cfg_custom_list_v2! {
        pub fn manga(&self) -> MangaEndpoint {
            MangaEndpoint::new(self.http_client.clone(), self.id)
        }
    }
    pub fn get(&self) -> GetCustomListBuilder {
        GetCustomListBuilder::default()
            .list_id(self.id)
            .http_client(self.http_client.clone())
    }
    cfg_custom_list_v2! {
        pub fn pin(&self) -> PinEndpoint {
            PinEndpoint::new(self.http_client.clone(), self.id)
        }
    }
    cfg_custom_list_v2! {
        pub fn unpin(&self) -> UnPinEndpoint {
            UnPinEndpoint::new(self.http_client.clone(), self.id)
        }
    }
    pub fn delete(&self) -> DeleteCustomListBuilder {
        DeleteCustomListBuilder::default()
            .list_id(self.id)
            .http_client(self.http_client.clone())
    }
    pub fn put(&self) -> UpdateCustomListBuilder {
        UpdateCustomListBuilder::default()
            .list_id(self.id)
            .http_client(self.http_client.clone())
    }
    /// Pretty much the same as `.bookmark()`
    #[cfg_attr(
        feature = "custom_list_v2",
        deprecated(since = "3.0.0-alpha.1", note = "Use `.bookmark()` instead")
    )]
    pub fn follow(&self) -> FollowEndpoint {
        FollowEndpoint::new(self.http_client.to_owned(), self.id)
    }
}