Refactor API structure and update schema references

Moved API files from `sub_api` to `schemas` for better organization. Updated schema references to use `ApiError` instead of `Error`. Adjusted build configuration to include new schema folder in the API generation process.
This commit is contained in:
2025-04-10 23:16:57 +02:00
parent 2b818fc297
commit 43a5dafd82
5 changed files with 18 additions and 9 deletions
@@ -0,0 +1,162 @@
getUserNames:
post:
tags:
- history
summary: Get user names
description: Get all user names with punishment history of the specified type
operationId: getUserNames
parameters:
- $ref: '#/components/parameters/UserType'
- $ref: '#/components/parameters/HistoryType'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
type: string
description: A list of users
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../generic/errors.yml#/components/schemas/ApiError"
getHistoryForUsers:
post:
tags:
- history
summary: Get history for users
description: >
Get all users with punishment history of the specified type,
where the user name starts with the search query
operationId: getHistoryForUsers
parameters:
- $ref: '#/components/parameters/UserType'
- $ref: '#/components/parameters/HistoryType'
- $ref: '#/components/parameters/User'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/PunishmentHistory'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../generic/errors.yml#/components/schemas/ApiError"
getHistoryForUuid:
post:
tags:
- history
summary: Get user
description: >
Get all users with punishment history of the specified type,
where the user uuid matches
operationId: getHistoryForUuid
parameters:
- $ref: '#/components/parameters/UserType'
- $ref: '#/components/parameters/HistoryType'
- $ref: '#/components/parameters/Uuid'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/PunishmentHistory'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../generic/errors.yml#/components/schemas/ApiError"
components:
parameters:
HistoryType:
name: type
in: path
required: true
schema:
type: string
enum: [ all, bans, mutes, kicks ]
description: The type of history to retrieve
User:
name: user
in: path
required: true
schema:
type: string
description: The (partial) username to search for
Uuid:
name: uuid
in: path
required: true
schema:
type: string
description: The uuid of the desired user
UserType:
name: userType
in: path
required: true
schema:
type: string
enum: [ player, staff ]
description: Indicates if this is a staff history or a player history look up
schemas:
PunishmentHistory:
type: array
items:
type: object
properties:
username:
type: string
description: The username of the user
uuid:
type: string
description: The UUID of the user
reason:
type: string
description: The reason for the punishment
type:
type: string
description: The type of punishment
punishmentTime:
type: integer
format: int64
description: The time when the punishment was given
expiryTime:
type: integer
format: int64
description: The time when the punishment expires
punishmentUser:
type: string
description: The username of the punishment issuer
punishmentUserUuid:
type: string
description: The UUID of the punishment issuer
removedBy:
type: string
description: The name of the staff member who removed the punishment
removedReason:
type: string
description: The reason why the punishment was removed
Player:
type: object
properties:
name:
type: string
description: The name of the player
example: a_name
uuid:
type: string
example: 0c35e520-927e-4c6a-87ad-ff0739c22e9d
description: The uuid of the team player
required:
- name
- uuid