feat: complete last commit

This commit is contained in:
Aron Malcher 2024-01-16 20:24:48 +01:00
parent 55b81fac91
commit c3bf31b3d4
Signed by: aronmal
GPG key ID: 816B7707426FC612
14 changed files with 8344 additions and 58 deletions

34
public/api/index.html Normal file
View file

@ -0,0 +1,34 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="SwaggerUI" />
<title>SwaggerUI</title>
<link
rel="stylesheet"
href="https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui.css"
/>
</head>
<body>
<div id="swagger-ui"></div>
<script
src="https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui-bundle.js"
crossorigin
></script>
<script
src="https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui-standalone-preset.js"
crossorigin
></script>
<script>
window.onload = () => {
window.ui = SwaggerUIBundle({
url: "/api/specs/liljudd.json",
dom_id: "#swagger-ui",
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
layout: "StandaloneLayout",
});
};
</script>
</body>
</html>

View file

@ -0,0 +1,238 @@
{
"openapi": "3.0.0",
"info": {
"title": "li'l Judd - OpenAPI 3.0",
"description": "None yet",
"termsOfService": "https://liljudd.ink/terms-of-service/",
"contact": {
"url": "https://liljudd.ink/contact/"
},
"version": "0.0.0"
},
"paths": {
"/api/config/{guildId}": {
"get": {
"tags": [
"Guild configs"
],
"summary": "Find guild config by ID",
"description": "Returns a single guild config",
"operationId": "getGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild config to return",
"required": true,
"schema": {
"type": "string",
"format": "varchar(19)"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/guildConfig"
}
}
}
},
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Guild not found"
}
},
"security": [
{
"api_key": []
}
]
},
"delete": {
"tags": [
"Guild configs"
],
"summary": "Deletes a guild config by ID",
"description": "Delete a guild's config",
"operationId": "deleteGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild config to delete",
"required": true,
"schema": {
"type": "string",
"format": "varchar(19)"
}
}
],
"responses": {
"204": {
"description": "successful operation"
},
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Guild not found"
}
},
"security": [
{
"api_key": []
}
]
}
},
"/api/tp_messages/{guildId}": {
"get": {
"tags": [
"Time planning messages"
],
"summary": "Find guild by ID for it's tp_messages",
"description": "Returns tp_messages for a guild",
"operationId": "getTp_messagesOfGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild's tp_messages to return",
"required": true,
"schema": {
"type": "string",
"format": "varchar(19)"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/guildConfig"
}
}
}
},
"204": {
"description": "Time planning not enabled for this guild"
},
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Guild not found"
}
},
"security": [
{
"api_key": []
}
]
}
}
},
"components": {
"schemas": {
"guildConfig": {
"type": "object",
"properties": {
"guildID": {
"type": "string",
"format": "varchar(19)",
"example": "1234567890123456789"
},
"features": {
"type": "object",
"properties": {
"time_planning": {
"type": "object",
"properties": {
"channelID": {
"type": "string",
"format": "varchar(19)",
"example": "1234567890123456789"
},
"cron": {
"type": "string",
"example": "0 0 1 * * * 60o 1w"
},
"isAvailableRoleId": {
"type": "string",
"format": "varchar(19)",
"example": "1234567890123456789"
},
"wantsToBeNotifieRoledId": {
"type": "string",
"format": "varchar(19)",
"example": "1234567890123456789"
}
}
}
}
},
"matches": {
"type": "array",
"items": {
"$ref": "#/components/schemas/match"
}
}
}
},
"match": {
"type": "object",
"properties": {
"channelID": {
"type": "string",
"format": "varchar(19)",
"example": "1234567890123456789"
},
"matchType": {
"type": "string",
"format": "varchar(50)",
"example": "Scrim"
},
"createrId": {
"type": "string",
"format": "varchar(19)",
"example": "1234567890123456789"
},
"roleId": {
"type": "string",
"format": "varchar(19)",
"example": "1234567890123456789"
},
"opponentName": {
"type": "string",
"format": "varchar(100)",
"example": "?"
},
"messsageId": {
"type": "string",
"format": "varchar(19)",
"example": "1234567890123456789"
},
"cron": {
"type": "string",
"example": "0 0 1 5 2 2023 60o"
}
}
}
},
"securitySchemes": {
"api_key": {
"type": "apiKey",
"name": "api_key",
"in": "header"
}
}
}
}