mangadex_api/v5/
manga.rs

1//! Manga endpoint handler.
2//!
3//! <https://api.mangadex.org/docs/swagger.html#/Manga>
4
5use crate::HttpClientRef;
6
7pub mod draft;
8pub mod get;
9pub mod id;
10pub mod manga_id;
11pub mod post;
12pub mod random;
13pub mod read;
14pub mod status;
15pub mod tag;
16
17use draft::DraftEndpoint;
18use get::ListMangaBuilder;
19use id::IdEndpoint;
20use manga_id::MangaIdEndpoint;
21use post::CreateMangaBuilder;
22use random::RandomEndpoint;
23use read::ReadEndpoint;
24use status::StatusEndpoint;
25use tag::TagEndpoint;
26use uuid::Uuid;
27
28/// Manga endpoint handler.
29#[derive(Debug)]
30pub struct MangaBuilder {
31    http_client: HttpClientRef,
32}
33
34impl MangaBuilder {
35    #[doc(hidden)]
36    pub(crate) fn new(http_client: HttpClientRef) -> Self {
37        Self { http_client }
38    }
39
40    pub fn draft(&self) -> DraftEndpoint {
41        DraftEndpoint::new(self.http_client.clone())
42    }
43
44    pub fn get(&self) -> ListMangaBuilder {
45        ListMangaBuilder::default().http_client(self.http_client.clone())
46    }
47
48    pub fn id(&self, id: Uuid) -> IdEndpoint {
49        IdEndpoint::new(self.http_client.clone(), id)
50    }
51
52    pub fn manga_id(&self, manga_id: Uuid) -> MangaIdEndpoint {
53        MangaIdEndpoint::new(self.http_client.clone(), manga_id)
54    }
55    pub fn post(&self) -> CreateMangaBuilder {
56        CreateMangaBuilder::default().http_client(self.http_client.clone())
57    }
58    pub fn random(&self) -> RandomEndpoint {
59        RandomEndpoint::new(self.http_client.clone())
60    }
61    pub fn read(&self) -> ReadEndpoint {
62        ReadEndpoint::new(self.http_client.clone())
63    }
64    pub fn status(&self) -> StatusEndpoint {
65        StatusEndpoint::new(self.http_client.clone())
66    }
67    pub fn tag(&self) -> TagEndpoint {
68        TagEndpoint::new(self.http_client.clone())
69    }
70}