1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.bremersee.groupman.api;
18
19 import io.swagger.v3.oas.annotations.Operation;
20 import io.swagger.v3.oas.annotations.Parameter;
21 import io.swagger.v3.oas.annotations.media.ArraySchema;
22 import io.swagger.v3.oas.annotations.media.Content;
23 import io.swagger.v3.oas.annotations.media.Schema;
24 import io.swagger.v3.oas.annotations.responses.ApiResponse;
25 import io.swagger.v3.oas.annotations.responses.ApiResponses;
26 import io.swagger.v3.oas.annotations.tags.Tag;
27 import jakarta.validation.Valid;
28 import java.util.List;
29 import java.util.Set;
30 import org.bremersee.groupman.model.Group;
31 import org.bremersee.groupman.model.Status;
32 import org.springframework.web.bind.annotation.PathVariable;
33 import org.springframework.web.bind.annotation.RequestBody;
34 import org.springframework.web.bind.annotation.RequestMapping;
35 import org.springframework.web.bind.annotation.RequestMethod;
36 import org.springframework.web.bind.annotation.RequestParam;
37 import reactor.core.publisher.Flux;
38 import reactor.core.publisher.Mono;
39
40
41
42
43
44
45 @Tag(name = "group-controller", description = "The group API.")
46 @Valid
47 public interface GroupWebfluxControllerApi {
48
49
50
51
52
53
54
55 @Operation(
56 summary = "Create a new group.",
57 operationId = "createGroup",
58 tags = {"group-controller"})
59 @ApiResponses(value = {
60 @ApiResponse(
61 responseCode = "200",
62 description = "The created group.",
63 content = @Content(
64 schema = @Schema(
65 implementation = Group.class))),
66 @ApiResponse(
67 responseCode = "400",
68 description = "Bad Request",
69 content = @Content(
70 schema = @Schema(
71 implementation = org.bremersee.exception.model.RestApiException.class))),
72 @ApiResponse(
73 responseCode = "409",
74 description = "Group already exists",
75 content = @Content(
76 schema = @Schema(
77 implementation = org.bremersee.exception.model.RestApiException.class)))
78 })
79 @RequestMapping(
80 value = "/api/groups",
81 produces = {"application/json"},
82 consumes = {"application/json"},
83 method = RequestMethod.POST)
84 Mono<Group> createGroup(
85 @Parameter(description = "The new group.", required = true) @Valid @RequestBody Group group);
86
87
88
89
90
91
92
93 @Operation(
94 summary = "Get a group.",
95 operationId = "getGroupById",
96 tags = {"group-controller"})
97 @ApiResponses(value = {
98 @ApiResponse(
99 responseCode = "200",
100 description = "The group.",
101 content = @Content(
102 schema = @Schema(
103 implementation = Group.class))),
104 @ApiResponse(
105 responseCode = "404",
106 description = "Not Found",
107 content = @Content(
108 schema = @Schema(
109 implementation = org.bremersee.exception.model.RestApiException.class)))
110 })
111 @RequestMapping(
112 value = "/api/groups/{id}",
113 produces = {"application/json"},
114 method = RequestMethod.GET)
115 Mono<Group> getGroupById(
116 @Parameter(description = "The group ID.", required = true) @PathVariable("id") String id);
117
118
119
120
121
122
123
124
125 @Operation(
126 summary = "Update group.",
127 operationId = "updateGroup",
128 tags = {"group-controller"})
129 @ApiResponses(value = {
130 @ApiResponse(
131 responseCode = "200",
132 description = "The updated group.",
133 content = @Content(
134 schema = @Schema(
135 implementation = Group.class))),
136 @ApiResponse(
137 responseCode = "400",
138 description = "Bad Request",
139 content = @Content(
140 schema = @Schema(
141 implementation = org.bremersee.exception.model.RestApiException.class))),
142 @ApiResponse(
143 responseCode = "403",
144 description = "Forbidden"),
145 @ApiResponse(
146 responseCode = "404",
147 description = "Not Found",
148 content = @Content(
149 schema = @Schema(
150 implementation = org.bremersee.exception.model.RestApiException.class))),
151 @ApiResponse(
152 responseCode = "409",
153 description = "Version is not up to date",
154 content = @Content(
155 schema = @Schema(
156 implementation = org.bremersee.exception.model.RestApiException.class)))
157 })
158 @RequestMapping(
159 value = "/api/groups/{id}",
160 produces = {"application/json"},
161 consumes = {"application/json"},
162 method = RequestMethod.PUT)
163 Mono<Group> updateGroup(
164 @Parameter(description = "The group ID.", required = true) @PathVariable("id") String id,
165 @Parameter(description = "The group.", required = true) @Valid @RequestBody Group group);
166
167
168
169
170
171
172
173 @Operation(
174 summary = "Delete a group.",
175 operationId = "deleteGroup",
176 tags = {"group-controller"})
177 @ApiResponses(value = {
178 @ApiResponse(
179 responseCode = "200",
180 description = "OK"),
181 @ApiResponse(
182 responseCode = "403",
183 description = "Forbidden"),
184 @ApiResponse(
185 responseCode = "404",
186 description = "Not Found",
187 content = @Content(
188 schema = @Schema(
189 implementation = org.bremersee.exception.model.RestApiException.class)))
190 })
191 @RequestMapping(
192 value = "/api/groups/{id}",
193 method = RequestMethod.DELETE)
194 Mono<Void> deleteGroup(
195 @Parameter(description = "The group ID.", required = true) @PathVariable("id") String id);
196
197
198
199
200
201
202
203 @Operation(
204 summary = "Get groups by id.",
205 operationId = "getGroupsByIds",
206 tags = {"group-controller"})
207 @ApiResponses(value = {
208 @ApiResponse(
209 responseCode = "200",
210 description = "The groups.",
211 content = @Content(
212 array = @ArraySchema(
213 schema = @Schema(implementation = Group.class))))
214 })
215 @RequestMapping(
216 value = "/api/groups/f",
217 produces = {"application/json"},
218 method = RequestMethod.GET)
219 Flux<Group> getGroupsByIds(
220 @Parameter(description = "Group IDs")
221 @RequestParam(value = "id", required = false) List<String> id);
222
223
224
225
226
227
228 @Operation(
229 summary = "Get editable groups.",
230 operationId = "getEditableGroups",
231 tags = {"group-controller"})
232 @ApiResponses(value = {
233 @ApiResponse(
234 responseCode = "200",
235 description = "The groups.",
236 content = @Content(
237 array = @ArraySchema(
238 schema = @Schema(implementation = Group.class))))
239 })
240 @RequestMapping(
241 value = "/api/groups/f/editable",
242 produces = {"application/json"},
243 method = RequestMethod.GET)
244 Flux<Group> getEditableGroups();
245
246
247
248
249
250
251 @Operation(
252 summary = "Get usable groups.",
253 operationId = "getUsableGroups",
254 tags = {"group-controller"})
255 @ApiResponses(value = {
256 @ApiResponse(
257 responseCode = "200",
258 description = "The groups.",
259 content = @Content(
260 array = @ArraySchema(
261 schema = @Schema(implementation = Group.class))))
262 })
263 @RequestMapping(
264 value = "/api/groups/f/usable",
265 produces = {"application/json"},
266 method = RequestMethod.GET)
267 Flux<Group> getUsableGroups();
268
269
270
271
272
273
274 @Operation(
275 summary = "Get membership.",
276 operationId = "getMembership",
277 tags = {"group-controller"})
278 @ApiResponses(value = {
279 @ApiResponse(
280 responseCode = "200",
281 description = "The groups.",
282 content = @Content(
283 array = @ArraySchema(
284 schema = @Schema(implementation = Group.class))))
285 })
286 @RequestMapping(
287 value = "/api/groups/f/membership",
288 produces = {"application/json"},
289 method = RequestMethod.GET)
290 Flux<Group> getMembership();
291
292
293
294
295
296
297 @Operation(
298 summary = "Get membership IDs.",
299 operationId = "getMembershipIds",
300 tags = {"group-controller"})
301 @ApiResponses(value = {
302 @ApiResponse(
303 responseCode = "200",
304 description = "The group IDs.",
305 content = @Content(
306 array = @ArraySchema(
307 schema = @Schema(implementation = String.class))))
308 })
309 @RequestMapping(
310 value = "/api/groups/f/membership-ids",
311 produces = {"application/json"},
312 method = RequestMethod.GET)
313 Mono<Set<String>> getMembershipIds();
314
315
316
317
318
319
320 @Operation(
321 summary = "Get status of the current user.",
322 operationId = "getStatus",
323 tags = {"group-controller"})
324 @ApiResponses(value = {
325 @ApiResponse(
326 responseCode = "200",
327 description = "The user status.",
328 content = @Content(
329 schema = @Schema(
330 implementation = Status.class)))
331 })
332 @RequestMapping(
333 value = "/api/groups/f/status",
334 produces = {"application/json"},
335 method = RequestMethod.GET)
336 Mono<Status> getStatus();
337
338 }