mangadex_api/v5/
manga.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
//! Manga endpoint handler.
//!
//! <https://api.mangadex.org/docs/swagger.html#/Manga>

use crate::HttpClientRef;

pub mod draft;
pub mod get;
pub mod id;
pub mod manga_id;
pub mod post;
pub mod random;
pub mod read;
pub mod status;
pub mod tag;

use draft::DraftEndpoint;
use get::ListMangaBuilder;
use id::IdEndpoint;
use manga_id::MangaIdEndpoint;
use post::CreateMangaBuilder;
use random::RandomEndpoint;
use read::ReadEndpoint;
use status::StatusEndpoint;
use tag::TagEndpoint;
use uuid::Uuid;

/// Manga endpoint handler.
#[derive(Debug)]
pub struct MangaBuilder {
    http_client: HttpClientRef,
}

impl MangaBuilder {
    #[doc(hidden)]
    pub(crate) fn new(http_client: HttpClientRef) -> Self {
        Self { http_client }
    }

    pub fn draft(&self) -> DraftEndpoint {
        DraftEndpoint::new(self.http_client.clone())
    }

    pub fn get(&self) -> ListMangaBuilder {
        ListMangaBuilder::default().http_client(self.http_client.clone())
    }

    pub fn id(&self, id: Uuid) -> IdEndpoint {
        IdEndpoint::new(self.http_client.clone(), id)
    }

    pub fn manga_id(&self, manga_id: Uuid) -> MangaIdEndpoint {
        MangaIdEndpoint::new(self.http_client.clone(), manga_id)
    }
    pub fn post(&self) -> CreateMangaBuilder {
        CreateMangaBuilder::default().http_client(self.http_client.clone())
    }
    pub fn random(&self) -> RandomEndpoint {
        RandomEndpoint::new(self.http_client.clone())
    }
    pub fn read(&self) -> ReadEndpoint {
        ReadEndpoint::new(self.http_client.clone())
    }
    pub fn status(&self) -> StatusEndpoint {
        StatusEndpoint::new(self.http_client.clone())
    }
    pub fn tag(&self) -> TagEndpoint {
        TagEndpoint::new(self.http_client.clone())
    }
}