From 0f2e56df5ca3fab22802009303df0091bb91962d Mon Sep 17 00:00:00 2001 From: Revolt CI Date: Thu, 15 Jun 2023 14:29:11 +0000 Subject: [PATCH] chore: generate OpenAPI specification --- OpenAPI.json | 484 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 483 insertions(+), 1 deletion(-) diff --git a/OpenAPI.json b/OpenAPI.json index 157830c..464c4fa 100644 --- a/OpenAPI.json +++ b/OpenAPI.json @@ -13,7 +13,7 @@ "name": "AGPLv3", "url": "https://github.com/revoltchat/delta/blob/master/LICENSE" }, - "version": "0.6.1" + "version": "0.6.2" }, "servers": [ { @@ -5639,6 +5639,425 @@ } ] } + }, + "/webhooks/{webhook_id}/{token}": { + "get": { + "tags": [ + "Webhooks" + ], + "summary": "Gets a webhook", + "description": "Gets a webhook with a token", + "operationId": "webhook_fetch_token_webhook_fetch_token", + "parameters": [ + { + "name": "webhook_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + }, + { + "name": "token", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "An error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Webhook" + } + } + } + } + } + }, + "post": { + "tags": [ + "Webhooks" + ], + "summary": "Executes a webhook", + "description": "Executes a webhook and sends a message", + "operationId": "webhook_execute_webhook_execute", + "parameters": [ + { + "name": "webhook_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + }, + { + "name": "token", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "Idempotency-Key", + "in": "header", + "description": "Unique key to prevent duplicate requests", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataMessageSend" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "An error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Message" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Webhooks" + ], + "summary": "Deletes a webhook", + "description": "Deletes a webhook with a token", + "operationId": "webhook_delete_token_webhook_delete_token", + "parameters": [ + { + "name": "webhook_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + }, + { + "name": "token", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "An error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "204": { + "description": "Success" + } + } + }, + "patch": { + "tags": [ + "Webhooks" + ], + "summary": "Edits a webhook", + "description": "Edits a webhook with a token", + "operationId": "webhook_edit_token_webhook_edit_token", + "parameters": [ + { + "name": "webhook_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + }, + { + "name": "token", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataEditWebhook" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "An error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Webhook" + } + } + } + } + } + } + }, + "/webhooks/{webhook_id}": { + "get": { + "tags": [ + "Webhooks" + ], + "summary": "Gets a webhook", + "description": "Gets a webhook", + "operationId": "webhook_fetch_webhook_fetch", + "parameters": [ + { + "name": "webhook_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + } + ], + "responses": { + "default": { + "description": "An error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResponseWebhook" + } + } + } + } + }, + "security": [ + { + "Session Token": [] + } + ] + }, + "delete": { + "tags": [ + "Webhooks" + ], + "summary": "Deletes a webhook", + "description": "Deletes a webhook", + "operationId": "webhook_delete_webhook_delete", + "parameters": [ + { + "name": "webhook_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + } + ], + "responses": { + "default": { + "description": "An error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "204": { + "description": "Success" + } + }, + "security": [ + { + "Session Token": [] + } + ] + }, + "patch": { + "tags": [ + "Webhooks" + ], + "summary": "Edits a webhook", + "description": "Edits a webhook", + "operationId": "webhook_edit_webhook_edit", + "parameters": [ + { + "name": "webhook_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataEditWebhook" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "An error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Webhook" + } + } + } + } + }, + "security": [ + { + "Session Token": [] + } + ] + } + }, + "/webhooks/{webhook_id}/{token}/github": { + "post": { + "tags": [ + "Webhooks" + ], + "summary": "Executes a webhook specific to github", + "description": "Executes a webhook specific to github and sends a message containing the relevant info about the event", + "operationId": "webhook_execute_github_webhook_execute_github", + "parameters": [ + { + "name": "webhook_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + }, + { + "name": "token", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Github-Event", + "in": "header", + "description": "The name of the github event", + "required": true, + "content": { + "X-Github-Event": { + "schema": {} + } + } + } + ], + "requestBody": { + "content": { + "application/octet-stream": { + "schema": { + "type": "string" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "An error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "200": { + "description": "" + } + } + } } }, "components": { @@ -13194,6 +13613,69 @@ "type": "string" } } + }, + "DataEditWebhook": { + "description": "New webhook information", + "type": "object", + "properties": { + "name": { + "description": "Webhook name", + "type": "string", + "maxLength": 32, + "minLength": 1, + "nullable": true + }, + "avatar": { + "description": "Avatar ID", + "type": "string", + "maxLength": 128, + "minLength": 1, + "nullable": true + }, + "remove": { + "description": "Fields to remove from webhook", + "default": [], + "type": "array", + "items": { + "$ref": "#/components/schemas/FieldsWebhook" + } + } + } + }, + "FieldsWebhook": { + "description": "Optional fields on webhook object", + "type": "string", + "enum": [ + "Avatar" + ] + }, + "ResponseWebhook": { + "description": "Webhook information", + "type": "object", + "required": [ + "channel_id", + "id", + "name" + ], + "properties": { + "id": { + "description": "Webhook Id", + "type": "string" + }, + "name": { + "description": "Webhook name", + "type": "string" + }, + "avatar": { + "description": "Avatar ID", + "type": "string", + "nullable": true + }, + "channel_id": { + "description": "The channel this webhook belongs to", + "type": "string" + } + } } }, "securitySchemes": {