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