mangadex_api/v5/
author.rs

1//! Author endpoint handler.
2//!
3//! <https://api.mangadex.org/docs/swagger.html#/Author>
4
5pub mod get;
6pub mod id;
7pub mod post;
8
9use uuid::Uuid;
10
11use crate::v5::author::get::ListAuthorBuilder;
12
13use crate::HttpClientRef;
14
15use self::post::CreateAuthorBuilder;
16
17use self::id::IdEndpoint;
18
19/// Author endpoint handler builder.
20#[derive(Debug)]
21pub struct AuthorBuilder {
22    http_client: HttpClientRef,
23}
24
25impl AuthorBuilder {
26    #[doc(hidden)]
27    pub(crate) fn new(http_client: HttpClientRef) -> Self {
28        Self { http_client }
29    }
30
31    // TODO add docs
32    pub fn get(&self) -> ListAuthorBuilder {
33        ListAuthorBuilder::default().http_client(self.http_client.clone())
34    }
35    /// Create an author.
36    ///
37    /// <https://api.mangadex.org/swagger.html#/Author-author>
38    pub fn post(&self) -> CreateAuthorBuilder {
39        CreateAuthorBuilder::default().http_client(self.http_client.clone())
40    }
41
42    // TODO add docs
43    pub fn id(&self, id: Uuid) -> IdEndpoint {
44        IdEndpoint::new(self.http_client.clone(), id)
45    }
46}