Server/api/api.yml

110 lines
3 KiB
YAML
Raw Permalink Normal View History

2025-02-01 14:18:34 +01:00
openapi: 3.0.0
info:
title: Tower Defence Server
description: An API for talking to the Tower Defence Server
version: 0.0.1
servers:
- url: /api/v1
- url: http://localhost:8080/api/v1
security:
- JWTAuth: []
components:
securitySchemes:
JWTAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
#############################################
# UUID #
#############################################
UUID:
description: Unique identifier compatible with [RFC9562](https://datatracker.ietf.org/doc/html/rfc9562)
type: string
format: uuid
example: f0981749-f550-46cd-b9ce-b6ca7cd0251f
#############################################
# AdminAuthInfo #
#############################################
ServerHealth:
type: object
properties:
okay:
type: boolean
required:
- okay
#############################################
# AdminAuthInfo #
#############################################
AdminAuthInfo:
type: object
properties:
username:
type: string
required:
- username
responses:
401Unauthorized:
description: "401 - Unauthorized"
404NotFound:
description: "Not Found"
content:
text/plain:
schema:
type: string
409Conflict:
description: "409 - Conflict"
content:
text/plain:
schema:
type: string
500InternalError:
description: "500 - Internal Server Error"
content:
text/plain:
schema:
type: string
503ServiceUnavailable:
description: "503 - Service Unavailable"
content:
text/plain:
schema:
type: string
paths:
/server/health:
get:
operationId: "ServerGetHealthcheck"
tags:
- server
description: "Endpoint for doing a Healthcheck of the Server"
responses:
200:
description: "A Health-Report of the server"
content:
application/json:
schema:
$ref: "#/components/schemas/ServerHealth"
500:
$ref: "#/components/responses/500InternalError"
503:
$ref: "#/components/responses/503ServiceUnavailable"
/admin/authenticated:
get:
operationId: "AdminGetAuthenticated"
tags:
- admin
description: "Endpoint for Checking if you're authenticated as an admin"
responses:
200:
description: "A Minimal Admin Info for testing if the admin is logged in"
content:
application/json:
schema:
$ref: "#/components/schemas/AdminAuthInfo"
401:
$ref: "#/components/responses/401Unauthorized"
500:
$ref: "#/components/responses/500InternalError"
503:
$ref: "#/components/responses/503ServiceUnavailable"