-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathopenapi.yml
609 lines (607 loc) · 15.6 KB
/
openapi.yml
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
openapi: '3.1.0'
info:
title: SourceJump API
version: 1.0.0
servers:
- url: https://sourcejump.net/api/v1
paths:
/maps:
get:
summary: Return a list of all maps
tags:
- maps
parameters:
- in: query
name: sort
schema:
$ref: '#/components/schemas/MapFields'
description: Column to sort on
- $ref: '#/components/parameters/OrderParam'
- $ref: '#/components/parameters/OffsetParam'
- $ref: '#/components/parameters/LimitParam'
responses:
'200':
description: An array of Map objects
content:
application/json:
schema:
$ref: '#/components/schemas/MapArray'
default:
description: Unexpected error
/maps/{map}:
get:
summary: Return detailed information about a specified map
tags:
- maps
parameters:
- in: path
name: map
schema:
type: string
required: true
description: Name of the map
responses:
'200':
description: A Map object
content:
application/json:
schema:
$ref: '#/components/schemas/Map'
'400':
$ref: '#/components/responses/Invalid'
'404':
$ref: '#/components/responses/NotFound'
default:
description: Unexpected error
/maps/{map}/zones:
get:
summary: Return zone data for the specified map
tags:
- maps
parameters:
- in: path
name: map
schema:
type: string
required: true
description: Name of the map
responses:
'200':
description: An array of Zone objects
content:
application/json:
schema:
$ref: '#/components/schemas/ZoneArray'
'400':
$ref: '#/components/responses/Invalid'
'404':
$ref: '#/components/responses/NotFound'
default:
description: Unexpected error
/players:
get:
summary: Return a list of all players
tags:
- players
parameters:
- in: query
name: sort
schema:
$ref: '#/components/schemas/PlayerFields'
description: Column to sort on
- $ref: '#/components/parameters/OrderParam'
- $ref: '#/components/parameters/OffsetParam'
- $ref: '#/components/parameters/LimitParam'
responses:
'200':
description: An array of Player objects
content:
application/json:
schema:
$ref: '#/components/schemas/PlayerArray'
/players/{player}:
get:
summary: Return detailed information about a player
tags:
- players
parameters:
- in: path
name: player
schema:
type: integer
required: true
description: SteamID64 of the player to fetch
responses:
'200':
description: A Player object
content:
application/json:
schema:
$ref: '#/components/schemas/Player'
'400':
$ref: '#/components/responses/Invalid'
'404':
$ref: '#/components/responses/NotFound'
default:
description: Unexpected error
/runs:
get:
summary: Return a list of runs matching the given query
tags:
- runs
parameters:
- in: query
name: server
schema:
type: integer
description: ID of the server to filter
- in: query
name: player
schema:
type: integer
description: SteamID64 of the player to filter
- in: query
name: map
schema:
type: string
description: Name of the map to filter
- in: query
name: track
schema:
type: integer
default: 0
description: Track of the run to filter (Default - 0/Main)
- in: query
name: style
schema:
type: integer
default: 0
description: Style of the run to filter (Default - 0/Auto)
- in: query
name: sort
schema:
$ref: '#/components/schemas/RunFields'
description: Column to sort on
- $ref: '#/components/parameters/OrderParam'
- $ref: '#/components/parameters/OffsetParam'
- $ref: '#/components/parameters/LimitParam'
responses:
'200':
description: An array of Run objects
content:
application/json:
schema:
$ref: '#/components/schemas/RunArray'
'400':
$ref: '#/components/responses/Invalid'
'404':
$ref: '#/components/responses/NotFound'
default:
description: Unexpected error
post:
summary: Creates a run entry
tags:
- runs
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Run'
responses:
'201':
description: Run successfully created
content:
application/json:
schema:
$ref: '#/components/schemas/Run'
'400':
$ref: '#/components/responses/Invalid'
'401':
$ref: '#/components/responses/Unauthorized'
default:
description: Unexpected error
/runs/{runId}:
get:
summary: Return detailed information about a specific run
tags:
- runs
parameters:
- in: path
name: runId
schema:
type: integer
required: true
description: Run ID of the run to fetch
responses:
'200':
description: A Run object
content:
application/json:
schema:
$ref: '#/components/schemas/Run'
'400':
$ref: '#/components/responses/Invalid'
'404':
$ref: '#/components/responses/NotFound'
default:
description: Unexpected error
/runs/{runId}/replay:
get:
summary: Return a replay for a specific run
tags:
- runs
parameters:
- in: path
name: runId
schema:
type: integer
required: true
description: Run ID of the run to fetch
responses:
'200':
description: A binary file containing the runs replay
content:
application/octet-stream:
schema:
type: string
format: binary
'400':
$ref: '#/components/responses/Invalid'
'404':
$ref: '#/components/responses/NotFound'
default:
description: Unexpected error
/servers:
get:
summary: Return an array of all connected servers
tags:
- servers
parameters:
- in: query
name: sort
schema:
$ref: '#/components/schemas/ServerFields'
description: Column to sort on
- $ref: '#/components/parameters/OrderParam'
- $ref: '#/components/parameters/OffsetParam'
- $ref: '#/components/parameters/LimitParam'
responses:
'200':
description: An array of Server objects
content:
application/json:
schema:
$ref: '#/components/schemas/ServerArray'
'400':
$ref: '#/components/responses/Invalid'
'404':
$ref: '#/components/responses/NotFound'
default:
description: Unexpected error
# We can store common response objects and types here
components:
# Security schemes for protected endpoints (run submission)
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
# Common response objects
responses:
NotFound:
description: The specified resource was not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Invalid:
description: The request was invalid
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Unauthorized request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
# Generic error response body
Error:
type: object
properties:
code:
type: string
message:
type: string
required:
- code
- message
# General response objects
Map:
type: object
properties:
id:
type: integer
description: Numerical map ID
name:
type: string
description: Name of the map
author:
type: string
description: Author of the map
tier:
type: integer
description: Difficulty tier of the map
type:
$ref: '#/components/schemas/MapType'
description: The type of the map
stages:
type: integer
description: How many stages the map has
bonuses:
type: integer
description: How many bonuses the map has
fileChecksum:
type: integer
description: The checksum of the map file
fileSize:
type: integer
description: The size of the map (in bytes)
downloadUrl:
type: string
description: Where to download the map from
thumbnailUrl:
type: string
description: Where the thumbnail image of the map is hosted
createdAt:
type: string
format: date
description: When the map was created
updatedAt:
type: string
format: date
description: When the map was last updated
MapArray:
type: array
items:
$ref: '#/components/schemas/Map'
Player:
type: object
properties:
id:
type: integer
description: Numerical player ID
name:
type: string
description: Player name
points:
type: integer
description: Amount of points the player has
banned:
type: boolean
description: Is the player currently banned?
country:
type:
- 'null'
- string
description: The country specified by the player
steamid:
type: integer
description: SteamID64 of the player
PlayerArray:
type: array
items:
$ref: '#/components/schemas/Player'
Run:
type: object
properties:
id:
type: integer
description: Numerical run ID
datetime:
type: string
format: date-time
description: When the run was hit
server:
$ref: '#/components/schemas/Server'
description: The server the run was hit on
player:
$ref: '#/components/schemas/Player'
description: The player that hit the run
map:
$ref: '#/components/schemas/Map'
description: The map the run was hit on
track:
type: integer
description: The track number the run was hit on
style:
type: integer
description: The style number the run was hit on
ticks:
type: integer
description: Length of the run in ticks
jumps:
type: integer
description: The amount of jumps in the run
strafes:
type: integer
description: The amount of strafes in the run
sync:
type: number
format: float
description: The runs sync
points:
type: integer
description: The amount of points awarded for the run
RunArray:
type: array
items:
$ref: '#/components/schemas/Run'
Server:
type: object
properties:
id:
type: integer
description: Numerical server ID
name:
type: string
description: Server name
address:
type: string
format: ipv4
description: Server IP address
discordLink:
type:
- 'null'
- string
description: A link to the server's discord (if it exists)
ownerSteamid:
type:
- 'null'
- integer
description: The SteamID64 of the server's owner (if it exists)
countryName:
type: string
description: The country the server is hosted in
ServerArray:
type: array
items:
$ref: '#/components/schemas/Server'
Zone:
type: object
properties:
id:
type: integer
description: Numerical zone ID
track:
type: integer
description: Numerical map track
type:
$ref: '#/components/schemas/ZoneType'
description: The zone's type
index:
type: integer
description: The zone's index
pointA:
type: array
items:
type: number
format: double
description: The zone's first point
pointB:
type: array
items:
type: number
format: double
description: The zone's second point
ZoneArray:
type: array
items:
$ref: '#/components/schemas/Zone'
# Reusable enums of model fields
MapFields:
type: string
enum:
- id
- name
- author
- tier
- type
- stages
- bonuses
- fileChecksum
- fileSize
- downloadUrl
- thumbnailUrl
- createdAt
- updatedAt
PlayerFields:
type: string
enum:
- id
- name
- points
- banned
- country
- steamid
RunFields:
type: string
enum:
- id
- datetime
- server
- player
- map
- track
- style
- ticks
- jumps
- strafes
- sync
- points
ServerFields:
type: string
enum:
- id
- name
- address
- discordLink
- ownerSteamid
- countryName
MapType:
type: string
enum:
- linear
- staged
ZoneType:
type: string
enum:
- start
- end
- stop
- stage
- freestyle
parameters:
OffsetParam:
in: query
name: offset
schema:
type: integer
minimum: 0
default: 0
description: The number of items to offset the result by
OrderParam:
in: query
name: order
schema:
type: string
enum:
- asc
- desc
description: >
Sort order (by Run ID):
* `asc` - Ascending, from low to high
* `desc` - Descending, from high to low
LimitParam:
in: query
name: limit
schema:
type: integer
minimum: 1
maximum: 100
default: 50
description: The number of items to return
tags:
- name: maps
description: All routes relating to maps
- name: players
description: All routes relating to players
- name: runs
description: All routes relating to runs
- name: servers
description: All routes relating to servers