shared/api/endpoints/
circle.rs1use crate::{
2 api::Method,
3 domain::{
4 circle::{
5 BrowseMembersQuery, BrowseMembersResponse, Circle, CircleBrowseMembersPath,
6 CircleBrowsePath, CircleBrowseQuery, CircleBrowseResponse, CircleCreatePath,
7 CircleCreateRequest, CircleDeletePath, CircleGetPath, CircleId, CircleRemoveMemberPath,
8 CircleSearchPath, CircleSearchQuery, CircleSearchResponse, CircleUpdateRequest,
9 JoinCirclePath, LeaveCirclePath, UpdateCirclePath,
10 },
11 CreateResponse,
12 },
13 error::EmptyError,
14};
15
16use super::ApiEndpoint;
17
18pub struct Create;
24impl ApiEndpoint for Create {
25 type Req = CircleCreateRequest;
26 type Res = CreateResponse<CircleId>;
27 type Path = CircleCreatePath;
28 type Err = EmptyError;
29 const METHOD: Method = Method::Post;
30}
31
32pub struct Update;
38impl ApiEndpoint for Update {
39 type Req = CircleUpdateRequest;
40 type Res = ();
41 type Path = UpdateCirclePath;
42 type Err = EmptyError;
43 const METHOD: Method = Method::Patch;
44}
45
46pub struct Browse;
53impl ApiEndpoint for Browse {
54 type Req = CircleBrowseQuery;
55 type Res = CircleBrowseResponse;
56 type Path = CircleBrowsePath;
57 type Err = EmptyError;
58 const METHOD: Method = Method::Get;
59}
60
61pub struct Search;
66impl ApiEndpoint for Search {
67 type Req = CircleSearchQuery;
68 type Res = CircleSearchResponse;
69 type Path = CircleSearchPath;
70 type Err = EmptyError;
71 const METHOD: Method = Method::Get;
72}
73
74pub struct Delete;
79impl ApiEndpoint for Delete {
80 type Req = ();
81 type Res = ();
82 type Path = CircleDeletePath;
83 type Err = EmptyError;
84 const METHOD: Method = Method::Delete;
85}
86
87pub struct Get;
96impl ApiEndpoint for Get {
97 type Req = ();
98 type Res = Circle;
99 type Path = CircleGetPath;
100 type Err = EmptyError;
101 const METHOD: Method = Method::Get;
102}
103
104pub struct JoinCircle;
113impl ApiEndpoint for JoinCircle {
114 type Req = ();
115 type Res = ();
116 type Path = JoinCirclePath;
117 type Err = EmptyError;
118 const METHOD: Method = Method::Post;
119}
120
121pub struct LeaveCircle;
123impl ApiEndpoint for LeaveCircle {
124 type Req = ();
125 type Res = ();
126 type Path = LeaveCirclePath;
127 type Err = EmptyError;
128 const METHOD: Method = Method::Delete;
129}
130
131pub struct RemoveMember;
133impl ApiEndpoint for RemoveMember {
134 type Req = ();
135 type Res = ();
136 type Path = CircleRemoveMemberPath;
137 type Err = EmptyError;
138 const METHOD: Method = Method::Delete;
139}
140
141pub struct BrowseMembers;
143impl ApiEndpoint for BrowseMembers {
144 type Req = BrowseMembersQuery;
145 type Res = BrowseMembersResponse;
146 type Path = CircleBrowseMembersPath;
147 type Err = EmptyError;
148 const METHOD: Method = Method::Get;
149}