mangadex_api/v5/api_client/
id.rs

1pub mod delete;
2pub mod get;
3pub mod post;
4pub mod secret;
5
6use crate::HttpClientRef;
7use uuid::Uuid;
8
9use delete::DeleteClientBuilder;
10use get::GetClientBuilder;
11use post::EditClientBuilder;
12use secret::SecretEndpoint;
13
14create_endpoint_node! {
15    #[name] IdEndpoint IdEndpointMethods,
16    #[args] {
17        http_client: HttpClientRef,
18        id: Uuid,
19    },
20    #[methods] {
21        get() -> GetClientBuilder;
22        post() -> EditClientBuilder;
23        delete() -> DeleteClientBuilder;
24        secret() -> SecretEndpoint;
25    }
26}
27
28impl IdEndpointMethods for IdEndpoint {
29    fn get(&self) -> GetClientBuilder {
30        GetClientBuilder::default()
31            .client_id(<&Self as Into<Uuid>>::into(self))
32            .http_client(<&Self as Into<HttpClientRef>>::into(self))
33    }
34
35    fn post(&self) -> EditClientBuilder {
36        EditClientBuilder::default()
37            .client_id(<&Self as Into<Uuid>>::into(self))
38            .http_client(<&Self as Into<HttpClientRef>>::into(self))
39    }
40
41    fn delete(&self) -> DeleteClientBuilder {
42        DeleteClientBuilder::default()
43            .client_id(<&Self as Into<Uuid>>::into(self))
44            .http_client(<&Self as Into<HttpClientRef>>::into(self))
45    }
46
47    fn secret(&self) -> SecretEndpoint {
48        SecretEndpoint::new(From::from(self), From::from(self))
49    }
50}