nquest/api/openapi.yaml

528 lines
11 KiB
YAML
Raw Permalink Normal View History

2024-05-05 19:42:33 +03:00
components:
responses:
errorResponse:
content:
application/json:
2023-11-01 23:21:12 +03:00
schema:
2024-05-05 19:42:33 +03:00
properties:
code:
type: integer
message:
type: string
required:
- code
- message
type: object
description: ""
filesListResponse:
content:
application/json:
schema:
2024-05-05 19:42:33 +03:00
items:
$ref: '#/components/schemas/fileItem'
type: array
description: ""
gameAdminResponse:
content:
application/json:
2024-01-20 21:37:49 +03:00
schema:
2024-05-05 19:42:33 +03:00
$ref: '#/components/schemas/gameEdit'
description: ""
gameListResponse:
content:
application/json:
schema:
items:
$ref: '#/components/schemas/gameView'
type: array
description: ""
gameResponse:
content:
application/json:
schema:
$ref: '#/components/schemas/gameView'
description: ""
taskResponse:
content:
application/json:
schema:
$ref: '#/components/schemas/taskView'
description: ""
uploadResponse:
content:
application/json:
schema:
2024-01-28 22:19:41 +03:00
properties:
2024-05-05 19:42:33 +03:00
uuid:
format: uuid
2024-01-28 22:19:41 +03:00
type: string
2024-05-05 19:42:33 +03:00
required:
- uuid
type: object
description: ""
userResponse:
content:
application/json:
schema:
2024-05-05 19:42:33 +03:00
$ref: '#/components/schemas/userView'
description: ""
userShortResponse:
content:
application/json:
$ref: '#/components/schemas/userShortView'
description: ""
usersListResponse:
content:
application/json:
schema:
items:
$ref: '#/components/schemas/userShortView'
type: array
description: ""
2023-11-01 23:21:12 +03:00
schemas:
2024-05-05 19:42:33 +03:00
codeEdit:
2023-11-01 23:21:12 +03:00
properties:
2024-05-05 19:42:33 +03:00
code:
type: string
description:
type: string
2023-11-01 23:21:12 +03:00
id:
2024-05-05 19:42:33 +03:00
format: uuid
type: string
2024-05-05 19:42:33 +03:00
required:
- code
type: object
codeView:
properties:
code:
type: string
description:
type: string
type: object
fileItem:
properties:
id:
format: uuid
2023-11-01 23:21:12 +03:00
type: string
2024-05-05 19:42:33 +03:00
originalName:
2024-01-21 02:20:59 +03:00
type: string
2024-05-05 19:42:33 +03:00
size:
2024-01-21 02:20:59 +03:00
type: integer
required:
- id
2024-05-05 19:42:33 +03:00
- originalName
- size
2023-11-01 23:21:12 +03:00
type: object
2024-05-05 19:42:33 +03:00
gameEdit:
2023-11-01 23:21:12 +03:00
properties:
2024-05-05 19:42:33 +03:00
description:
type: string
2024-05-05 19:42:33 +03:00
icon:
format: uuid
2024-01-05 03:50:33 +03:00
type: string
2024-05-05 19:42:33 +03:00
id:
format: uuid
2023-11-01 23:21:12 +03:00
type: string
points:
type: integer
2024-05-05 19:42:33 +03:00
tasks:
items:
2024-05-05 19:42:33 +03:00
$ref: '#/components/schemas/taskEdit'
type: array
title:
2024-01-20 21:37:49 +03:00
type: string
2024-05-05 19:42:33 +03:00
type:
$ref: '#/components/schemas/gameType'
visible:
type: boolean
2024-01-05 03:50:33 +03:00
required:
2024-05-05 19:42:33 +03:00
- visible
2024-01-05 03:50:33 +03:00
- title
- description
- type
2024-05-05 19:42:33 +03:00
- tasks
- points
2023-11-01 23:21:12 +03:00
type: object
2024-05-05 19:42:33 +03:00
gameType:
enum:
- virtual
- city
type: string
gameView:
2023-11-01 23:21:12 +03:00
properties:
2024-05-05 19:42:33 +03:00
authors:
items:
2024-05-05 19:42:33 +03:00
$ref: '#/components/schemas/userView'
type: array
createdAt:
type: string
2024-01-05 03:50:33 +03:00
description:
2023-11-01 23:21:12 +03:00
type: string
2024-05-05 19:42:33 +03:00
icon:
format: uuid
2024-01-05 03:50:33 +03:00
type: string
id:
format: uuid
type: string
2024-01-05 03:50:33 +03:00
points:
type: integer
2024-05-05 19:42:33 +03:00
taskCount:
type: integer
title:
2024-01-20 21:37:49 +03:00
type: string
2024-05-05 19:42:33 +03:00
type:
$ref: '#/components/schemas/gameType'
visible:
type: boolean
required:
2024-05-05 19:42:33 +03:00
- id
- title
- description
2024-01-05 03:50:33 +03:00
- type
- points
2024-05-05 19:42:33 +03:00
- taskCount
- createdAt
- authors
2023-11-19 22:54:54 +03:00
type: object
2024-05-05 19:42:33 +03:00
taskEdit:
2023-11-19 22:54:54 +03:00
properties:
2024-05-05 19:42:33 +03:00
codes:
items:
$ref: '#/components/schemas/codeEdit'
type: array
id:
format: uuid
2023-11-19 22:54:54 +03:00
type: string
2024-01-05 03:50:33 +03:00
text:
type: string
2024-05-05 19:42:33 +03:00
title:
type: string
required:
- id
- title
- text
- codes
type: object
taskView:
properties:
2024-01-05 03:50:33 +03:00
codes:
items:
2024-05-05 19:42:33 +03:00
$ref: '#/components/schemas/codeView'
type: array
message:
enum:
- ok_code
- invalid_code
- old_code
- next_level
- game_complete
type: string
text:
type: string
title:
type: string
2024-01-05 03:50:33 +03:00
required:
- title
- text
- codes
type: object
userShortView:
properties:
expToCurrentLevel:
type: integer
expToNextLevel:
type: integer
experience:
type: integer
games:
items:
$ref: '#/components/schemas/gameView'
type: array
gamesFinished:
type: integer
gamesStarted:
type: integer
id:
format: uuid
type: string
level:
type: integer
username:
type: string
required:
- id
- username
- experience
- level
- gamesStarted
- gamesFinished
type: object
2024-05-05 19:42:33 +03:00
userView:
2024-01-05 03:50:33 +03:00
properties:
2024-05-05 19:42:33 +03:00
email:
2023-11-19 22:54:54 +03:00
type: string
2024-05-05 19:42:33 +03:00
expToCurrentLevel:
type: integer
expToNextLevel:
type: integer
experience:
type: integer
games:
items:
$ref: '#/components/schemas/gameView'
type: array
id:
format: uuid
type: string
2024-05-05 19:42:33 +03:00
level:
type: integer
2024-05-05 19:42:33 +03:00
role:
enum:
- user
- creator
- admin
type: string
username:
type: string
required:
- id
2024-05-05 19:42:33 +03:00
- username
- email
- experience
- level
- expToCurrentLevel
- expToNextLevel
- games
- role
type: object
securitySchemes:
cookieAuth:
in: cookie
name: session
type: apiKey
info:
title: nQuest
version: 1.0.0
openapi: 3.1.0
paths:
/admin/file/{quest}:
get:
operationId: adminListFiles
parameters:
- in: path
name: quest
required: true
2023-11-01 23:21:12 +03:00
schema:
2024-05-05 19:42:33 +03:00
format: uuid
type: string
responses:
200:
$ref: '#/components/responses/filesListResponse'
security:
- cookieAuth:
- creator
- admin
/admin/file/{quest}/upload:
post:
operationId: adminUploadFile
parameters:
- in: path
name: quest
required: true
2023-11-01 23:21:12 +03:00
schema:
2024-05-05 19:42:33 +03:00
format: uuid
type: string
requestBody:
content:
multipart/form-data:
2023-11-01 23:21:12 +03:00
properties:
2024-05-05 19:42:33 +03:00
file:
format: binary
2023-11-01 23:21:12 +03:00
type: string
2024-05-05 19:42:33 +03:00
schema: null
type: object
responses:
200:
$ref: '#/components/responses/uploadResponse'
security:
- cookieAuth:
- creator
- admin
/admin/games:
get:
operationId: adminListGames
responses:
200:
$ref: '#/components/responses/gameListResponse'
post:
operationId: adminEditGame
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/gameEdit'
responses:
200:
$ref: '#/components/responses/gameAdminResponse'
security:
- cookieAuth:
- creator
- admin
/admin/games/{uid}:
get:
operationId: adminGetGame
parameters:
- in: path
name: uid
required: true
2023-11-19 22:54:54 +03:00
schema:
2024-05-05 19:42:33 +03:00
format: uuid
type: string
responses:
200:
$ref: '#/components/responses/gameAdminResponse'
security:
- cookieAuth:
- creator
- admin
/engine/{uid}:
get:
operationId: gameEngine
parameters:
- in: path
name: uid
required: true
2024-01-20 21:37:49 +03:00
schema:
2024-05-05 19:42:33 +03:00
format: uuid
type: string
responses:
200:
$ref: '#/components/responses/taskResponse'
/engine/{uid}/code:
post:
operationId: enterCode
parameters:
- in: path
name: uid
required: true
schema:
2024-05-05 19:42:33 +03:00
format: uuid
type: string
requestBody:
content:
application/json:
schema:
properties:
code:
type: string
required:
- code
type: object
responses:
200:
$ref: '#/components/responses/taskResponse'
2024-05-05 22:26:52 +03:00
/file/{uid}:
get:
operationId: getFile
parameters:
- in: path
name: uid
required: true
schema:
format: uuid
type: string
response:
307:
description: redirect
2024-05-05 19:42:33 +03:00
/games:
get:
responses:
200:
$ref: '#/components/responses/gameListResponse'
/user:
get:
responses:
200:
$ref: '#/components/responses/userResponse'
403:
$ref: '#/components/responses/errorResponse'
/user/login:
post:
requestBody:
content:
application/json:
schema:
properties:
email:
type: string
password:
type: string
required:
- email
- password
type: object
responses:
200:
$ref: '#/components/responses/userResponse'
400:
$ref: '#/components/responses/errorResponse'
security: []
/user/logout:
post:
responses:
204:
description: success logout
400:
$ref: '#/components/responses/errorResponse'
/user/register:
post:
requestBody:
content:
application/json:
schema:
properties:
email:
type: string
password:
type: string
password2:
type: string
username:
type: string
required:
- username
- email
- password
- password2
type: object
responses:
200:
$ref: '#/components/responses/userResponse'
400:
$ref: '#/components/responses/errorResponse'
security: []
/users:
get:
responses:
200:
$ref: '#/components/responses/usersListResponse'
description: users list
/users/{uid}:
get:
operationId: getUserInfo
parameters:
- in: path
name: uid
required: true
schema:
format: uuid
type: string
responses:
200:
$ref: '#/components/responses/userShortResponse'
description: users list
2023-11-01 23:21:12 +03:00
security:
- cookieAuth: []
2024-05-05 19:42:33 +03:00
servers:
- url: /api