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