This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
gameontext.yaml
788 lines (788 loc) · 21.8 KB
/
gameontext.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
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
swagger: '2.0'
info:
title: Game On
description: |
A throwback text application. Check <a href='https://gameontext.org'>gameontext.org</a> for more info!
version: 1.0.0
host: gameontext.org
schemes:
- https
basePath: /
produces:
- application/json
tags:
- name: map
- name: players
definitions:
Site:
type: object
required:
- _id
- exits
- info
- owner
properties:
_id:
type: string
example: '1'
description: Site id
readOnly: true
info:
$ref: '#/definitions/RoomInfo'
exits:
$ref: '#/definitions/Exits'
owner:
type: string
description: Owner
created_on:
type: string
example: '2011-12-03T10:15:30Z'
description: Date site created in ISO-8601 instant format
readOnly: true
assigned_on:
type: string
example: '2011-12-03T10:15:30Z'
description: Date room assigned in ISO-8601 instant format
readOnly: true
coord:
$ref: '#/definitions/Coordinates'
createdInstant:
type: integer
format: int64
assignedInstant:
type: integer
format: int64
description: A room (or suite) is anchored into the map as a site when it is registered. The mapping should remain fairly stable unless a room is removed and re-appears.
Exits:
type: object
properties:
'n':
$ref: '#/definitions/Exit'
w:
$ref: '#/definitions/Exit'
s:
$ref: '#/definitions/Exit'
e:
$ref: '#/definitions/Exit'
u:
$ref: '#/definitions/Exit'
d:
$ref: '#/definitions/Exit'
description: 'When a room is placed in the map, paths are created between it and other rooms. Each exit provides the door and URL required for the player to traverse the path to the target room.'
Doors:
type: object
properties:
'n':
type: string
example: A knobbly wooden door with a rough carving or a friendly face
description: North door (140 characters)
w:
type: string
example: A fake wooden door with stickers of friendly faces plastered all over it
description: West door (140 characters)
s:
type: string
example: A warped wooden door with a friendly face branded on the corner
description: South door (140 characters)
e:
type: string
example: A polished wooden door with an inlaid friendly face
description: East door (140 characters)
u:
type: string
example: A scuffed and scratched oaken trap door
description: Door in the ceiling (Up) (140 characters)
d:
type: string
example: A rough-cut particle board hatch
description: Door in the floor (Down) (140 characters)
description: 'Descriptions for the doors in the room. These may be used by other rooms to describe the appearance of the door. Keys should be relative to this room (e, w, n, s, u, d). Values are simple string descriptions for the outside of the door. If the string value references a direction at all, it should be the opposite direction:for the East door, the direction mentioned should be West. Descriptions are optional, and will be generated if absent.'
Coordinates:
type: object
required:
- x
- 'y'
properties:
x:
type: integer
format: int32
description: X coordinate
'y':
type: integer
format: int32
description: Y coordinate
ConnectionDetails:
type: object
required:
- target
- type
properties:
type:
type: string
example: websocket
description: Connection type
target:
type: string
example: 'ws://secondroom:9008/barn/ws'
description: 'Connection target, usually a URL'
token:
type: string
example: A-totally-arbitrary-really-long-string
description: A token used for mutual identification between the room and the mediator during the initial handshake when the connection is established (optional)
healthUrl:
type: string
example: 'http://secondroom:9008/barn/health'
description: Health Check URL
description: Connection details used by the mediator to connect to the room on the player's behalf
RoomInfo:
type: object
required:
- connectionDetails
- name
properties:
name:
type: string
example: First Room
description: 'Short/Terse name of the target room, must be unique within the owner''s rooms'
connectionDetails:
$ref: '#/definitions/ConnectionDetails'
fullName:
type: string
example: The First Room
description: Human-friendly room name
description:
type: string
example: A helpful room with doors in every possible direction.
description: Player-friendly room description (140 characters)
repositoryUrl:
type: string
example: 'https://github.com/your-fork'
description: Public Repository URL
doors:
$ref: '#/definitions/Doors'
description: 'Mutable information: descriptive elements, service URL, etc.'
Exit:
type: object
required:
- _id
- connectionDetails
- door
- name
properties:
_id:
type: string
example: '2'
description: Id of the target room
readOnly: true
name:
type: string
example: Barn
description: Short/Terse name of the target room
fullName:
type: string
example: The First Room
description: Human-friendly room name
door:
type: string
example: Big red barn door
description: Player-friendly description of the door (provided by the target room or generated by the map)
connectionDetails:
$ref: '#/definitions/ConnectionDetails'
description: An exit provides the door and URL required for the player to traverse the path to the next room.
PlayerResponse:
type: object
required:
- _id
- favoriteColor
- location
- name
properties:
_id:
type: string
example: 'oauthProvider:userid'
description: Unique player id
readOnly: true
name:
type: string
example: Harriet
description: Player name
favoriteColor:
type: string
example: Tangerine
description: Favorite color
location:
description: Player Location
$ref: '#/definitions/PlayerLocation'
credentials:
description: Player Credentials
$ref: '#/definitions/PlayerCredentials'
description: Player account information
LocationChange:
type: object
required:
- newLocation
- oldLocation
properties:
oldLocation:
type: string
example: room_id_1
description: old player location
newLocation:
type: string
example: room_id_1
description: new player location
origin:
type: string
example: origin_uuid
description: uuid of request origin (not stored)
description: Player location change
PlayerArgument:
type: object
required:
- _id
- favoriteColor
- name
properties:
_id:
type: string
example: 'oauthProvider:userid'
description: Unique player id
readOnly: true
name:
type: string
example: Harriet
description: Player name
favoriteColor:
type: string
example: Tangerine
description: Favorite color
description: Player account information
PlayerLocation:
type: object
required:
- location
properties:
location:
type: string
example: room_id_1
description: current player location
description: Player location
PlayerCredentials:
type: object
required:
- sharedSecret
properties:
sharedSecret:
type: string
example: fjhre8h49hf438u9h45
description: shared secret for player
description: Player credentials
ErrorResponse:
type: object
required:
- message
- status
properties:
status:
type: integer
format: int32
example: 400
description: Http Response code (for reference)
message:
type: string
example: Unauthenticated client
description: Error message
more_info:
type: string
example: Room owner could not be determined.
description: Optional additional information
description: Error response
paths:
/map/v1/sites:
get:
tags:
- map
summary: List sites
description: Get a list of registered sites. Use link headers for pagination.
operationId: listAll
produces:
- application/json
parameters:
- name: owner
in: query
description: filter by owner
required: false
type: string
- name: name
in: query
description: filter by name
required: false
type: string
responses:
'200':
description: Successful
schema:
type: array
items:
$ref: '#/definitions/Site'
'204':
description: No results found
post:
tags:
- map
summary: Create a room
description: 'When a room is registered, the map will generate the appropriate paths to place the room into the map. The map wll only generate links using standard 2-d compass directions. The ''exits'' attribute in the return value describes connected/adjacent sites. '
operationId: createRoom
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: New room attributes
required: true
schema:
$ref: '#/definitions/RoomInfo'
responses:
'201':
description: Successful
schema:
$ref: '#/definitions/Site'
'400':
description: Bad Request; details will explain what should be corrected before retrying
schema:
$ref: '#/definitions/ErrorResponse'
'403':
description: Caller is not authorized to create room
schema:
$ref: '#/definitions/ErrorResponse'
'409':
description: Save conflict
schema:
$ref: '#/definitions/ErrorResponse'
parameters: []
'/map/v1/sites/{id}':
get:
tags:
- map
summary: Get a specific room
description: ''
operationId: getRoom
produces:
- application/json
parameters:
- name: id
in: path
description: target room id
required: true
type: string
responses:
'200':
description: Successful
schema:
$ref: '#/definitions/Site'
'404':
description: No results found
schema:
$ref: '#/definitions/ErrorResponse'
put:
tags:
- map
summary: Update a specific room
description: ''
operationId: updateRoom
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
description: target room id
required: true
type: string
- in: body
name: body
description: Updated room attributes
required: true
schema:
$ref: '#/definitions/RoomInfo'
responses:
'200':
description: Successful
schema:
$ref: '#/definitions/Site'
'400':
description: Bad Request; details will explain what should be corrected before retrying
schema:
$ref: '#/definitions/ErrorResponse'
'403':
description: Caller is not authorized to update room
schema:
$ref: '#/definitions/ErrorResponse'
'404':
description: No results found
schema:
$ref: '#/definitions/ErrorResponse'
'409':
description: Save conflict
schema:
$ref: '#/definitions/ErrorResponse'
delete:
tags:
- map
summary: Delete a specific room
description: ''
operationId: deleteRoom
produces:
- application/json
parameters:
- name: id
in: path
description: target room id
required: true
type: string
responses:
'204':
description: Successful
'400':
description: Bad Request; details will explain what should be corrected before retrying
schema:
$ref: '#/definitions/ErrorResponse'
'403':
description: Caller is not authorized to delete room
schema:
$ref: '#/definitions/ErrorResponse'
'404':
description: No results found
schema:
$ref: '#/definitions/ErrorResponse'
'409':
description: Save conflict
schema:
$ref: '#/definitions/ErrorResponse'
parameters: []
/players/v1/accounts:
get:
tags:
- players
summary: List all players
description: Get a list of registered players. Use link headers for pagination.
operationId: getAllPlayers
produces:
- application/json
parameters: []
responses:
'200':
description: Successful
schema:
$ref: '#/definitions/PlayerResponse'
'204':
description: Save conflict
schema:
$ref: '#/definitions/ErrorResponse'
post:
tags:
- players
summary: Create a new player account
description: ''
operationId: createPlayer
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
required: false
schema:
$ref: '#/definitions/PlayerArgument'
responses:
'201':
description: Successful
schema:
$ref: '#/definitions/PlayerResponse'
'403':
description: Authenticated user id must match new player id
schema:
$ref: '#/definitions/ErrorResponse'
'409':
description: Save conflict
schema:
$ref: '#/definitions/ErrorResponse'
parameters: []
'/players/v1/accounts/{id}':
get:
tags:
- players
summary: Get a specific player
description: ''
operationId: getPlayerInformation
produces:
- application/json
parameters:
- name: id
in: path
description: target player id
required: true
type: string
responses:
'200':
description: Successful
schema:
$ref: '#/definitions/PlayerResponse'
'404':
description: Player not found
schema:
$ref: '#/definitions/ErrorResponse'
put:
tags:
- players
summary: Update a specific player
description: ''
operationId: updatePlayer
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
description: target player id
required: true
type: string
- in: body
name: body
description: Updated player attributes
required: true
schema:
$ref: '#/definitions/PlayerArgument'
responses:
'200':
description: Successful
schema:
$ref: '#/definitions/PlayerResponse'
'403':
description: Caller is not authorized to update specified player
schema:
$ref: '#/definitions/ErrorResponse'
'404':
description: Player not found
schema:
$ref: '#/definitions/ErrorResponse'
'409':
description: Save conflict
schema:
$ref: '#/definitions/ErrorResponse'
delete:
tags:
- players
summary: Delete a specific player
description: ''
operationId: removePlayer
parameters:
- name: id
in: path
description: target player id
required: true
type: string
responses:
'204':
description: Successful
'403':
description: Caller is not authorized to delete specified player
schema:
$ref: '#/definitions/ErrorResponse'
'404':
description: Player not found
schema:
$ref: '#/definitions/ErrorResponse'
'409':
description: Save conflict
schema:
$ref: '#/definitions/ErrorResponse'
parameters: []
'/players/v1/accounts/{id}/credentials':
get:
tags:
- players
summary: Get credentials for a specific player
description: ''
operationId: getPlayerCredentials
produces:
- application/json
parameters:
- name: id
in: path
description: target player id
required: true
type: string
responses:
'200':
description: Successful
schema:
$ref: '#/definitions/PlayerCredentials'
'404':
description: Player not found
schema:
$ref: '#/definitions/ErrorResponse'
parameters: []
'/players/v1/accounts/{id}/credentials/sharedSecret':
put:
tags:
- players
summary: Update player shared secret
description: ''
operationId: updatePlayerApiKey
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
responses:
'200':
description: Successful
schema:
$ref: '#/definitions/PlayerArgument'
'403':
description: Caller is not authorized to update player shared secret
schema:
$ref: '#/definitions/ErrorResponse'
'404':
description: Player not found
schema:
$ref: '#/definitions/ErrorResponse'
'409':
description: Save conflict
schema:
$ref: '#/definitions/ErrorResponse'
parameters: []
'/players/v1/accounts/{id}/location':
get:
tags:
- players
summary: Get a specific player location
description: 'returns a map of player id to location, location can be null if historically the player has never had a location stored.'
operationId: getPlayerLocation
produces:
- application/json
parameters:
- name: id
in: path
description: target player id
required: true
type: string
responses:
'200':
description: Successful
schema:
$ref: '#/definitions/PlayerLocation'
'404':
description: Player not found
schema:
$ref: '#/definitions/ErrorResponse'
put:
tags:
- players
summary: Update player location
description: ''
operationId: updatePlayerLocation
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
- in: body
name: body
required: false
schema:
$ref: '#/definitions/LocationChange'
responses:
'200':
description: Successful
schema:
$ref: '#/definitions/PlayerLocation'
'403':
description: Caller is not authorized to update player location
schema:
$ref: '#/definitions/ErrorResponse'
'404':
description: Player not found
schema:
$ref: '#/definitions/ErrorResponse'
'409':
description: Save conflict
schema:
$ref: '#/definitions/ErrorResponse'
parameters: []
/players/v1/color:
get:
tags:
- players
summary: Get ten generated colors
description: ''
operationId: getColors
produces:
- application/json
parameters: []
responses:
'200':
description: Successful
schema:
type: array
items:
type: string
parameters: []
/players/v1/locations:
get:
tags:
- players
summary: Get player locations.
description: 'can pass optional params playerId to retrieve only location for player, or siteId to retrieve players in a location, combining the two will return an empty map if the player is not in that location'
operationId: getPlayerLocationInformation
produces:
- application/json
parameters:
- name: playerId
in: query
description: target player id
required: false
type: string
- name: siteId
in: query
description: target site id
required: false
type: string
responses:
'200':
description: Successful
'404':
description: Player not found
schema:
$ref: '#/definitions/ErrorResponse'
parameters: []
/players/v1/name:
get:
tags:
- players
summary: Get ten randomly generated player names
description: ''
operationId: getNames
produces:
- application/json
parameters: []
responses:
'200':
description: Successful
schema:
type: array
items:
type: string
parameters: []