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
//! Feed endpoint handler.
//!
//! <https://api.mangadex.org/swagger.html#/Feed>
use uuid::Uuid;
use crate::v5::custom_list::id::feed::get::CustomListMangaFeedBuilder;
use crate::v5::user::follows::manga::get::FollowedMangaBuilder;
use crate::HttpClientRef;
/// Feed endpoint handler builder.
#[derive(Debug)]
pub struct FeedBuilder {
http_client: HttpClientRef,
}
impl FeedBuilder {
#[doc(hidden)]
pub(crate) fn new(http_client: HttpClientRef) -> Self {
Self { http_client }
}
/// Get the manga feed for the logged-in user.
///
/// <https://api.mangadex.org/docs/swagger.html#/Feed/get-user-follows-manga-feed>
///
/// # Examples
///
/// ```rust
/// use mangadex_api::v5::MangaDexClient;
/// use mangadex_api_types::{Password, Username};
///
/// # async fn run() -> anyhow::Result<()> {
/// let client = MangaDexClient::default();
///
/// let _login_res = client
/// .oauth()
/// .login()
/// .username(Username::parse("myusername")?)
/// .password(Password::parse("hunter23")?)
/// .send()
/// .await?;
///
/// let res = client
/// .feed()
/// .followed_manga()
/// .limit(1_u32)
/// .send()
/// .await?;
///
/// println!("results: {:?}", res);
/// # Ok(())
/// # }
/// ```
pub fn followed_manga(&self) -> FollowedMangaBuilder {
FollowedMangaBuilder::default().http_client(self.http_client.clone())
}
/// Get the manga feed for a given custom list.
///
/// <https://api.mangadex.org/docs/swagger.html#/Feed/get-list-id-feed>
///
/// Alias to [`MangaDexClient::custom_list().id(uuid::Uuid).feed().get()`](crate::v5::custom_list::id::feed::get::CustomListMangaFeedBuilder).
///
/// # Examples
///
/// ```rust
/// use mangadex_api::v5::MangaDexClient;
/// use uuid::Uuid;
///
/// # async fn run() -> anyhow::Result<()> {
/// let client = MangaDexClient::default();
///
/// let res = client
/// .feed()
/// .custom_list_manga(Uuid::new_v4())
/// .limit(1_u32)
/// .send()
/// .await?;
///
/// println!("results: {:?}", res);
/// # Ok(())
/// # }
/// ```
pub fn custom_list_manga(&self, list_id: Uuid) -> CustomListMangaFeedBuilder {
CustomListMangaFeedBuilder::default()
.list_id(list_id)
.http_client(self.http_client.clone())
}
}