{ "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", "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": [] } ] } }, "/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", "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" } } } }, "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": [] } ] }, "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's config to delete", "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" } } } }, "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": [] } ] } }, "/api/{guildId}/timePlanning": { "get": { "tags": ["Time planning messages"], "summary": "Find the timePlanning of guild by ID", "description": "Returns timePlanning for a guild", "operationId": "gettimePlanningOfGuildById", "parameters": [ { "name": "guildId", "in": "path", "description": "ID of guild's timePlanning to return", "required": true, "schema": { "type": "string", "format": "varchar(20)" } } ], "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/timePlanning" } } } }, "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": [] } ] }, "put": { "tags": ["Time planning messages"], "summary": "Put new message IDs for timePlanning of guild by ID", "description": "Returns timePlanning for a guild", "operationId": "puttimePlanningOfGuildById", "parameters": [ { "name": "guildId", "in": "path", "description": "ID of guild's timePlanning to return", "required": true, "schema": { "type": "string", "format": "varchar(20)" } } ], "requestBody": { "description": "Put new message IDs for timePlanning in channel", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/timePlanning" } } }, "required": true }, "responses": { "204": { "description": "successful operation" }, "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": [] } ] } }, "/api/{guildId}/matches": { "get": { "tags": ["Matches"], "summary": "Find all matches of guild by ID", "description": "Returns timePlanning for a guild", "operationId": "getMatchesOfGuildById", "parameters": [ { "name": "guildId", "in": "path", "description": "ID of guild's timePlanning 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" } } } } } }, "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": ["Matches"], "summary": "Save a new created match of guild by ID", "description": "Returns timePlanning 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", "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": [] } ] } } }, "components": { "schemas": { "guildConfig": { "type": "object", "required": ["guildId", "timezone", "features", "matches", "checksum"], "properties": { "guildId": { "$ref": "#/components/schemas/id" }, "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": { "$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" } } } } } } }, "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": { "$ref": "#/components/schemas/id" }, "createrId": { "$ref": "#/components/schemas/id" }, "roleId": { "$ref": "#/components/schemas/id" }, "messageId": { "$ref": "#/components/schemas/id" }, "matchType": { "type": "string", "format": "varchar(50)", "example": "Scrim" }, "opponentName": { "type": "string", "format": "varchar(100)", "example": "?" }, "utc_ts": { "type": "string", "example": "2020-01-01T00:00:00Z" } } }, "timePlanning": { "type": "object", "required": [ "enabled", "channelId", "rolesEnabled", "isAvailableRoleId", "wantsToBeNotifieRoledId", "messageIds" ], "properties": { "enabled": { "type": "boolean" }, "channelId": { "$ref": "#/components/schemas/idOrNull" }, "rolesEnabled": { "type": "boolean" }, "isAvailableRoleId": { "$ref": "#/components/schemas/idOrNull" }, "wantsToBeNotifieRoledId": { "$ref": "#/components/schemas/idOrNull" }, "messageIds": { "type": "object", "required": ["0", "1", "2", "3", "4", "5", "6"], "properties": { "0": { "$ref": "#/components/schemas/idOrNull" }, "1": { "$ref": "#/components/schemas/idOrNull" }, "2": { "$ref": "#/components/schemas/idOrNull" }, "3": { "$ref": "#/components/schemas/idOrNull" }, "4": { "$ref": "#/components/schemas/idOrNull" }, "5": { "$ref": "#/components/schemas/idOrNull" }, "6": { "$ref": "#/components/schemas/idOrNull" } } } } }, "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" } } } }, "securitySchemes": { "basicAuth": { "type": "http", "scheme": "basic" } } } }