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
//! Feed endpoint handler.
//!
//! <https://api.mangadex.org/swagger.html#/Feed>
use crate::v5::custom_list::manga_feed::CustomListMangaFeedBuilder;
use crate::v5::user::followed_manga_feed::GetFollowedMangaFeedBuilder;
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/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
/// .auth()
/// .login()
/// .username(Username::parse("myusername")?)
/// .password(Password::parse("hunter23")?)
/// .build()?
/// .send()
/// .await?;
///
/// let res = client
/// .feed()
/// .followed_manga()
/// .limit(1_u32)
/// .build()?
/// .send()
/// .await?;
///
/// println!("results: {:?}", res);
/// # Ok(())
/// # }
/// ```
pub fn followed_manga(&self) -> GetFollowedMangaFeedBuilder {
GetFollowedMangaFeedBuilder::default().http_client(self.http_client.clone())
}
/// Get the manga feed for a given custom list.
///
/// <https://api.mangadex.org/swagger.html#/Feed/get-list-id-feed>
///
/// Alias to [`MangaDexClient::custom_list().manga_feed()`](crate::v5::custom_list::manga_feed).
///
/// # Examples
///
/// ```rust
/// use mangadex_api::v5::MangaDexClient;
///
/// # async fn run() -> anyhow::Result<()> {
/// let client = MangaDexClient::default();
///
/// let res = client
/// .feed()
/// .custom_list_manga()
/// .limit(1_u32)
/// .build()?
/// .send()
/// .await?;
///
/// println!("results: {:?}", res);
/// # Ok(())
/// # }
/// ```
pub fn custom_list_manga(&self) -> CustomListMangaFeedBuilder {
CustomListMangaFeedBuilder::default().http_client(self.http_client.clone())
}
}