From 4e6bd72a213345a3a9b283dc4bf46a1865f93a5b Mon Sep 17 00:00:00 2001 From: aronmal Date: Thu, 8 Feb 2024 09:24:36 +0100 Subject: [PATCH] Completed openapi specs --- public/api/specs/liljudd.json | 370 ++++++++++++++++++++++++++++++---- 1 file changed, 332 insertions(+), 38 deletions(-) diff --git a/public/api/specs/liljudd.json b/public/api/specs/liljudd.json index f50e1e7..743d573 100644 --- a/public/api/specs/liljudd.json +++ b/public/api/specs/liljudd.json @@ -10,13 +10,42 @@ "version": "0.0.0" }, "paths": { + "/api/config/boot": { + "get": { + "tags": ["Guild configs"], + "summary": "Find a guild's config by ID", + "description": "Returns a single guild's config.", + "operationId": "getGuildsFromBoot", + "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": [] + } + ] + } + }, "/api/config/{guildId}": { "get": { - "tags": [ - "Guild configs" - ], - "summary": "Find guild config by ID", - "description": "Returns a single guild config", + "tags": ["Guild configs"], + "summary": "Find a guild's config by ID", + "description": "Returns a single guild's config.", "operationId": "getGuildById", "parameters": [ { @@ -26,7 +55,7 @@ "required": true, "schema": { "type": "string", - "format": "varchar(19)" + "format": "varchar(20)" } } ], @@ -55,11 +84,9 @@ ] }, "delete": { - "tags": [ - "Guild configs" - ], - "summary": "Deletes a guild config by ID", - "description": "Delete a guild's config", + "tags": ["Guild configs"], + "summary": "Deletes a guild's config by ID", + "description": "Delete a guild's config when the bot is removed from the guild.", "operationId": "deleteGuildById", "parameters": [ { @@ -69,7 +96,7 @@ "required": true, "schema": { "type": "string", - "format": "varchar(19)" + "format": "varchar(20)" } } ], @@ -93,10 +120,8 @@ }, "/api/tp_messages/{guildId}": { "get": { - "tags": [ - "Time planning messages" - ], - "summary": "Find guild by ID for it's tp_messages", + "tags": ["Time planning messages"], + "summary": "Find the tp_messages of guild by ID", "description": "Returns tp_messages for a guild", "operationId": "getTp_messagesOfGuildById", "parameters": [ @@ -107,7 +132,7 @@ "required": true, "schema": { "type": "string", - "format": "varchar(19)" + "format": "varchar(20)" } } ], @@ -117,7 +142,222 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/guildConfig" + "$ref": "#/components/schemas/tp_messages" + } + } + } + }, + "204": { + "description": "Time planning not enabled for this guild" + }, + "400": { + "description": "Invalid ID supplied" + }, + "404": { + "description": "Guild not found" + } + }, + "security": [ + { + "api_key": [] + } + ] + }, + "put": { + "tags": ["Time planning messages"], + "summary": "Put message IDs for tp_messages of guild by ID", + "description": "Returns tp_messages for a guild", + "operationId": "putTp_messagesOfGuildById", + "parameters": [ + { + "name": "guildId", + "in": "path", + "description": "ID of guild's tp_messages to return", + "required": true, + "schema": { + "type": "string", + "format": "varchar(20)" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/tp_messages" + } + } + } + }, + "204": { + "description": "Time planning not enabled for this guild" + }, + "400": { + "description": "Invalid ID supplied" + }, + "404": { + "description": "Guild not found" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/api/match/{guildId}/{channelId}": { + "post": { + "tags": ["Matches"], + "summary": "Save a new created match in channel of guild by IDs", + "description": "Returns tp_messages for a guild", + "operationId": "postMatchOfGuildById", + "parameters": [ + { + "name": "guildId", + "in": "path", + "description": "ID of match's guild to set", + "required": true, + "schema": { + "type": "string", + "format": "varchar(20)" + } + }, + { + "name": "channelId", + "in": "path", + "description": "ID of match's channel to set", + "required": true, + "schema": { + "type": "string", + "format": "varchar(20)" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/tp_messages" + } + } + } + }, + "204": { + "description": "Time planning not enabled for this guild" + }, + "400": { + "description": "Invalid ID supplied" + }, + "404": { + "description": "Guild not found" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/api/match/{guildId}/{channelId}/{matchMessageId}": { + "put": { + "tags": ["Matches"], + "summary": "Set state for match of guild by IDs", + "description": "Returns tp_messages for a guild", + "operationId": "putMatchOfGuildById", + "parameters": [ + { + "name": "guildId", + "in": "path", + "description": "ID of guild's tp_messages to return", + "required": true, + "schema": { + "type": "string", + "format": "varchar(20)" + } + }, + { + "name": "channelId", + "in": "path", + "description": "ID of match's channel to set", + "required": true, + "schema": { + "type": "string", + "format": "varchar(20)" + } + }, + { + "name": "matchMessageId", + "in": "path", + "description": "ID of match's message Id to set", + "required": true, + "schema": { + "type": "string", + "format": "varchar(20)" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/tp_messages" + } + } + } + }, + "204": { + "description": "Time planning not enabled for this guild" + }, + "400": { + "description": "Invalid ID supplied" + }, + "404": { + "description": "Guild not found" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/api/match/{guildId}": { + "get": { + "tags": ["Matches"], + "summary": "Find all matches of guild by ID", + "description": "Returns tp_messages for a guild", + "operationId": "getMatchesOfGuildById", + "parameters": [ + { + "name": "guildId", + "in": "path", + "description": "ID of guild's tp_messages to return", + "required": true, + "schema": { + "type": "string", + "format": "varchar(20)" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tp_messages" + } } } } @@ -147,9 +387,14 @@ "properties": { "guildID": { "type": "string", - "format": "varchar(19)", + "format": "varchar(20)", "example": "1234567890123456789" }, + "timezone": { + "type": "string", + "format": "text", + "example": "Europe/Berlin" + }, "features": { "type": "object", "properties": { @@ -158,22 +403,40 @@ "properties": { "channelID": { "type": "string", - "format": "varchar(19)", + "format": "varchar(20)", "example": "1234567890123456789" }, - "cron": { - "type": "string", - "example": "0 0 1 * * * 60o 1w" + "targetMinute": { + "type": "number", + "example": 0 }, - "isAvailableRoleId": { - "type": "string", - "format": "varchar(19)", - "example": "1234567890123456789" + "targetHour": { + "type": "number", + "example": 1 }, - "wantsToBeNotifieRoledId": { - "type": "string", - "format": "varchar(19)", - "example": "1234567890123456789" + "targetDay": { + "type": "number", + "example": 1 + }, + "roles": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "isAvailableRoleId": { + "type": "string", + "format": "varchar(20)", + "example": "1234567890123456789", + "nullable": true + }, + "wantsToBeNotifieRoledId": { + "type": "string", + "format": "varchar(20)", + "example": "1234567890123456789", + "nullable": true + } + } } } } @@ -192,7 +455,7 @@ "properties": { "channelID": { "type": "string", - "format": "varchar(19)", + "format": "varcharq(20)", "example": "1234567890123456789" }, "matchType": { @@ -202,12 +465,12 @@ }, "createrId": { "type": "string", - "format": "varchar(19)", + "format": "varchar(20)", "example": "1234567890123456789" }, "roleId": { "type": "string", - "format": "varchar(19)", + "format": "varchar(20)", "example": "1234567890123456789" }, "opponentName": { @@ -217,12 +480,43 @@ }, "messsageId": { "type": "string", - "format": "varchar(19)", + "format": "varchar(20)", "example": "1234567890123456789" }, - "cron": { + "utc_ts": { "type": "string", - "example": "0 0 1 5 2 2023 60o" + "example": "1706180188" + } + } + }, + "tp_messages": { + "type": "object", + "properties": { + "guildId": { + "type": "string", + "format": "varchar(20)", + "example": "1234567890123456789" + }, + "channelId": { + "type": "string", + "format": "varchar(20)", + "example": "1234567890123456789" + }, + "messageIds": { + "type": "array", + "items": { + "type": "string", + "format": "varchar(20)", + "example": [ + "1234567890123456789", + "1234567890123456789", + "1234567890123456789", + "1234567890123456789", + "1234567890123456789", + "1234567890123456789", + "1234567890123456789" + ] + } } } } @@ -235,4 +529,4 @@ } } } -} \ No newline at end of file +}