forked from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
335 lines (326 loc) · 10.3 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
openapi: 3.0.0
info:
title: Gatewayservice API
description: Gateway OpenAPI specification.
version: 0.2.0
servers:
- url: http://localhost:8000
description: Development server
- url: http://SOMEIP:8000
description: Production server
paths:
/adduser:
post:
summary: Add a new user to the database.
operationId: addUser
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
username:
type: string
description: User ID.
example: student
password:
type: string
description: User password.
example: pass
responses:
'200':
description: User added successfully.
content:
application/json:
schema:
type: object
properties:
username:
type: string
description: User ID
password:
type: string
description: Hashed password
example: $2b$10$ZKdNYLWFQxzt5Rei/YTc/OsZNi12YiWz30JeUFHNdAt7MyfmkTuvC
_id:
type: string
description: Identification
example: 65f756db3fa22d227a4b7c7d
createdAt:
type: string
description: Creation date.
example: '2024-03-17T20:47:23.935Z'
___v:
type: integer
example: '0'
'400':
description: Failed to add user.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error information.
example: getaddrinfo EAI_AGAIN mongodb
/health:
get:
summary: Check the health status of the service.
operationId: checkHealth
responses:
'200':
description: Service is healthy.
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: Health status.
example: OK
/login:
post:
summary: Log in to the system.
operationId: loginUser
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
username:
type: string
description: User ID.
example: student
password:
type: string
description: User password.
example: pass
responses:
'200':
description: Login successful. Returns user token, username, and creation date.
content:
application/json:
schema:
type: object
properties:
token:
type: string
description: User token.
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NWY3NTZkYjNmYTIyZDIyN2E0YjdjN2QiLCJpYXQiOjE3MTA3MDg3NDUsImV4cCI6MTcxMDcxMjM0NX0.VMG_5DOyQ4GYlJQRcu1I6ICG1IGzuo2Xuei093ONHxw
username:
type: string
description: Username.
example: student
createdAt:
type: string
description: Creation date.
example: '2024-03-17T20:47:23.935Z'
'401':
description: Invalid credentials.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Shows the error info..
example: Invalid credentials
'500':
description: Internal server error.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error information.
example: Internal Server Error
/addgame:
post:
summary: Add a new game to the database.
operationId: addGame
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
gameName:
type: string
description: Name of the game.
example: Game1
responses:
'200':
description: Game added successfully.
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Message indicating success.
example: Game added successfully.
'400':
description: Failed to add game.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error information.
example: Game already exists.
/getgamehistory/{username}:
get:
summary: Get game history for a specific user.
operationId: getGameHistory
parameters:
- name: username
in: path
description: Username for which to retrieve game history.
required: true
schema:
type: string
example: student
responses:
'200':
description: Game history retrieved successfully.
content:
application/json:
schema:
type: array
items:
type: object
properties:
gameId:
type: string
description: ID of the game.
example: 12345
gameName:
type: string
description: Name of the game.
example: Game1
score:
type: integer
description: Score achieved in the game.
example: 100
datePlayed:
type: string
description: Date when the game was played.
example: '2024-03-20T15:00:00Z'
'400':
description: Failed to retrieve game history.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error information.
example: User not found.
/getScoreBoard:
get:
summary: Get the scoreboard.
operationId: getScoreBoard
responses:
'200':
description: Scoreboard retrieved successfully.
content:
application/json:
schema:
type: array
items:
type: object
properties:
username:
type: string
description: Username of the player.
example: player1
score:
type: integer
description: Score achieved by the player.
example: 100
/createquestion:
get:
summary: Get question from Wikidata
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
responseQuestionObject:
type: object
description: Question object
responseCorrectOption:
type: string
description: Correct option
responseAnswerOptions:
type: array
items:
type: string
description: Asnwer options
'500':
description: Error
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: |
Gets an random question from Wikidata and returns the question object, correct option and answer options.
/getquestionshistory:
get:
summary: Get the history of generated questions.
operationId: getQuestionsHistory
responses:
'200':
description: Questions history retrieved successfully.
content:
application/json:
schema:
type: array
items:
type: object
properties:
question:
type: string
description: The question.
example: What is 2 + 2?
answer:
type: integer
description: The correct answer to the question.
example: 4
/getregisteredusers:
get:
summary: Get the list of registered users.
operationId: getRegisteredUsers
responses:
'200':
description: List of registered users retrieved successfully.
content:
application/json:
schema:
type: array
items:
type: object
properties:
username:
type: string
description: Username of the registered user.
example: user1