Rewrite to chatty but functional API.

This commit is contained in:
2025-06-14 22:16:13 +02:00
parent d1832bc794
commit db6f55bc47
20 changed files with 423 additions and 175 deletions

View File

@@ -38,16 +38,28 @@ paths:
'422':
$ref: '#/components/responses/FailureResponse'
description: 'Create a new user given a registration token and user information, username and email must be unique, and password and password_repeat must match.'
parameters: []
parameters: []
security:
- JWT-Auth: []
get:
description: 'Get a user from primary id'
requestBody:
$ref: '#/components/requestBodies/GetUserRequest'
parameters: []
responses:
'200':
$ref: '#/components/responses/UserResponse'
'401':
$ref: '#/components/responses/FailureResponse'
'404':
$ref: '#/components/responses/FailureResponse'
'422':
$ref: '#/components/responses/FailureResponse'
security:
- JWT-Auth: []
/gamenights:
get:
summary: Your GET endpoint
summary: Get a all gamenights
responses:
'200':
$ref: '#/components/responses/GamenightsResponse'
@@ -59,6 +71,21 @@ paths:
security:
- JWT-Auth: []
description: Retrieve the list of gamenights on this gamenight server. Requires authorization.
/participants:
get:
summary: Get all participants for a gamenight
responses:
'200':
$ref: '#/components/responses/ParticipantsResponse'
'400':
$ref: '#/components/responses/FailureResponse'
'401':
$ref: '#/components/responses/FailureResponse'
requestBody:
$ref: '#/components/requestBodies/GetParticipants'
security:
- JWT-Auth: []
description: Retrieve the participants of a single gamenight by id.
/gamenight:
post:
summary: ''
@@ -89,6 +116,20 @@ paths:
$ref: '#/components/requestBodies/GetGamenight'
security:
- JWT-Auth: []
/join:
post:
responses:
'200':
description: OK
'401':
$ref: '#/components/responses/FailureResponse'
'422':
$ref: '#/components/responses/FailureResponse'
requestBody:
$ref: '#/components/requestBodies/JoinGamenight'
security:
- JWT-Auth: []
components:
schemas:
Gamenight:
@@ -103,15 +144,21 @@ components:
type: string
owner_id:
type: string
participants:
type: array
items:
type: string
required:
- id
- name
- datetime
- owner_id
Participants:
title: participants
type: object
properties:
participants:
type: array
items:
type: string
required:
- participants
Failure:
title: Failure
type: object
@@ -156,6 +203,14 @@ components:
- password
- password_repeat
- registration_token
UserId:
title: UserId
type: object
properties:
user_id:
type: string
required:
- user_id
AddGamenightRequestBody:
title: AddGamenightRequestBody
type: object
@@ -164,6 +219,19 @@ components:
type: string
datetime:
type: string
GamenightId:
title: GamenightId
type: object
properties:
gamenight_id:
type: string
required:
- gamenight_id
GetGamenightRequestBody:
type: object
properties:
id:
type: string
User:
type: object
properties:
@@ -174,6 +242,7 @@ components:
email:
type: string
required:
- id
- username
requestBodies:
LoginRequest:
@@ -186,6 +255,11 @@ components:
application/json:
schema:
$ref: '#/components/schemas/Registration'
GetUserRequest:
content:
application/json:
schema:
$ref: '#/components/schemas/UserId'
AddGamenight:
content:
application/json:
@@ -195,10 +269,17 @@ components:
content:
application/json:
schema:
type: object
properties:
id:
type: string
$ref: '#/components/schemas/GetGamenightRequestBody'
GetParticipants:
content:
application/json:
schema:
$ref: '#/components/schemas/GamenightId'
JoinGamenight:
content:
application/json:
schema:
$ref: '#/components/schemas/GamenightId'
responses:
TokenResponse:
description: Example response
@@ -212,14 +293,12 @@ components:
application/json:
schema:
$ref: '#/components/schemas/Failure'
application/xml:
ParticipantsResponse:
description: Response with a list of participant uuids
content:
application/json:
schema:
type: object
properties:
message:
type: string
required:
- message
$ref: '#/components/schemas/Participants'
GamenightsResponse:
description: Example response
content: