-
Notifications
You must be signed in to change notification settings - Fork 1
/
doc.yaml
768 lines (724 loc) · 18.5 KB
/
doc.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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
openapi: 3.0.3
info:
title: BATCH - The pong of your dreams
description: |-
This is the API documentation for the Batch project. It covers only the front to back endpoints and not the endpoints between services.
This is done by 42 Lyon students as an end of cursus project to showcase our knowledge and expertise in Web.
version: 0.0.1
tags:
- name: coubertin
description: Tournament service
- name: petrus
description: Authentication service
- name: alfred
description: User management service
- name: mnemosine
description: Database service
- name: hermes
description: Notification service
paths:
/coubertin/tournament/infos/{tournamentId}/:
get:
tags:
- coubertin
summary: Get infos from one tournament
parameters:
- name: tournamentId
in: path
description: ID of tournament you want infos about
required: true
schema:
type: integer
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GetTournament'
'401':
description: User not authenticated
post:
tags:
- coubertin
summary: Create a tournament
parameters:
- name: tournamentId
in: path
description: Not actually used, just put 0
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateTournament'
responses:
'200':
description: Successful operation
'400':
description: Missing keys in the body
'401':
description: User not authenticated
x-4xx:
description: Failed to notify Hermes
patch:
tags:
- coubertin
summary: Modify a tournament
parameters:
- name: tournamentId
in: path
description: Not actually used, just put 0
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PatchTournament'
responses:
'200':
description: Successful operation
'400':
description: Missing keys in the body
'401':
description: User ot authenticated or not tournament admin
/coubertin/tournament/entry/{tournamentId}/{playerId}/:
post:
tags:
- coubertin
summary: Join a tournament
parameters:
- name: tournamentId
in: path
required: true
schema:
type: integer
- name: playerId
in: path
required: true
schema:
type: integer
responses:
'200':
description: Successful operation
'400':
description: Either missing keys in the body or tournament already full
'401':
description: User not authenticated
'404':
description: Tournament not found
x-4xx:
description: Failed to notify Hermes
delete:
tags:
- coubertin
summary: Leave a tournament
parameters:
- name: tournamentId
in: path
required: true
schema:
type: integer
- name: playerId
in: path
required: true
schema:
type: integer
responses:
'200':
description: Successful operation
'400':
description: Either missing keys in the body or tournament already full
'401':
description: User not authenticated
/coubertin/tournament/entry/invite/{tournamentId}:
post:
tags:
- coubertin
summary: Invite friend to a tournament
parameters:
- name: tournamentId
in: path
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/InviteFriendToTournament'
responses:
'200':
description: Successful operation
'400':
description: Missing keys in the body
'401':
description: User not authenticated
'404':
description: Tournament not found
delete:
tags:
- coubertin
summary: Refuse invitation to tournament
parameters:
- name: tournamentId
in: path
required: true
schema:
type: integer
responses:
'200':
description: Successful operation
'401':
description: User not authenticated
'404':
description: Tournament not found or player not invited to this tournament
/coubertin/tournament/entry/my-tournaments/:
get:
tags:
- coubertin
summary: Get all tournaments I'm currently playing in
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/MyTournaments'
'401':
description: User not authenticated
/coubertin/tournament/entry/available-tournaments/:
get:
tags:
- coubertin
summary: Get all tournaments I can enter
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/AvailableTournaments'
'401':
description: User not authenticated
/alfred/user/users/{id}/:
get:
tags:
- alfred
summary: Get user informations
parameters:
- name: id
in: path
required: true
schema:
type: integer
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GetUser'
'401':
description: User not authenticated
'404':
description: User not found
patch:
tags:
- alfred
summary: Modifiy user profile
parameters:
- name: id
in: path
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PatchUser'
responses:
'200':
description: Successful operation
'404':
description: User not found
/alfred/user/friends/{id}/:
get:
tags:
- alfred
summary: Get user friend list
parameters:
- name: id
in: path
required: true
description: id of the user
schema:
type: integer
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GetFriends'
'401':
description: User not authenticated
'404':
description: User not found
post:
tags:
- alfred
summary: Add a new friend
parameters:
- name: id
in: path
required: true
description: id of the person to add
schema:
type: integer
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/EmptyObject'
responses:
'200':
description: Successful operation
'400':
description: Invalid id (Usually trying to add yourself as friend)
'403':
description: User not authenticated
'404':
description: User to add not found
delete:
tags:
- alfred
summary: Delete a friend
parameters:
- name: id
in: path
required: true
description: id of the friend to delete
schema:
type: integer
responses:
'200':
description: Successful operation
'401':
description: User not authenticated
'404':
description: Friend not found
/alfred/user/avatar/{id}/:
get:
tags:
- alfred
summary: get url of the avatar of a player
parameters:
- name: id
in: path
required: true
description: id of the user
schema:
type: integer
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/AvatarUrl'
'404':
description: User not found
post:
tags:
- alfred
summary: add avatar to a user
parameters:
- name: id
in: path
required: true
description: id of the user
schema:
type: integer
responses:
'200':
description: Successful operation
'400':
description: Missing file to add
/hermes/notif/online-states/:
get:
tags:
- hermes
summary: get a list of online friends
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/OnlineFriendList'
'400':
description: Id has to be an int
'401':
description: User not authenticated
/hermes/notif/available-states/:
get:
tags:
- hermes
summary: get a list of available friends
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/AvailableFriendList'
'401':
description: User not authenticated
/mnemosine/memory/players/{id}/:
get:
tags:
- mnemosine
summary: get game history of a player
parameters:
- name: id
in: path
required: true
description: id of the user
schema:
type: integer
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GameHistory'
'401':
description: User not authenticated
'404':
description: User not found
# /mnemosine/memory/tournament-history/{id}/:
# get:
# tags:
# - mnemosine
# summary: get tournament history of a player
# parameters:
# - name: id
# in: path
# required: true
# description: id of the user
# schema:
# type: integer
# responses:
# '200':
# description: Successful operation
# content:
# application/json:
# schema:
# $ref: '#/components/schemas/TournamentHistory'
# '400':
# description: Invalid ID supplied
# '404':
# description: Not Found
# /mnemosine/memory/tournaments/{id}/:
/petrus/auth/signin/nickname/:
post:
tags:
- petrus
summary: signin or signup to the website
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/SignIn'
responses:
'200':
description: Successful operation
'400':
description: Missing keys in the body, or id is not an int
'403':
description: Wrong password
'404':
description: User not found
/petrus/auth/signin/{nickname}/:
post:
tags:
- petrus
summary: connection to website
parameters:
- name: nickname
in: path
required: true
description: nickname of the user
schema:
type: string
responses:
'200':
description: Successful operation
'400':
description: Missing keys in the body or bad nickname format
'409':
description: Conflict in the database
'422':
description: Wrong password
components:
schemas:
EmptyObject:
type: object
properties: {}
Game:
type: object
properties:
Winner:
type: integer
description: Id of the winner
example: 6
Winner-score:
type: integer
description: Score of the winner (Below 5)
example: 5
Loser:
type: integer
description: Id of the loser
example: 8
Loser-score:
type: integer
description: Score of the loser
example: 2
GetTournament:
type: object
properties:
id:
type: integer
format: int64
example: 10
Name:
type: string
example: MyAwesomeTournament
NumPlayers:
type: integer
format: int32
example: 8
enum:
- 4
- 8
Started:
type: boolean
example: true
Owner:
type: integer
example: 3
Pending:
type: array
items:
type: integer
example: [12, 5, 7]
description: List of ids of user invited to tournament but has yet to accept
Confirmed:
type: array
items:
type: integer
example: [3, 6, 8]
description: List of ids of user who entered the tournament
Games:
type: array
items:
type: object
properties:
Round:
type: integer
example: 2
Played:
type: boolean
example: false
Game:
$ref: '#/components/schemas/Game'
CreateTournament:
type: object
properties:
Name:
type: string
example: MyNewTournament
NumPlayers:
type: integer
example: 4
Invited:
type: array
items:
type: integer
example: [0, 5, 3]
description: List of id of invited players
Admin:
type: integer
example: 2
description: Id of the tournament admin (usually the one who creates it)
PatchTournament:
type: object
properties:
Name:
type: string
example: NewTournamentName
TournamentId:
type: integer
example: 2
InviteFriendToTournament:
type: object
properties:
Invited:
type: integer
example: 42
MyTournaments:
type: object
properties:
Name:
type: string
example: TheFirstTournamentEver
Id:
type: integer
example: 0
AvailableTournaments:
type: object
properties:
1:
type: string
example: RandomTournament
2:
type: string
example: AnotherRandomTournament
3:
type: string
example: LastRandomTournament
<TournamentId>:
type: string
example: <TournamentName>
StartTournament:
type: object
properties:
TournamentId:
type: integer
example: 1
GetUser:
type: object
properties:
Id:
type: integer
Nick:
type: string
example: twang
Pic:
type: string
description: url to profile picture
PatchUser:
type: object
properties:
Lang:
type: string
example: fr
Font:
type: integer
example: 1
Nick:
type: string
Email:
type: string
Contrast-mode:
type: boolean
GetFriends:
type: object
properties:
Id:
type: integer
Friends:
type: array
items:
type: object
properties:
Id:
type: integer
Nick:
type: string
Pic:
type: string
description: url of profile picture
Requests:
type: array
items:
type: object
properties:
Id:
type: integer
Nick:
type: string
Pic:
type: string
description: url of profile picture
Sent:
type: array
items:
type: object
properties:
Id:
type: integer
Nick:
type: string
Pic:
type: string
description: url of profile picture
AvatarUrl:
type: object
properties:
url:
type: string
example: https://myavatarurl.com
OnlineFriendList:
type: object
properties:
online-status:
type: object
properties:
id:
type: boolean
AvailableFriendList:
type: object
properties:
Ava:
type: array
items:
type: integer
GameHistory:
type: object
properties:
Id:
type: integer
Win-count:
type: integer
Lose-count:
type: integer
History:
type: array
items:
$ref: '#/components/schemas/Game'
# TournamentHistory:
# type: object
# properties:
SignIn:
type: object
properties:
Id:
type: integer
Pass:
type: string
Email:
type: string