Skip to content

Commit

Permalink
Merge pull request #1149 from DEVTomatoCake/feat/webhooks-3
Browse files Browse the repository at this point in the history
Support webhooks
  • Loading branch information
Puyodead1 authored Aug 8, 2024
2 parents 289a02f + 4ca79ad commit 9d2f97a
Show file tree
Hide file tree
Showing 18 changed files with 9,263 additions and 1,202 deletions.
312 changes: 303 additions & 9 deletions assets/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2413,7 +2413,7 @@
"attachments": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Attachment_1"
"$ref": "#/components/schemas/Attachment"
}
},
"embeds": {
Expand Down Expand Up @@ -2510,6 +2510,12 @@
"poll": {
"$ref": "#/components/schemas/Poll"
},
"username": {
"type": "string"
},
"avatar": {
"type": "string"
},
"id": {
"type": "string"
}
Expand Down Expand Up @@ -2817,21 +2823,31 @@
"source_guild": {
"$ref": "#/components/schemas/Guild"
},
"source_channel_id": {
"type": "string"
},
"source_channel": {
"$ref": "#/components/schemas/Channel"
},
"url": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"application",
"application_id",
"avatar",
"channel",
"channel_id",
"guild",
"guild_id",
"id",
"source_guild",
"source_guild_id",
"name",
"source_channel",
"source_channel_id",
"type",
"url",
"user",
"user_id"
]
Expand Down Expand Up @@ -3167,7 +3183,7 @@
],
"type": "number"
},
"Attachment_1": {
"Attachment": {
"type": "object",
"properties": {
"filename": {
Expand Down Expand Up @@ -3686,7 +3702,7 @@
"attachments": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Attachment_1"
"$ref": "#/components/schemas/Attachment"
}
},
"embeds": {
Expand Down Expand Up @@ -6956,6 +6972,107 @@
"name"
]
},
"WebhookExecuteSchema": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"username": {
"type": "string"
},
"avatar_url": {
"type": "string"
},
"tts": {
"type": "boolean"
},
"embeds": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Embed"
}
},
"allowed_mentions": {
"type": "object",
"properties": {
"parse": {
"type": "array",
"items": {
"type": "string"
}
},
"roles": {
"type": "array",
"items": {
"type": "string"
}
},
"users": {
"type": "array",
"items": {
"type": "string"
}
},
"replied_user": {
"type": "boolean"
}
},
"additionalProperties": false
},
"components": {
"type": "array",
"items": {}
},
"file": {
"type": "object",
"properties": {
"filename": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"filename"
]
},
"payload_json": {
"type": "string"
},
"attachments": {
"description": "TODO: we should create an interface for attachments\nTODO: OpenWAAO<-->attachment-style metadata conversion",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"filename": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"filename",
"id"
]
}
},
"flags": {
"type": "integer"
},
"thread_name": {
"type": "string"
},
"applied_tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"WidgetModifySchema": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -8864,9 +8981,175 @@
},
{
"name": "voice"
},
{
"name": "webhooks"
}
],
"paths": {
"/webhooks/{webhook_id}/": {
"get": {
"security": [
{
"bearer": []
}
],
"description": "Returns a webhook object for the given id. Requires the MANAGE_WEBHOOKS permission or to be the owner of the webhook.",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/APIWebhook"
}
}
}
},
"404": {
"description": "No description available"
}
},
"parameters": [
{
"name": "webhook_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "webhook_id"
}
],
"tags": [
"webhooks"
]
}
},
"/webhooks/{webhook_id}/{token}/": {
"get": {
"security": [
{
"bearer": []
}
],
"description": "Returns a webhook object for the given id and token.",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/APIWebhook"
}
}
}
},
"404": {
"description": "No description available"
}
},
"parameters": [
{
"name": "webhook_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "webhook_id"
},
{
"name": "token",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "token"
}
],
"tags": [
"webhooks"
]
},
"post": {
"security": [
{
"bearer": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WebhookExecuteSchema"
}
}
}
},
"responses": {
"204": {
"description": "No description available"
},
"400": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/APIErrorResponse"
}
}
}
},
"404": {
"description": "No description available"
}
},
"parameters": [
{
"name": "webhook_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "webhook_id"
},
{
"name": "token",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "token"
},
{
"name": "wait",
"in": "query",
"required": false,
"schema": {
"type": "boolean"
},
"description": "waits for server confirmation of message send before response, and returns the created message body"
},
{
"name": "thread_id",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Send a message to the specified thread within a webhook's channel."
}
],
"tags": [
"webhooks"
]
}
},
"/voice/regions/": {
"get": {
"security": [
Expand Down Expand Up @@ -11739,14 +12022,23 @@
},
"/guilds/{guild_id}/webhooks/": {
"get": {
"x-permission-required": "MANAGE_WEBHOOKS",
"security": [
{
"bearer": []
}
],
"description": "Returns a list of guild webhook objects. Requires the MANAGE_WEBHOOKS permission.",
"responses": {
"default": {
"description": "No description available"
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/APIWebhookArray"
}
}
}
}
},
"parameters": [
Expand Down Expand Up @@ -15249,11 +15541,13 @@
},
"/channels/{channel_id}/webhooks/": {
"get": {
"x-permission-required": "MANAGE_WEBHOOKS",
"security": [
{
"bearer": []
}
],
"description": "Returns a list of channel webhook objects. Requires the MANAGE_WEBHOOKS permission.",
"responses": {
"200": {
"description": "",
Expand Down
Loading

0 comments on commit 9d2f97a

Please sign in to comment.