liljudd-website/public/api/specs/liljudd.json

730 lines
19 KiB
JSON
Raw Normal View History

2024-01-16 19:24:48 +00:00
{
"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": {
2024-02-26 20:46:33 +00:00
"/api/boot": {
2024-02-08 08:24:36 +00:00
"get": {
2024-02-26 20:46:33 +00:00
"tags": ["Bot bootup"],
"summary": "Retrieve all guild's configs",
"description": "Returns all guild's configs.",
"operationId": "getGuildsForBoot",
2024-02-08 08:24:36 +00:00
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
2024-02-26 20:46:33 +00:00
"type": "array",
"items": {
"$ref": "#/components/schemas/guildConfig"
}
2024-02-08 08:24:36 +00:00
}
}
}
},
"400": {
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-08 08:24:36 +00:00
},
2024-02-26 20:46:33 +00:00
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-26 20:46:33 +00:00
},
2024-02-08 08:24:36 +00:00
"404": {
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-08 08:24:36 +00:00
}
},
"security": [
{
2024-02-26 20:46:33 +00:00
"basicAuth": []
2024-02-08 08:24:36 +00:00
}
]
}
},
2024-02-12 09:49:28 +00:00
"/api/{guildId}/config": {
2024-01-16 19:24:48 +00:00
"get": {
2024-02-26 20:46:33 +00:00
"tags": ["Guild config"],
2024-02-08 08:24:36 +00:00
"summary": "Find a guild's config by ID",
"description": "Returns a single guild's config.",
2024-01-16 19:24:48 +00:00
"operationId": "getGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild config to return",
"required": true,
"schema": {
"type": "string",
2024-02-08 08:24:36 +00:00
"format": "varchar(20)"
2024-01-16 19:24:48 +00:00
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/guildConfig"
}
}
}
},
"400": {
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"404": {
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
}
},
"security": [
{
"basicAuth": []
}
]
},
"post": {
"tags": ["Guild config"],
"summary": "Creates a guild's config by ID",
"description": "Create a guild's config when the bot is has joined a new guild.",
"operationId": "postGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild's config to create",
"required": true,
"schema": {
"type": "string",
"format": "varchar(20)"
}
}
],
"responses": {
"204": {
"description": "successful operation"
},
"400": {
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-01-16 19:24:48 +00:00
},
2024-02-26 20:46:33 +00:00
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-26 20:46:33 +00:00
},
2024-01-16 19:24:48 +00:00
"404": {
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-01-16 19:24:48 +00:00
}
},
"security": [
{
2024-02-26 20:46:33 +00:00
"basicAuth": []
2024-01-16 19:24:48 +00:00
}
]
},
"delete": {
2024-02-26 20:46:33 +00:00
"tags": ["Guild config"],
2024-02-08 08:24:36 +00:00
"summary": "Deletes a guild's config by ID",
"description": "Delete a guild's config when the bot is removed from the guild.",
2024-01-16 19:24:48 +00:00
"operationId": "deleteGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild's config to delete",
2024-01-16 19:24:48 +00:00
"required": true,
"schema": {
"type": "string",
2024-02-08 08:24:36 +00:00
"format": "varchar(20)"
2024-01-16 19:24:48 +00:00
}
}
],
"responses": {
"204": {
"description": "successful operation"
},
"400": {
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-01-16 19:24:48 +00:00
},
2024-02-26 20:46:33 +00:00
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-26 20:46:33 +00:00
},
2024-01-16 19:24:48 +00:00
"404": {
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-01-16 19:24:48 +00:00
}
},
"security": [
{
2024-02-26 20:46:33 +00:00
"basicAuth": []
2024-01-16 19:24:48 +00:00
}
]
}
},
"/api/{guildId}/timePlanning": {
2024-01-16 19:24:48 +00:00
"get": {
2024-02-08 08:24:36 +00:00
"tags": ["Time planning messages"],
"summary": "Find the timePlanning of guild by ID",
"description": "Returns timePlanning for a guild",
"operationId": "gettimePlanningOfGuildById",
2024-01-16 19:24:48 +00:00
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild's timePlanning to return",
2024-01-16 19:24:48 +00:00
"required": true,
"schema": {
"type": "string",
2024-02-08 08:24:36 +00:00
"format": "varchar(20)"
2024-01-16 19:24:48 +00:00
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/timePlanning"
2024-02-08 08:24:36 +00:00
}
}
}
},
"400": {
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-08 08:24:36 +00:00
},
2024-02-26 20:46:33 +00:00
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-26 20:46:33 +00:00
},
2024-02-08 08:24:36 +00:00
"404": {
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-08 08:24:36 +00:00
}
},
"security": [
{
2024-02-26 20:46:33 +00:00
"basicAuth": []
2024-02-08 08:24:36 +00:00
}
]
},
"put": {
"tags": ["Time planning messages"],
"summary": "Put new message IDs for timePlanning of guild by ID",
"description": "Returns timePlanning for a guild",
"operationId": "puttimePlanningOfGuildById",
2024-02-08 08:24:36 +00:00
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild's timePlanning to return",
2024-02-08 08:24:36 +00:00
"required": true,
"schema": {
"type": "string",
"format": "varchar(20)"
}
}
],
2024-02-26 20:46:33 +00:00
"requestBody": {
"description": "Put new message IDs for timePlanning in channel",
2024-02-26 20:46:33 +00:00
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/timePlanning"
2024-02-08 08:24:36 +00:00
}
}
},
2024-02-26 20:46:33 +00:00
"required": true
},
"responses": {
2024-02-08 08:24:36 +00:00
"204": {
2024-02-26 20:46:33 +00:00
"description": "successful operation"
2024-02-08 08:24:36 +00:00
},
"400": {
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-08 08:24:36 +00:00
},
2024-02-26 20:46:33 +00:00
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-26 20:46:33 +00:00
},
2024-02-08 08:24:36 +00:00
"404": {
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-08 08:24:36 +00:00
}
},
"security": [
{
2024-02-26 20:46:33 +00:00
"basicAuth": []
2024-02-08 08:24:36 +00:00
}
]
}
},
2024-02-12 09:49:28 +00:00
"/api/{guildId}/matches": {
"get": {
2024-02-08 08:24:36 +00:00
"tags": ["Matches"],
2024-02-12 09:49:28 +00:00
"summary": "Find all matches of guild by ID",
"description": "Returns timePlanning for a guild",
2024-02-12 09:49:28 +00:00
"operationId": "getMatchesOfGuildById",
2024-02-08 08:24:36 +00:00
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild's timePlanning to return",
2024-02-08 08:24:36 +00:00
"required": true,
"schema": {
"type": "string",
"format": "varchar(20)"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
2024-02-26 20:46:33 +00:00
"type": "object",
"required": ["matches", "timezone"],
"properties": {
"matches": {
"type": "array",
"items": {
"$ref": "#/components/schemas/match"
}
},
"timezone": {
"type": "string",
"format": "text",
"example": "Europe/Berlin"
}
2024-02-12 09:49:28 +00:00
}
2024-02-08 08:24:36 +00:00
}
}
}
},
"400": {
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-08 08:24:36 +00:00
},
2024-02-26 20:46:33 +00:00
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-26 20:46:33 +00:00
},
2024-02-08 08:24:36 +00:00
"404": {
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-08 08:24:36 +00:00
}
},
"security": [
{
2024-02-26 20:46:33 +00:00
"basicAuth": []
2024-02-08 08:24:36 +00:00
}
]
2024-02-26 20:46:33 +00:00
},
2024-02-12 09:49:28 +00:00
"post": {
2024-02-08 08:24:36 +00:00
"tags": ["Matches"],
2024-02-26 20:46:33 +00:00
"summary": "Save a new created match of guild by ID",
"description": "Returns timePlanning for a guild",
2024-02-12 09:49:28 +00:00
"operationId": "postMatchOfGuildById",
2024-02-08 08:24:36 +00:00
"parameters": [
{
"name": "guildId",
"in": "path",
2024-02-12 09:49:28 +00:00
"description": "ID of match's guild to set",
2024-02-08 08:24:36 +00:00
"required": true,
"schema": {
"type": "string",
"format": "varchar(20)"
}
}
],
2024-02-26 20:46:33 +00:00
"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"
}
2024-02-08 08:24:36 +00:00
}
}
}
},
2024-02-26 20:46:33 +00:00
"required": true
2024-02-08 08:24:36 +00:00
},
"responses": {
2024-01-16 19:24:48 +00:00
"204": {
2024-02-26 20:46:33 +00:00
"description": "successful operation"
2024-01-16 19:24:48 +00:00
},
"400": {
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-01-16 19:24:48 +00:00
},
2024-02-26 20:46:33 +00:00
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-02-26 20:46:33 +00:00
},
2024-01-16 19:24:48 +00:00
"404": {
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
2024-01-16 19:24:48 +00:00
}
},
"security": [
{
2024-02-26 20:46:33 +00:00
"basicAuth": []
2024-01-16 19:24:48 +00:00
}
]
}
}
},
"components": {
"schemas": {
"guildConfig": {
"type": "object",
2024-02-26 20:46:33 +00:00
"required": ["guildId", "timezone", "features", "matches", "checksum"],
2024-01-16 19:24:48 +00:00
"properties": {
2024-02-26 20:46:33 +00:00
"guildId": {
"$ref": "#/components/schemas/id"
2024-01-16 19:24:48 +00:00
},
2024-02-08 08:24:36 +00:00
"timezone": {
"type": "string",
"format": "text",
"example": "Europe/Berlin"
},
2024-01-16 19:24:48 +00:00
"features": {
"type": "object",
2024-02-26 20:46:33 +00:00
"required": ["timePlanning"],
2024-01-16 19:24:48 +00:00
"properties": {
2024-02-26 20:46:33 +00:00
"timePlanning": {
"$ref": "#/components/schemas/timePlanning"
2024-01-16 19:24:48 +00:00
}
}
},
"matches": {
"type": "array",
"items": {
"$ref": "#/components/schemas/match"
}
2024-02-26 20:46:33 +00:00
},
"checksum": {
"type": "string"
2024-01-16 19:24:48 +00:00
}
}
},
"match": {
"type": "object",
2024-02-26 20:46:33 +00:00
"required": [
"channelId",
"matchType",
"createrId",
"roleId",
"opponentName",
"messageId",
"utc_ts"
],
2024-01-16 19:24:48 +00:00
"properties": {
2024-02-26 20:46:33 +00:00
"channelId": {
"$ref": "#/components/schemas/id"
2024-01-16 19:24:48 +00:00
},
"createrId": {
"$ref": "#/components/schemas/id"
2024-01-16 19:24:48 +00:00
},
"roleId": {
"$ref": "#/components/schemas/id"
2024-02-28 20:58:57 +00:00
},
"messageId": {
"$ref": "#/components/schemas/id"
2024-02-28 20:58:57 +00:00
},
"matchType": {
2024-01-16 19:24:48 +00:00
"type": "string",
2024-02-28 20:58:57 +00:00
"format": "varchar(50)",
"example": "Scrim"
2024-01-16 19:24:48 +00:00
},
"opponentName": {
"type": "string",
"format": "varchar(100)",
"example": "?"
},
2024-02-08 08:24:36 +00:00
"utc_ts": {
"type": "string",
2024-02-26 20:46:33 +00:00
"example": "2020-01-01T00:00:00Z"
2024-02-08 08:24:36 +00:00
}
}
},
"timePlanning": {
2024-02-08 08:24:36 +00:00
"type": "object",
"required": [
"channelId",
"targetMinute",
"targetHour",
"targetDay",
"roles",
"messageIds"
],
2024-02-08 08:24:36 +00:00
"properties": {
"channelId": {
"$ref": "#/components/schemas/idOrNull"
},
"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": {
"$ref": "#/components/schemas/idOrNull"
},
"wantsToBeNotifieRoledId": {
"$ref": "#/components/schemas/idOrNull"
}
}
2024-02-08 08:24:36 +00:00
},
"messageIds": {
2024-02-26 20:46:33 +00:00
"type": "object",
"required": ["0", "1", "2", "3", "4", "5", "6"],
"properties": {
"0": {
"$ref": "#/components/schemas/idOrNull"
2024-02-26 20:46:33 +00:00
},
"1": {
"$ref": "#/components/schemas/idOrNull"
2024-02-26 20:46:33 +00:00
},
"2": {
"$ref": "#/components/schemas/idOrNull"
2024-02-26 20:46:33 +00:00
},
"3": {
"$ref": "#/components/schemas/idOrNull"
2024-02-26 20:46:33 +00:00
},
"4": {
"$ref": "#/components/schemas/idOrNull"
2024-02-26 20:46:33 +00:00
},
"5": {
"$ref": "#/components/schemas/idOrNull"
2024-02-26 20:46:33 +00:00
},
"6": {
"$ref": "#/components/schemas/idOrNull"
2024-02-26 20:46:33 +00:00
}
}
2024-01-16 19:24:48 +00:00
}
}
},
"id": {
"type": "string",
"pattern": "^\\d{7,20}$",
"example": "1234567890123456789"
},
"idOrNull": {
"type": "string",
"pattern": "^\\d{7,20}$",
"example": "1234567890123456789",
"nullable": true
},
"error": {
"type": "object",
"required": "error",
"properties": {
"error": {
"type": "string"
}
}
2024-01-16 19:24:48 +00:00
}
},
"securitySchemes": {
2024-02-26 20:46:33 +00:00
"basicAuth": {
2024-02-18 21:02:52 +00:00
"type": "http",
2024-02-26 20:46:33 +00:00
"scheme": "basic"
2024-01-16 19:24:48 +00:00
}
}
}
2024-02-08 08:24:36 +00:00
}