liljudd-website/public/api/specs/liljudd.json
2024-02-26 21:46:33 +01:00

564 lines
15 KiB
JSON

{
"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/boot": {
"get": {
"tags": ["Bot bootup"],
"summary": "Retrieve all guild's configs",
"description": "Returns all guild's configs.",
"operationId": "getGuildsForBoot",
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/guildConfig"
}
}
}
}
},
"400": {
"description": "Invalid ID supplied"
},
"401": {
"description": "Unauthorized"
},
"404": {
"description": "Guild not found"
}
},
"security": [
{
"basicAuth": []
}
]
}
},
"/api/{guildId}/config": {
"get": {
"tags": ["Guild config"],
"summary": "Find a guild's config by ID",
"description": "Returns a single guild's config.",
"operationId": "getGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild config to return",
"required": true,
"schema": {
"type": "string",
"format": "varchar(20)"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/guildConfig"
}
}
}
},
"400": {
"description": "Invalid ID supplied"
},
"401": {
"description": "Unauthorized"
},
"404": {
"description": "Guild not found"
}
},
"security": [
{
"basicAuth": []
}
]
},
"delete": {
"tags": ["Guild config"],
"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": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild config to delete",
"required": true,
"schema": {
"type": "string",
"format": "varchar(20)"
}
}
],
"responses": {
"204": {
"description": "successful operation"
},
"400": {
"description": "Invalid ID supplied"
},
"401": {
"description": "Unauthorized"
},
"404": {
"description": "Guild not found"
}
},
"security": [
{
"basicAuth": []
}
]
}
},
"/api/{guildId}/tp_messages": {
"get": {
"tags": ["Time planning messages"],
"summary": "Find the tp_messages of guild by ID",
"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(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"
},
"401": {
"description": "Unauthorized"
},
"404": {
"description": "Guild not found"
}
},
"security": [
{
"basicAuth": []
}
]
},
"put": {
"tags": ["Time planning messages"],
"summary": "Put new 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)"
}
}
],
"requestBody": {
"description": "Put new message IDs for tp_messages in channel",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tp_messages"
}
}
},
"required": true
},
"responses": {
"204": {
"description": "successful operation"
},
"400": {
"description": "Invalid ID supplied"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Time planning not enabled for this guild"
},
"404": {
"description": "Guild not found"
}
},
"security": [
{
"basicAuth": []
}
]
}
},
"/api/{guildId}/matches": {
"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": "object",
"required": ["matches", "timezone"],
"properties": {
"matches": {
"type": "array",
"items": {
"$ref": "#/components/schemas/match"
}
},
"timezone": {
"type": "string",
"format": "text",
"example": "Europe/Berlin"
}
}
}
}
}
},
"204": {
"description": "Time planning not enabled for this guild"
},
"400": {
"description": "Invalid ID supplied"
},
"401": {
"description": "Unauthorized"
},
"404": {
"description": "Guild not found"
}
},
"security": [
{
"basicAuth": []
}
]
},
"post": {
"tags": ["Matches"],
"summary": "Save a new created match of guild by ID",
"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)"
}
}
],
"requestBody": {
"description": "Save a new created match in channel",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["match", "timezone"],
"properties": {
"match": {
"$ref": "#/components/schemas/match"
},
"timezone": {
"type": "string",
"format": "text",
"example": "Europe/Berlin",
"description": "Has to match guild tz"
}
}
}
}
},
"required": true
},
"responses": {
"204": {
"description": "successful operation"
},
"400": {
"description": "Invalid ID supplied"
},
"401": {
"description": "Unauthorized"
},
"404": {
"description": "Guild not found"
}
},
"security": [
{
"basicAuth": []
}
]
}
}
},
"components": {
"schemas": {
"guildConfig": {
"type": "object",
"required": ["guildId", "timezone", "features", "matches", "checksum"],
"properties": {
"guildId": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789"
},
"timezone": {
"type": "string",
"format": "text",
"example": "Europe/Berlin"
},
"features": {
"type": "object",
"required": ["timePlanning"],
"properties": {
"timePlanning": {
"type": "object",
"required": [
"enabled",
"channelId",
"targetMinute",
"targetHour",
"targetDay",
"roles"
],
"properties": {
"enabled": {
"type": "boolean"
},
"channelId": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789",
"nullable": true
},
"targetMinute": {
"type": "number",
"example": 0
},
"targetHour": {
"type": "number",
"example": 1
},
"targetDay": {
"type": "number",
"example": 1
},
"roles": {
"type": "object",
"required": [
"enabled",
"isAvailableRoleId",
"wantsToBeNotifieRoledId"
],
"properties": {
"enabled": {
"type": "boolean"
},
"isAvailableRoleId": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789",
"nullable": true
},
"wantsToBeNotifieRoledId": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789",
"nullable": true
}
}
}
}
}
}
},
"matches": {
"type": "array",
"items": {
"$ref": "#/components/schemas/match"
}
},
"checksum": {
"type": "string"
}
}
},
"match": {
"type": "object",
"required": [
"channelId",
"matchType",
"createrId",
"roleId",
"opponentName",
"messageId",
"utc_ts"
],
"properties": {
"channelId": {
"type": "string",
"format": "varcharq(20)",
"example": "1234567890123456789"
},
"matchType": {
"type": "string",
"format": "varchar(50)",
"example": "Scrim"
},
"createrId": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789"
},
"roleId": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789"
},
"opponentName": {
"type": "string",
"format": "varchar(100)",
"example": "?"
},
"messageId": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789"
},
"utc_ts": {
"type": "string",
"example": "2020-01-01T00:00:00Z"
}
}
},
"tp_messages": {
"type": "object",
"required": ["channelId", "messageIds"],
"properties": {
"channelId": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789"
},
"messageIds": {
"type": "object",
"required": ["0", "1", "2", "3", "4", "5", "6"],
"properties": {
"0": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789",
"nullable": true
},
"1": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789",
"nullable": true
},
"2": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789",
"nullable": true
},
"3": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789",
"nullable": true
},
"4": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789",
"nullable": true
},
"5": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789",
"nullable": true
},
"6": {
"type": "string",
"format": "varchar(20)",
"example": "1234567890123456789",
"nullable": true
}
}
}
}
}
},
"securitySchemes": {
"basicAuth": {
"type": "http",
"scheme": "basic"
}
}
}
}