· 5 years ago · Nov 17, 2020, 10:46 PM
1{
2 "openapi": "3.0.0",
3 "tags": [
4 {
5 "name": "users",
6 "description": "For operations on user objects"
7 }
8 ],
9 "info": {
10 "title": "Bamboo Database",
11 "description": "For interfacing with the Bamboo Bot database. You can use `testing` as your General Use API key to test any read-only functions.\n\nOpenAPI v3 spec file constructed using [Stoplight Studio](https://stoplight.io)",
12 "termsOfService": "http://swagger.io/terms/",
13 "contact": {
14 "email": "apiteam@swagger.io"
15 },
16 "license": {
17 "name": "Apache 2.0",
18 "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
19 },
20 "version": "1.0.0"
21 },
22 "externalDocs": {
23 "description": "Find out more about Swagger",
24 "url": "http://swagger.io"
25 },
26 "servers": [
27 {
28 "url": "https://ltasus.asuscomm.com:3333/v1"
29 }
30 ],
31 "paths": {
32 "/users": {
33 "get": {
34 "tags": [
35 "users"
36 ],
37 "summary": "Get all users in database",
38 "description": "Returns an array of names of all users in the database",
39 "operationId": "get-users",
40 "responses": {
41 "200": {
42 "description": "OK",
43 "content": {
44 "application/json": {
45 "schema": {
46 "type": "array",
47 "items": {
48 "type": "string"
49 }
50 },
51 "examples": {
52 "example-1": {
53 "value": [
54 "John Smith",
55 "Mary Sue",
56 "Victoria Lee"
57 ]
58 }
59 }
60 }
61 }
62 }
63 }
64 },
65 "post": {
66 "summary": "Add a new user to the database",
67 "description": "Adds a user to the database with the supplied name",
68 "operationId": "addUser",
69 "requestBody": {
70 "description": "Name of the user to add to the database",
71 "content": {
72 "application/json": {
73 "schema": {
74 "minLength": 1,
75 "type": "string",
76 "description": "",
77 "example": "Robert Smith"
78 }
79 }
80 },
81 "required": false
82 },
83 "responses": {
84 "200": {
85 "description": "OK",
86 "content": {
87 "application/json": {
88 "schema": {
89 "$ref": "#/components/schemas/User"
90 }
91 }
92 }
93 },
94 "405": {
95 "description": "Invalid input",
96 "content": {}
97 }
98 },
99 "security": [
100 {
101 "Admin_Key": []
102 }
103 ],
104 "x-codegen-request-body-name": "body",
105 "tags": [
106 "users"
107 ]
108 },
109 "delete": {
110 "description": "Delete a user with supplied name from the database",
111 "operationId": "delete-users",
112 "responses": {
113 "200": {
114 "description": "OK",
115 "content": {}
116 }
117 },
118 "security": [
119 {
120 "Admin_Key": []
121 }
122 ],
123 "tags": [
124 "users"
125 ],
126 "summary": "Delete a user from the database"
127 }
128 },
129 "/users/{name}": {
130 "get": {
131 "tags": [
132 "users"
133 ],
134 "summary": "Get assignments for user",
135 "description": "Get assignments for a user with specified name",
136 "operationId": "get-user",
137 "parameters": [
138 {
139 "name": "name",
140 "in": "path",
141 "description": "Name of user to get assignments for, case-sensitive",
142 "required": true,
143 "schema": {
144 "type": "string"
145 }
146 }
147 ],
148 "responses": {
149 "200": {
150 "description": "OK",
151 "content": {
152 "application/json": {
153 "schema": {
154 "type": "array",
155 "items": {
156 "$ref": "#/components/schemas/Assignment"
157 }
158 }
159 }
160 }
161 }
162 }
163 },
164 "post": {
165 "summary": "Add assignments for user",
166 "description": "Add an assignment for a user",
167 "operationId": "createUser",
168 "parameters": [
169 {
170 "name": "name",
171 "in": "path",
172 "description": "Name of user to get assignments for, case-sensitive",
173 "required": true,
174 "schema": {
175 "type": "string"
176 }
177 }
178 ],
179 "requestBody": {
180 "description": "Assignment to add to user",
181 "content": {
182 "application/json": {
183 "schema": {
184 "$ref": "#/components/schemas/Assignment"
185 }
186 }
187 },
188 "required": true
189 },
190 "responses": {
191 "200": {
192 "description": "OK",
193 "content": {
194 "application/json": {
195 "schema": {
196 "type": "object"
197 }
198 }
199 }
200 },
201 "default": {
202 "description": "successful operation",
203 "content": {}
204 }
205 },
206 "x-codegen-request-body-name": "body",
207 "tags": [
208 "users"
209 ],
210 "security": [
211 {
212 "Admin_Key": []
213 }
214 ]
215 },
216 "delete": {
217 "summary": "Delete user",
218 "description": "Delete the user with specified name",
219 "operationId": "delete-users-name",
220 "parameters": [
221 {
222 "name": "name",
223 "in": "path",
224 "description": "Name of user to get assignments for, case-sensitive",
225 "required": true,
226 "schema": {
227 "type": "string"
228 }
229 }
230 ],
231 "responses": {
232 "200": {
233 "description": "OK",
234 "content": {}
235 },
236 "401": {
237 "description": "Unauthorized",
238 "content": {
239 "application/json": {
240 "schema": {
241 "type": "object"
242 }
243 }
244 }
245 },
246 "404": {
247 "description": "Not Found",
248 "content": {
249 "application/json": {
250 "schema": {
251 "type": "object"
252 }
253 }
254 }
255 }
256 },
257 "security": [
258 {
259 "Admin_Key": []
260 }
261 ],
262 "tags": [
263 "users"
264 ]
265 }
266 },
267 "/overview": {
268 "get": {
269 "tags": [
270 "users"
271 ],
272 "summary": "Get all users and their assignment count",
273 "description": "Get an object containing the name of each user and the number of assignments they have",
274 "operationId": "get-overview",
275 "responses": {
276 "200": {
277 "description": "OK",
278 "content": {
279 "application/json": {
280 "schema": {
281 "$ref": "#/components/schemas/OverviewObject"
282 }
283 }
284 }
285 }
286 }
287 }
288 }
289 },
290 "components": {
291 "schemas": {
292 "User": {
293 "type": "object",
294 "x-examples": {
295 "example-1": {
296 "name": "John Smith",
297 "assignments": [
298 {
299 "name": "Book_Report",
300 "due_date": "2021-01-05T00:00:00.000Z"
301 },
302 {
303 "name": "Group presentation",
304 "due_date": "2021-04-08T00:00:00.000Z"
305 }
306 ]
307 }
308 },
309 "title": "User",
310 "description": "Represents a user in the Database",
311 "properties": {
312 "name": {
313 "type": "string",
314 "example": "John Smith"
315 },
316 "assignments": {
317 "type": "array",
318 "items": {
319 "$ref": "#/components/schemas/Assignment"
320 }
321 }
322 },
323 "required": [
324 "name"
325 ]
326 },
327 "ApiResponse": {
328 "type": "object",
329 "properties": {
330 "code": {
331 "type": "integer",
332 "format": "int32"
333 },
334 "type": {
335 "type": "string"
336 },
337 "message": {
338 "type": "string"
339 }
340 },
341 "title": "ApiResponse",
342 "description": "Wrapper for all API responses, not used as of yet"
343 },
344 "Assignment": {
345 "title": "Assignment",
346 "required": [
347 "due_date",
348 "name"
349 ],
350 "type": "object",
351 "properties": {
352 "name": {
353 "type": "string",
354 "example": "Book_Report"
355 },
356 "due_date": {
357 "type": "string",
358 "format": "date",
359 "example": "2021-01-05"
360 }
361 },
362 "x-examples": {
363 "example-1": {
364 "name": "Book_Report",
365 "due_date": "2021-01-05"
366 }
367 },
368 "description": "An Assignment, linked to a user in the DB backend"
369 },
370 "OverviewObject": {
371 "title": "OverviewObject",
372 "type": "array",
373 "description": "Names of users and the number of assignments for each",
374 "items": {
375 "type": "object",
376 "properties": {
377 "name": {
378 "type": "string"
379 },
380 "assignment_count": {
381 "type": "integer"
382 }
383 }
384 },
385 "x-examples": {
386 "example-1": [
387 {
388 "name": "Mary Sue",
389 "assignment_count": 3
390 },
391 {
392 "name": "John Smith",
393 "assignment_count": 0
394 },
395 {
396 "name": "Victoria Lee",
397 "assignment_count": 1
398 }
399 ]
400 }
401 }
402 },
403 "securitySchemes": {
404 "Admin_Key": {
405 "type": "apiKey",
406 "description": "For write access to the database.",
407 "name": "api_key",
408 "in": "header"
409 },
410 "General_Key": {
411 "type": "apiKey",
412 "description": "For read only access to the database",
413 "name": "api_key",
414 "in": "header"
415 }
416 }
417 },
418 "security": [
419 {
420 "General_Key": []
421 }
422 ]
423}