1use super::*;
2
3pub trait PostRequest: Sized {
5 type Request: Encodable;
7
8 fn path(&self) -> Cow<'_, str>;
10
11 fn body(&self) -> Self::Request;
13
14 fn request(self) -> Post<Self> {
16 self.into()
17 }
18}
19
20impl<T: PostRequest> PostRequest for &T {
21 type Request = T::Request;
22
23 fn path(&self) -> Cow<'_, str> {
24 <T as PostRequest>::path(self)
25 }
26
27 fn body(&self) -> Self::Request {
28 <T as PostRequest>::body(self)
29 }
30}
31
32impl<T: PostRequest> Request for Post<T> {
33 type Request = T::Request;
34 type Response = ();
35 type Query = ();
36
37 fn path(&self) -> Cow<'_, str> {
38 self.inner.path()
39 }
40
41 fn body(&self) -> Self::Request {
42 self.inner.body()
43 }
44
45 fn query(&self) -> Self::Query {}
46
47 fn method(&self) -> Method {
48 Method::Post
49 }
50}