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 org.bremersee.groupman.model.Group;
30 import org.springframework.web.bind.annotation.PathVariable;
31 import org.springframework.web.bind.annotation.RequestBody;
32 import org.springframework.web.bind.annotation.RequestMapping;
33 import org.springframework.web.bind.annotation.RequestMethod;
34 import org.springframework.web.bind.annotation.RequestParam;
35 import reactor.core.publisher.Flux;
36 import reactor.core.publisher.Mono;
37
38
39
40
41
42
43 @Tag(name = "group-admin-controller", description = "The group admin API.")
44 @Valid
45 public interface GroupAdminWebfluxControllerApi {
46
47
48
49
50
51
52 @Operation(
53 summary = "Find all groups.",
54 operationId = "findGroups",
55 tags = {"group-admin-controller"})
56 @ApiResponses(value = {
57 @ApiResponse(
58 responseCode = "200",
59 description = "The groups.",
60 content = @Content(
61 array = @ArraySchema(
62 schema = @Schema(implementation = Group.class)))),
63 @ApiResponse(
64 responseCode = "403",
65 description = "Forbidden")
66 })
67 @RequestMapping(
68 value = "/api/admin/groups",
69 produces = {"application/json"},
70 method = RequestMethod.GET)
71 Flux<Group> findGroups();
72
73
74
75
76
77
78
79 @Operation(
80 summary = "Add a new group.",
81 operationId = "addGroup",
82 tags = {"group-admin-controller"})
83 @ApiResponses(value = {
84 @ApiResponse(
85 responseCode = "200",
86 description = "The added group.",
87 content = @Content(
88 schema = @Schema(
89 implementation = Group.class))),
90 @ApiResponse(
91 responseCode = "400",
92 description = "Bad Request",
93 content = @Content(
94 schema = @Schema(
95 implementation = org.bremersee.exception.model.RestApiException.class))),
96 @ApiResponse(
97 responseCode = "403",
98 description = "Forbidden"),
99 @ApiResponse(
100 responseCode = "409",
101 description = "Group already exists",
102 content = @Content(
103 schema = @Schema(
104 implementation = org.bremersee.exception.model.RestApiException.class)))
105 })
106 @RequestMapping(
107 value = "/api/admin/groups",
108 produces = {"application/json"},
109 consumes = {"application/json"},
110 method = RequestMethod.POST)
111 Mono<Group> addGroup(
112 @Parameter(description = "The new group.", required = true) @Valid @RequestBody Group group);
113
114
115
116
117
118
119
120 @Operation(
121 summary = "Find a group.",
122 operationId = "findGroupById",
123 tags = {"group-admin-controller"})
124 @ApiResponses(value = {
125 @ApiResponse(
126 responseCode = "200",
127 description = "The group.",
128 content = @Content(
129 schema = @Schema(
130 implementation = Group.class))),
131 @ApiResponse(
132 responseCode = "404",
133 description = "Not Found",
134 content = @Content(
135 schema = @Schema(
136 implementation = org.bremersee.exception.model.RestApiException.class))),
137 @ApiResponse(
138 responseCode = "403",
139 description = "Forbidden")
140 })
141 @RequestMapping(
142 value = "/api/admin/groups/{id}",
143 produces = {"application/json"},
144 method = RequestMethod.GET)
145 Mono<Group> findGroupById(
146 @Parameter(description = "The group ID.", required = true) @PathVariable("id") String id);
147
148
149
150
151
152
153
154
155 @Operation(
156 summary = "Modify group.",
157 operationId = "modifyGroup",
158 tags = {"group-admin-controller"})
159 @ApiResponses(value = {
160 @ApiResponse(
161 responseCode = "200",
162 description = "The modified group.",
163 content = @Content(
164 schema = @Schema(
165 implementation = Group.class))),
166 @ApiResponse(
167 responseCode = "400",
168 description = "Bad Request",
169 content = @Content(
170 schema = @Schema(
171 implementation = org.bremersee.exception.model.RestApiException.class))),
172 @ApiResponse(
173 responseCode = "403",
174 description = "Forbidden"),
175 @ApiResponse(
176 responseCode = "404",
177 description = "Not Found",
178 content = @Content(
179 schema = @Schema(
180 implementation = org.bremersee.exception.model.RestApiException.class)))
181 })
182 @RequestMapping(
183 value = "/api/admin/groups/{id}",
184 produces = {"application/json"},
185 consumes = {"application/json"},
186 method = RequestMethod.PUT)
187 Mono<Group> modifyGroup(
188 @Parameter(description = "The group ID.", required = true) @PathVariable("id") String groupId,
189 @Parameter(description = "The group.", required = true) @Valid @RequestBody Group group);
190
191
192
193
194
195
196
197 @Operation(
198 summary = "Remove a group.",
199 operationId = "removeGroup",
200 tags = {"group-admin-controller"})
201 @ApiResponses(value = {
202 @ApiResponse(
203 responseCode = "200",
204 description = "OK"),
205 @ApiResponse(
206 responseCode = "403",
207 description = "Forbidden")
208 })
209 @RequestMapping(
210 value = "/api/admin/groups/{id}",
211 method = RequestMethod.DELETE)
212 Mono<Void> removeGroup(
213 @Parameter(description = "The group ID.", required = true) @PathVariable("id") String id);
214
215
216
217
218
219
220
221 @Operation(
222 summary = "Find groups by id.",
223 operationId = "findGroupsByIds",
224 tags = {"group-admin-controller"})
225 @ApiResponses(value = {
226 @ApiResponse(
227 responseCode = "200",
228 description = "The groups.",
229 content = @Content(
230 array = @ArraySchema(
231 schema = @Schema(implementation = Group.class)))),
232 @ApiResponse(
233 responseCode = "403",
234 description = "Forbidden")
235 })
236 @RequestMapping(
237 value = "/api/admin/groups/f",
238 produces = {"application/json"},
239 method = RequestMethod.GET)
240 Flux<Group> findGroupsByIds(
241 @Parameter(description = "Group IDs")
242 @RequestParam(value = "id", required = false) List<String> id);
243
244 }