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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
//! Search endpoint handler.
//!
//! This is a convenience builder for searching various categories.
use crate::v5::author::list::ListAuthorBuilder;
use crate::v5::chapter::list::ListChapterBuilder;
use crate::v5::cover::list::ListCoverBuilder;
use crate::v5::manga::list::ListMangaBuilder;
use crate::v5::scanlation_group::list::ListGroupBuilder;
use crate::HttpClientRef;
/// Search endpoint handler builder.
#[derive(Debug)]
pub struct SearchBuilder {
http_client: HttpClientRef,
}
impl SearchBuilder {
#[doc(hidden)]
pub(crate) fn new(http_client: HttpClientRef) -> Self {
Self { http_client }
}
/// Search for authors.
///
/// <https://api.mangadex.org/swagger.html#/Author/get-author>
///
/// # Examples
///
/// ```rust
/// use mangadex_api::v5::MangaDexClient;
///
/// # async fn run() -> anyhow::Result<()> {
/// let client = MangaDexClient::default();
///
/// let res = client
/// .search()
/// .author()
/// .name("carlo zen")
/// .build()?
/// .send()
/// .await?;
///
/// println!("results: {:?}", res);
/// # Ok(())
/// # }
/// ```
pub fn author(&self) -> ListAuthorBuilder {
ListAuthorBuilder::default().http_client(self.http_client.clone())
}
/// Search for chapters.
///
/// <https://api.mangadex.org/swagger.html#/Chapter/get-chapter>
///
/// # Examples
///
/// ```rust
/// use mangadex_api::v5::MangaDexClient;
///
/// # async fn run() -> anyhow::Result<()> {
/// let client = MangaDexClient::default();
///
/// let res = client
/// .search()
/// .chapter()
/// .title("summoning")
/// .build()?
/// .send()
/// .await?;
///
/// println!("results: {:?}", res);
/// # Ok(())
/// # }
/// ```
pub fn chapter(&self) -> ListChapterBuilder {
ListChapterBuilder::default().http_client(self.http_client.clone())
}
/// Search for cover art.
///
/// <https://api.mangadex.org/swagger.html#/Cover/get-cover>
///
/// # Examples
///
/// ```rust
/// use mangadex_api::v5::MangaDexClient;
///
/// # async fn run() -> anyhow::Result<()> {
/// let client = MangaDexClient::default();
///
/// let res = client
/// .search()
/// .cover()
/// .build()?
/// .send()
/// .await?;
///
/// println!("results: {:?}", res);
/// # Ok(())
/// # }
/// ```
pub fn cover(&self) -> ListCoverBuilder {
ListCoverBuilder::default().http_client(self.http_client.clone())
}
/// Search for manga.
///
/// <https://api.mangadex.org/swagger.html#/Manga/get-search-manga>
///
/// # Examples
///
/// ```rust
/// use mangadex_api::v5::MangaDexClient;
///
/// # async fn run() -> anyhow::Result<()> {
/// let client = MangaDexClient::default();
///
/// let res = client
/// .search()
/// .manga()
/// .title("official test manga")
/// .build()?
/// .send()
/// .await?;
///
/// println!("results: {:?}", res);
/// # Ok(())
/// # }
/// ```
pub fn manga(&self) -> ListMangaBuilder {
ListMangaBuilder::default().http_client(self.http_client.clone())
}
/// Search for scanlation groups.
///
/// <https://api.mangadex.org/swagger.html#/ScanlationGroup/get-search-group>
///
/// # Examples
///
/// ```rust
/// use mangadex_api::v5::MangaDexClient;
///
/// # async fn run() -> anyhow::Result<()> {
/// let client = MangaDexClient::default();
///
/// let res = client
/// .search()
/// .scanlation_group()
/// .name("mangadex")
/// .build()?
/// .send()
/// .await?;
///
/// println!("results: {:?}", res);
/// # Ok(())
/// # }
/// ```
pub fn scanlation_group(&self) -> ListGroupBuilder {
ListGroupBuilder::default().http_client(self.http_client.clone())
}
}