-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.yaml
225 lines (209 loc) · 4.99 KB
/
api.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
openapi: "3.0.2"
info:
title: Challenge Backend
version: "1.0"
servers:
- url: http://{domain}:{port}/api
variables:
domain:
default: localhost
port:
enum:
- '3000'
- '8080'
default: '3000'
- url: http://localhost:3000/api
description: Local test instance
- url: http://10.239.68.77:3000/api
description: Playground Server
security:
- bearerAuth: []
paths:
/auth/login:
post:
summary: Login
operationId: login
tags:
- auth
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Login'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/LoginResponse'
"401":
$ref: "#/components/responses/API-401-RESPONSE"
/auth/logout:
get:
summary: Logout
operationId: logout
tags:
- auth
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "Success"
"401":
$ref: "#/components/responses/API-401-RESPONSE"
/auth/register:
post:
summary: Register
operationId: register
tags:
- auth
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Register'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
token:
type: string
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
"401":
$ref: "#/components/responses/API-401-RESPONSE"
/game/scores/{challenge}:
get:
summary: Get all scores
operationId: getScores
tags:
- scores
parameters:
- name: challenge
in: path
description: Challenge name
required: true
schema:
type: string
example: "23_3_1"
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Score'
/game/submit:
post:
summary: Submit a run
operationId: submitRun
tags:
- run
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Submit'
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Score'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
Login:
type: object
properties:
email:
type: string
password:
type: string
LoginResponse:
type: object
properties:
status:
type: string
token:
type: string
Register:
type: object
properties:
email:
type: string
name:
type: string
password:
type: string
passwordConfirm:
type: string
RegisterRespnse:
type: object
properties:
status:
type: string
user:
type: object
properties:
email:
type: string
name:
type: string
Submit:
type: object
properties:
challenge:
type: string
player:
type: string
name:
type: string
language:
type: string
code:
type: string
test:
type: boolean
Score:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
time:
type: integer
format: int64
language:
type: string
binary:
type: string
responses:
API-401-RESPONSE:
description: |-
__You are not authenticated. We don't know who you are__
- During a request to `authn/token`, make sure that you are using the correct `client_id` and `client_secret`.
- During a request to `authn/token`, make sure that you include a header for Content-Type with `application/x-www-form-urlencoded`.
- During any other request, make sure that you have added the bearer token to the authorization header with the Content-Type header being added with the correct version value.
- Your access token might have expired.