diff --git a/OpenAPI.json b/OpenAPI.json index 554bd86..61cdcc0 100644 --- a/OpenAPI.json +++ b/OpenAPI.json @@ -13,7 +13,7 @@ "name": "AGPLv3", "url": "https://github.com/revoltchat/delta/blob/master/LICENSE" }, - "version": "0.5.21" + "version": "0.6.0-rc.1" }, "servers": [ { @@ -2421,6 +2421,113 @@ ] } }, + "/channels/{target}/webhooks": { + "post": { + "tags": [ + "Webhooks" + ], + "summary": "Creates a webhook", + "description": "Creates a webhook which 3rd party platforms can use to send messages", + "operationId": "webhook_create_req", + "parameters": [ + { + "name": "target", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateWebhookBody" + } + } + }, + "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": [] + } + ] + } + }, + "/channels/{channel_id}/webhooks": { + "get": { + "tags": [ + "Webhooks" + ], + "summary": "Gets all webhooks", + "description": "Gets all webhooks inside the channel", + "operationId": "webhook_fetch_all_req", + "parameters": [ + { + "name": "channel_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": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Webhook" + } + } + } + } + } + }, + "security": [ + { + "Session Token": [] + } + ] + } + }, "/servers/create": { "post": { "tags": [ @@ -5532,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": { + "type": "string" + } + }, + { + "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": { + "type": "string" + } + }, + { + "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": { + "type": "string" + } + }, + { + "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": { + "type": "string" + } + }, + { + "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": { + "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/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": { + "type": "string" + } + } + ], + "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": { + "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" + } + } + } + } + }, + "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": { + "type": "string" + } + }, + { + "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": { @@ -7628,9 +8154,18 @@ "type": "string" }, "author": { - "description": "Id of the user that sent this message", + "description": "Id of the user or webhook that sent this message", "type": "string" }, + "webhook": { + "description": "The webhook that sent this message", + "allOf": [ + { + "$ref": "#/components/schemas/MessageWebhook" + } + ], + "nullable": true + }, "content": { "description": "Message content", "type": "string", @@ -7716,6 +8251,22 @@ } } }, + "MessageWebhook": { + "description": "Information about the webhook bundled with Message", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "avatar": { + "type": "string", + "nullable": true + } + } + }, "SystemMessage": { "description": "Representation of a system event message", "oneOf": [ @@ -9808,13 +10359,11 @@ }, "attachments": { "description": "Attachments to include in message", + "default": [], "type": "array", "items": { "type": "string" - }, - "maxItems": 128, - "minItems": 1, - "nullable": true + } }, "replies": { "description": "Messages to reply to", @@ -9826,13 +10375,13 @@ }, "embeds": { "description": "Embeds to include in message\n\nText embed content contributes to the content length cap", + "default": [], "type": "array", "items": { "$ref": "#/components/schemas/SendableEmbed" }, "maxItems": 10, - "minItems": 1, - "nullable": true + "minItems": 1 }, "masquerade": { "description": "Masquerade to apply to this message", @@ -9885,6 +10434,8 @@ }, "url": { "type": "string", + "maxLength": 256, + "minLength": 1, "nullable": true }, "title": { @@ -10146,6 +10697,62 @@ } ] }, + "Webhook": { + "description": "Webhook", + "type": "object", + "required": [ + "channel_id", + "id", + "name" + ], + "properties": { + "id": { + "description": "Webhook Id", + "type": "string" + }, + "name": { + "description": "The name of the webhook", + "type": "string" + }, + "avatar": { + "description": "The avatar of the webhook", + "allOf": [ + { + "$ref": "#/components/schemas/File" + } + ], + "nullable": true + }, + "channel_id": { + "description": "The channel this webhook belongs to", + "type": "string" + }, + "token": { + "description": "The private token for the webhook", + "type": "string", + "nullable": true + } + } + }, + "CreateWebhookBody": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "maxLength": 32, + "minLength": 1 + }, + "avatar": { + "type": "string", + "maxLength": 128, + "minLength": 1, + "nullable": true + } + } + }, "CreateServerResponse": { "title": "Create Server Response", "type": "object", @@ -11687,9 +12294,18 @@ "type": "string" }, "author": { - "description": "Id of the user that sent this message", + "description": "Id of the user or webhook that sent this message", "type": "string" }, + "webhook": { + "description": "The webhook that sent this message", + "allOf": [ + { + "$ref": "#/components/schemas/MessageWebhook" + } + ], + "nullable": true + }, "content": { "description": "Message content", "type": "string", @@ -12950,6 +13566,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": { @@ -13011,7 +13690,8 @@ "Messaging", "Interactions", "Groups", - "Voice" + "Voice", + "Webhooks" ] }, { diff --git a/package.json b/package.json index c7df273..f29c8b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "revolt-api", - "version": "0.5.21", + "version": "0.6.0-rc.1", "description": "Revolt API Library", "main": "dist/index.js", "module": "esm/index.js", diff --git a/src/params.ts b/src/params.ts index 8c0c367..2c80526 100644 --- a/src/params.ts +++ b/src/params.ts @@ -1,3 +1,3 @@ // This file was auto-generated by @insertish/oapi! -export const pathResolve = {"1":[[""]],"2":[["admin","stats"],["admin","messages"],["users","@me"],["users",["{target}"]],["users","dms"],["users","friend"],["bots","create"],["bots",["{bot}"]],["bots","@me"],["bots",["{target}"]],["channels",["{target}"]],["channels","create"],["servers","create"],["servers",["{target}"]],["invites",["{target}"]],["safety","reports"],["safety","report"],["safety","strikes"],["onboard","hello"],["onboard","complete"],["push","subscribe"],["push","unsubscribe"],["sync","unreads"]],"3":[["users",["{target}"],"flags"],["users","@me","username"],["users",["{target}"],"default_avatar"],["users",["{target}"],"profile"],["users",["{target}"],"dm"],["users",["{target}"],"mutual"],["users",["{target}"],"friend"],["users",["{target}"],"block"],["bots",["{target}"],"invite"],["channels",["{target}"],"members"],["channels",["{target}"],"invites"],["channels",["{target}"],"messages"],["channels",["{target}"],"search"],["channels",["{target}"],"join_call"],["servers",["{target}"],"ack"],["servers",["{target}"],"channels"],["servers",["{target}"],"members"],["servers",["{target}"],"members_experimental_query"],["servers",["{target}"],"bans"],["servers",["{target}"],"invites"],["servers",["{target}"],"roles"],["servers",["{target}"],"emojis"],["custom","emoji",["{id}"]],["safety","reports",["{report}"]],["safety","report",["{id}"]],["safety","snapshot",["{report_id}"]],["safety","strikes",["{user_id}"]],["safety","strikes",["{strike_id}"]],["auth","account","create"],["auth","account","reverify"],["auth","account","delete"],["auth","account",""],["auth","account","disable"],["auth","account","reset_password"],["auth","session","login"],["auth","session","logout"],["auth","session","all"],["auth","session",["{id}"]],["auth","mfa","ticket"],["auth","mfa",""],["auth","mfa","recovery"],["auth","mfa","methods"],["auth","mfa","totp"],["sync","settings","fetch"],["sync","settings","set"]],"4":[["channels",["{target}"],"ack",["{message}"]],["channels",["{_target}"],"messages","stale"],["channels",["{target}"],"messages",["{msg}"]],["channels",["{target}"],"messages","bulk"],["channels",["{target}"],"recipients",["{member}"]],["channels",["{target}"],"permissions",["{role_id}"]],["channels",["{target}"],"permissions","default"],["servers",["{target}"],"members",["{member}"]],["servers",["{server}"],"members",["{target}"]],["servers",["{server}"],"bans",["{target}"]],["servers",["{target}"],"roles",["{role_id}"]],["servers",["{target}"],"permissions",["{role_id}"]],["servers",["{target}"],"permissions","default"],["auth","account","change","password"],["auth","account","change","email"],["auth","account","verify",["{code}"]]],"5":[["channels",["{target}"],"messages",["{msg}"],"reactions"]],"6":[["channels",["{target}"],"messages",["{msg}"],"reactions",["{emoji}"]]]}; -export const queryParams = {"/":{"get":[]},"/admin/stats":{"get":[]},"/admin/messages":{"post":[]},"/users/@me":{"get":[]},"/users/{target}":{"get":[],"patch":[]},"/users/{target}/flags":{"get":[]},"/users/@me/username":{"patch":[]},"/users/{target}/default_avatar":{"get":[]},"/users/{target}/profile":{"get":[]},"/users/dms":{"get":[]},"/users/{target}/dm":{"get":[]},"/users/{target}/mutual":{"get":[]},"/users/{target}/friend":{"put":[],"delete":[]},"/users/{target}/block":{"put":[],"delete":[]},"/users/friend":{"post":[]},"/bots/create":{"post":[]},"/bots/{target}/invite":{"get":[],"post":[]},"/bots/{bot}":{"get":[]},"/bots/@me":{"get":[]},"/bots/{target}":{"delete":[],"patch":[]},"/channels/{target}/ack/{message}":{"put":[]},"/channels/{target}":{"get":[],"delete":["leave_silently"],"patch":[]},"/channels/{target}/members":{"get":[]},"/channels/{target}/invites":{"post":[]},"/channels/{target}/messages":{"get":["limit","before","after","sort","nearby","include_users"],"post":[]},"/channels/{target}/search":{"post":[]},"/channels/{_target}/messages/stale":{"post":[]},"/channels/{target}/messages/{msg}":{"get":[],"delete":[],"patch":[]},"/channels/{target}/messages/bulk":{"delete":[]},"/channels/create":{"post":[]},"/channels/{target}/recipients/{member}":{"put":[],"delete":[]},"/channels/{target}/join_call":{"post":[]},"/channels/{target}/permissions/{role_id}":{"put":[]},"/channels/{target}/permissions/default":{"put":[]},"/channels/{target}/messages/{msg}/reactions/{emoji}":{"put":[],"delete":["user_id","remove_all"]},"/channels/{target}/messages/{msg}/reactions":{"delete":[]},"/servers/create":{"post":[]},"/servers/{target}":{"get":["include_channels"],"delete":["leave_silently"],"patch":[]},"/servers/{target}/ack":{"put":[]},"/servers/{target}/channels":{"post":[]},"/servers/{target}/members":{"get":["exclude_offline"]},"/servers/{target}/members/{member}":{"get":[],"delete":[]},"/servers/{server}/members/{target}":{"patch":[]},"/servers/{target}/members_experimental_query":{"get":["query","experimental_api"]},"/servers/{server}/bans/{target}":{"put":[],"delete":[]},"/servers/{target}/bans":{"get":[]},"/servers/{target}/invites":{"get":[]},"/servers/{target}/roles":{"post":[]},"/servers/{target}/roles/{role_id}":{"delete":[],"patch":[]},"/servers/{target}/permissions/{role_id}":{"put":[]},"/servers/{target}/permissions/default":{"put":[]},"/servers/{target}/emojis":{"get":[]},"/invites/{target}":{"get":[],"post":[],"delete":[]},"/custom/emoji/{id}":{"get":[],"put":[],"delete":[]},"/safety/reports/{report}":{"patch":[]},"/safety/report/{id}":{"get":[]},"/safety/reports":{"get":["content_id","author_id","status"]},"/safety/report":{"post":[]},"/safety/snapshot/{report_id}":{"get":[]},"/safety/strikes":{"post":[]},"/safety/strikes/{user_id}":{"get":[]},"/safety/strikes/{strike_id}":{"post":[],"delete":[]},"/auth/account/create":{"post":[]},"/auth/account/reverify":{"post":[]},"/auth/account/delete":{"put":[],"post":[]},"/auth/account/":{"get":[]},"/auth/account/disable":{"post":[]},"/auth/account/change/password":{"patch":[]},"/auth/account/change/email":{"patch":[]},"/auth/account/verify/{code}":{"post":[]},"/auth/account/reset_password":{"post":[],"patch":[]},"/auth/session/login":{"post":[]},"/auth/session/logout":{"post":[]},"/auth/session/all":{"get":[],"delete":["revoke_self"]},"/auth/session/{id}":{"delete":[],"patch":[]},"/auth/mfa/ticket":{"put":[]},"/auth/mfa/":{"get":[]},"/auth/mfa/recovery":{"post":[],"patch":[]},"/auth/mfa/methods":{"get":[]},"/auth/mfa/totp":{"put":[],"post":[],"delete":[]},"/onboard/hello":{"get":[]},"/onboard/complete":{"post":[]},"/push/subscribe":{"post":[]},"/push/unsubscribe":{"post":[]},"/sync/settings/fetch":{"post":[]},"/sync/settings/set":{"post":["timestamp"]},"/sync/unreads":{"get":[]}}; \ No newline at end of file +export const pathResolve = {"1":[[""]],"2":[["admin","stats"],["admin","messages"],["users","@me"],["users",["{target}"]],["users","dms"],["users","friend"],["bots","create"],["bots",["{bot}"]],["bots","@me"],["bots",["{target}"]],["channels",["{target}"]],["channels","create"],["servers","create"],["servers",["{target}"]],["invites",["{target}"]],["safety","reports"],["safety","report"],["safety","strikes"],["onboard","hello"],["onboard","complete"],["push","subscribe"],["push","unsubscribe"],["sync","unreads"],["webhooks",["{webhook_id}"]]],"3":[["users",["{target}"],"flags"],["users","@me","username"],["users",["{target}"],"default_avatar"],["users",["{target}"],"profile"],["users",["{target}"],"dm"],["users",["{target}"],"mutual"],["users",["{target}"],"friend"],["users",["{target}"],"block"],["bots",["{target}"],"invite"],["channels",["{target}"],"members"],["channels",["{target}"],"invites"],["channels",["{target}"],"messages"],["channels",["{target}"],"search"],["channels",["{target}"],"join_call"],["channels",["{target}"],"webhooks"],["channels",["{channel_id}"],"webhooks"],["servers",["{target}"],"ack"],["servers",["{target}"],"channels"],["servers",["{target}"],"members"],["servers",["{target}"],"members_experimental_query"],["servers",["{target}"],"bans"],["servers",["{target}"],"invites"],["servers",["{target}"],"roles"],["servers",["{target}"],"emojis"],["custom","emoji",["{id}"]],["safety","reports",["{report}"]],["safety","report",["{id}"]],["safety","snapshot",["{report_id}"]],["safety","strikes",["{user_id}"]],["safety","strikes",["{strike_id}"]],["auth","account","create"],["auth","account","reverify"],["auth","account","delete"],["auth","account",""],["auth","account","disable"],["auth","account","reset_password"],["auth","session","login"],["auth","session","logout"],["auth","session","all"],["auth","session",["{id}"]],["auth","mfa","ticket"],["auth","mfa",""],["auth","mfa","recovery"],["auth","mfa","methods"],["auth","mfa","totp"],["sync","settings","fetch"],["sync","settings","set"],["webhooks",["{webhook_id}"],["{token}"]]],"4":[["channels",["{target}"],"ack",["{message}"]],["channels",["{_target}"],"messages","stale"],["channels",["{target}"],"messages",["{msg}"]],["channels",["{target}"],"messages","bulk"],["channels",["{target}"],"recipients",["{member}"]],["channels",["{target}"],"permissions",["{role_id}"]],["channels",["{target}"],"permissions","default"],["servers",["{target}"],"members",["{member}"]],["servers",["{server}"],"members",["{target}"]],["servers",["{server}"],"bans",["{target}"]],["servers",["{target}"],"roles",["{role_id}"]],["servers",["{target}"],"permissions",["{role_id}"]],["servers",["{target}"],"permissions","default"],["auth","account","change","password"],["auth","account","change","email"],["auth","account","verify",["{code}"]],["webhooks",["{webhook_id}"],["{token}"],"github"]],"5":[["channels",["{target}"],"messages",["{msg}"],"reactions"]],"6":[["channels",["{target}"],"messages",["{msg}"],"reactions",["{emoji}"]]]}; +export const queryParams = {"/":{"get":[]},"/admin/stats":{"get":[]},"/admin/messages":{"post":[]},"/users/@me":{"get":[]},"/users/{target}":{"get":[],"patch":[]},"/users/{target}/flags":{"get":[]},"/users/@me/username":{"patch":[]},"/users/{target}/default_avatar":{"get":[]},"/users/{target}/profile":{"get":[]},"/users/dms":{"get":[]},"/users/{target}/dm":{"get":[]},"/users/{target}/mutual":{"get":[]},"/users/{target}/friend":{"put":[],"delete":[]},"/users/{target}/block":{"put":[],"delete":[]},"/users/friend":{"post":[]},"/bots/create":{"post":[]},"/bots/{target}/invite":{"get":[],"post":[]},"/bots/{bot}":{"get":[]},"/bots/@me":{"get":[]},"/bots/{target}":{"delete":[],"patch":[]},"/channels/{target}/ack/{message}":{"put":[]},"/channels/{target}":{"get":[],"delete":["leave_silently"],"patch":[]},"/channels/{target}/members":{"get":[]},"/channels/{target}/invites":{"post":[]},"/channels/{target}/messages":{"get":["limit","before","after","sort","nearby","include_users"],"post":[]},"/channels/{target}/search":{"post":[]},"/channels/{_target}/messages/stale":{"post":[]},"/channels/{target}/messages/{msg}":{"get":[],"delete":[],"patch":[]},"/channels/{target}/messages/bulk":{"delete":[]},"/channels/create":{"post":[]},"/channels/{target}/recipients/{member}":{"put":[],"delete":[]},"/channels/{target}/join_call":{"post":[]},"/channels/{target}/permissions/{role_id}":{"put":[]},"/channels/{target}/permissions/default":{"put":[]},"/channels/{target}/messages/{msg}/reactions/{emoji}":{"put":[],"delete":["user_id","remove_all"]},"/channels/{target}/messages/{msg}/reactions":{"delete":[]},"/channels/{target}/webhooks":{"post":[]},"/channels/{channel_id}/webhooks":{"get":[]},"/servers/create":{"post":[]},"/servers/{target}":{"get":["include_channels"],"delete":["leave_silently"],"patch":[]},"/servers/{target}/ack":{"put":[]},"/servers/{target}/channels":{"post":[]},"/servers/{target}/members":{"get":["exclude_offline"]},"/servers/{target}/members/{member}":{"get":[],"delete":[]},"/servers/{server}/members/{target}":{"patch":[]},"/servers/{target}/members_experimental_query":{"get":["query","experimental_api"]},"/servers/{server}/bans/{target}":{"put":[],"delete":[]},"/servers/{target}/bans":{"get":[]},"/servers/{target}/invites":{"get":[]},"/servers/{target}/roles":{"post":[]},"/servers/{target}/roles/{role_id}":{"delete":[],"patch":[]},"/servers/{target}/permissions/{role_id}":{"put":[]},"/servers/{target}/permissions/default":{"put":[]},"/servers/{target}/emojis":{"get":[]},"/invites/{target}":{"get":[],"post":[],"delete":[]},"/custom/emoji/{id}":{"get":[],"put":[],"delete":[]},"/safety/reports/{report}":{"patch":[]},"/safety/report/{id}":{"get":[]},"/safety/reports":{"get":["content_id","author_id","status"]},"/safety/report":{"post":[]},"/safety/snapshot/{report_id}":{"get":[]},"/safety/strikes":{"post":[]},"/safety/strikes/{user_id}":{"get":[]},"/safety/strikes/{strike_id}":{"post":[],"delete":[]},"/auth/account/create":{"post":[]},"/auth/account/reverify":{"post":[]},"/auth/account/delete":{"put":[],"post":[]},"/auth/account/":{"get":[]},"/auth/account/disable":{"post":[]},"/auth/account/change/password":{"patch":[]},"/auth/account/change/email":{"patch":[]},"/auth/account/verify/{code}":{"post":[]},"/auth/account/reset_password":{"post":[],"patch":[]},"/auth/session/login":{"post":[]},"/auth/session/logout":{"post":[]},"/auth/session/all":{"get":[],"delete":["revoke_self"]},"/auth/session/{id}":{"delete":[],"patch":[]},"/auth/mfa/ticket":{"put":[]},"/auth/mfa/":{"get":[]},"/auth/mfa/recovery":{"post":[],"patch":[]},"/auth/mfa/methods":{"get":[]},"/auth/mfa/totp":{"put":[],"post":[],"delete":[]},"/onboard/hello":{"get":[]},"/onboard/complete":{"post":[]},"/push/subscribe":{"post":[]},"/push/unsubscribe":{"post":[]},"/sync/settings/fetch":{"post":[]},"/sync/settings/set":{"post":["timestamp"]},"/sync/unreads":{"get":[]},"/webhooks/{webhook_id}/{token}":{"get":[],"post":[],"delete":[],"patch":[]},"/webhooks/{webhook_id}":{"get":[],"delete":[],"patch":[]},"/webhooks/{webhook_id}/{token}/github":{"post":[]}}; \ No newline at end of file diff --git a/src/routes.ts b/src/routes.ts index b077f13..121b49c 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -87,6 +87,10 @@ export type APIRoutes = | { method: 'delete', path: '-/channels/{target}/messages/{msg}/reactions/{emoji}', parts: 6, params: paths['/channels/{target}/messages/{msg}/reactions/{emoji}']['delete']['parameters']['query'], response: undefined } | { method: 'delete', path: `/channels/${string}/messages/${string}/reactions`, parts: 5, params: undefined, response: undefined } | { method: 'delete', path: '-/channels/{target}/messages/{msg}/reactions', parts: 5, params: undefined, response: undefined } +| { method: 'post', path: `/channels/${string}/webhooks`, parts: 3, params: paths['/channels/{target}/webhooks']['post']['requestBody']['content']['application/json'], response: paths['/channels/{target}/webhooks']['post']['responses']['200']['content']['application/json'] } +| { method: 'post', path: '-/channels/{target}/webhooks', parts: 3, params: paths['/channels/{target}/webhooks']['post']['requestBody']['content']['application/json'], response: paths['/channels/{target}/webhooks']['post']['responses']['200']['content']['application/json'] } +| { method: 'get', path: `/channels/${string}/webhooks`, parts: 3, params: undefined, response: paths['/channels/{channel_id}/webhooks']['get']['responses']['200']['content']['application/json'] } +| { method: 'get', path: '-/channels/{channel_id}/webhooks', parts: 3, params: undefined, response: paths['/channels/{channel_id}/webhooks']['get']['responses']['200']['content']['application/json'] } | { method: 'post', path: `/servers/create`, parts: 2, params: paths['/servers/create']['post']['requestBody']['content']['application/json'], response: paths['/servers/create']['post']['responses']['200']['content']['application/json'] } | { method: 'get', path: `/servers/${string}`, parts: 2, params: paths['/servers/{target}']['get']['parameters']['query'], response: paths['/servers/{target}']['get']['responses']['200']['content']['application/json'] } | { method: 'get', path: '-/servers/{target}', parts: 2, params: paths['/servers/{target}']['get']['parameters']['query'], response: paths['/servers/{target}']['get']['responses']['200']['content']['application/json'] } @@ -189,4 +193,20 @@ export type APIRoutes = | { method: 'post', path: `/push/unsubscribe`, parts: 2, params: undefined, response: undefined } | { method: 'post', path: `/sync/settings/fetch`, parts: 3, params: paths['/sync/settings/fetch']['post']['requestBody']['content']['application/json'], response: paths['/sync/settings/fetch']['post']['responses']['200']['content']['application/json'] } | { method: 'post', path: `/sync/settings/set`, parts: 3, params: paths['/sync/settings/set']['post']['parameters']['query']|paths['/sync/settings/set']['post']['requestBody']['content']['application/json'], response: undefined } -| { method: 'get', path: `/sync/unreads`, parts: 2, params: undefined, response: paths['/sync/unreads']['get']['responses']['200']['content']['application/json'] }; \ No newline at end of file +| { method: 'get', path: `/sync/unreads`, parts: 2, params: undefined, response: paths['/sync/unreads']['get']['responses']['200']['content']['application/json'] } +| { method: 'get', path: `/webhooks/${string}/${string}`, parts: 3, params: undefined, response: paths['/webhooks/{webhook_id}/{token}']['get']['responses']['200']['content']['application/json'] } +| { method: 'get', path: '-/webhooks/{webhook_id}/{token}', parts: 3, params: undefined, response: paths['/webhooks/{webhook_id}/{token}']['get']['responses']['200']['content']['application/json'] } +| { method: 'post', path: `/webhooks/${string}/${string}`, parts: 3, params: paths['/webhooks/{webhook_id}/{token}']['post']['requestBody']['content']['application/json'], response: paths['/webhooks/{webhook_id}/{token}']['post']['responses']['200']['content']['application/json'] } +| { method: 'post', path: '-/webhooks/{webhook_id}/{token}', parts: 3, params: paths['/webhooks/{webhook_id}/{token}']['post']['requestBody']['content']['application/json'], response: paths['/webhooks/{webhook_id}/{token}']['post']['responses']['200']['content']['application/json'] } +| { method: 'delete', path: `/webhooks/${string}/${string}`, parts: 3, params: undefined, response: undefined } +| { method: 'delete', path: '-/webhooks/{webhook_id}/{token}', parts: 3, params: undefined, response: undefined } +| { method: 'patch', path: `/webhooks/${string}/${string}`, parts: 3, params: paths['/webhooks/{webhook_id}/{token}']['patch']['requestBody']['content']['application/json'], response: paths['/webhooks/{webhook_id}/{token}']['patch']['responses']['200']['content']['application/json'] } +| { method: 'patch', path: '-/webhooks/{webhook_id}/{token}', parts: 3, params: paths['/webhooks/{webhook_id}/{token}']['patch']['requestBody']['content']['application/json'], response: paths['/webhooks/{webhook_id}/{token}']['patch']['responses']['200']['content']['application/json'] } +| { method: 'get', path: `/webhooks/${string}`, parts: 2, params: undefined, response: paths['/webhooks/{webhook_id}']['get']['responses']['200']['content']['application/json'] } +| { method: 'get', path: '-/webhooks/{webhook_id}', parts: 2, params: undefined, response: paths['/webhooks/{webhook_id}']['get']['responses']['200']['content']['application/json'] } +| { method: 'delete', path: `/webhooks/${string}`, parts: 2, params: undefined, response: undefined } +| { method: 'delete', path: '-/webhooks/{webhook_id}', parts: 2, params: undefined, response: undefined } +| { method: 'patch', path: `/webhooks/${string}`, parts: 2, params: paths['/webhooks/{webhook_id}']['patch']['requestBody']['content']['application/json'], response: paths['/webhooks/{webhook_id}']['patch']['responses']['200']['content']['application/json'] } +| { method: 'patch', path: '-/webhooks/{webhook_id}', parts: 2, params: paths['/webhooks/{webhook_id}']['patch']['requestBody']['content']['application/json'], response: paths['/webhooks/{webhook_id}']['patch']['responses']['200']['content']['application/json'] } +| { method: 'post', path: `/webhooks/${string}/${string}/github`, parts: 4, params: undefined, response: undefined } +| { method: 'post', path: '-/webhooks/{webhook_id}/{token}/github', parts: 4, params: undefined, response: undefined }; \ No newline at end of file diff --git a/src/schema.ts b/src/schema.ts index 6c58034..eb6f9cb 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -212,6 +212,14 @@ export interface paths { */ delete: operations["message_clear_reactions_clear_reactions"]; }; + "/channels/{target}/webhooks": { + /** Creates a webhook which 3rd party platforms can use to send messages */ + post: operations["webhook_create_req"]; + }; + "/channels/{channel_id}/webhooks": { + /** Gets all webhooks inside the channel */ + get: operations["webhook_fetch_all_req"]; + }; "/servers/create": { /** Create a new server. */ post: operations["server_create_req"]; @@ -458,6 +466,28 @@ export interface paths { /** Fetch information about unread state on channels. */ get: operations["get_unreads_req"]; }; + "/webhooks/{webhook_id}/{token}": { + /** Gets a webhook with a token */ + get: operations["webhook_fetch_token_webhook_fetch_token"]; + /** Executes a webhook and sends a message */ + post: operations["webhook_execute_webhook_execute"]; + /** Deletes a webhook with a token */ + delete: operations["webhook_delete_token_webhook_delete_token"]; + /** Edits a webhook with a token */ + patch: operations["webhook_edit_token_webhook_edit_token"]; + }; + "/webhooks/{webhook_id}": { + /** Gets a webhook */ + get: operations["webhook_fetch_webhook_fetch"]; + /** Deletes a webhook */ + delete: operations["webhook_delete_webhook_delete"]; + /** Edits a webhook */ + patch: operations["webhook_edit_webhook_edit"]; + }; + "/webhooks/{webhook_id}/{token}/github": { + /** Executes a webhook specific to github and sends a message containing the relevant info about the event */ + post: operations["webhook_execute_github_webhook_execute_github"]; + }; } export interface components { @@ -1142,8 +1172,10 @@ export interface components { nonce?: string | null; /** @description Id of the channel this message was sent in */ channel: string; - /** @description Id of the user that sent this message */ + /** @description Id of the user or webhook that sent this message */ author: string; + /** @description The webhook that sent this message */ + webhook?: components["schemas"]["MessageWebhook"] | null; /** @description Message content */ content?: string | null; /** @description System message */ @@ -1165,6 +1197,11 @@ export interface components { /** @description Name and / or avatar overrides for this message */ masquerade?: components["schemas"]["Masquerade"] | null; }; + /** @description Information about the webhook bundled with Message */ + MessageWebhook: { + name: string; + avatar?: string | null; + }; /** @description Representation of a system event message */ SystemMessage: | { @@ -1954,16 +1991,20 @@ export interface components { nonce?: string | null; /** @description Message content to send */ content?: string | null; - /** @description Attachments to include in message */ - attachments?: string[] | null; + /** + * @description Attachments to include in message + * @default + */ + attachments?: string[]; /** @description Messages to reply to */ replies?: components["schemas"]["Reply"][] | null; /** * @description Embeds to include in message * * Text embed content contributes to the content length cap + * @default */ - embeds?: components["schemas"]["SendableEmbed"][] | null; + embeds?: components["schemas"]["SendableEmbed"][]; /** @description Masquerade to apply to this message */ masquerade?: components["schemas"]["Masquerade"] | null; /** @description Information about how this message should be interacted with */ @@ -2083,6 +2124,23 @@ export interface components { /** @description Allow / deny values to set for members in this `TextChannel` or `VoiceChannel` */ permissions: components["schemas"]["Override"]; }; + /** @description Webhook */ + Webhook: { + /** @description Webhook Id */ + id: string; + /** @description The name of the webhook */ + name: string; + /** @description The avatar of the webhook */ + avatar?: components["schemas"]["File"] | null; + /** @description The channel this webhook belongs to */ + channel_id: string; + /** @description The private token for the webhook */ + token?: string | null; + }; + CreateWebhookBody: { + name: string; + avatar?: string | null; + }; /** Create Server Response */ CreateServerResponse: { /** @description Server object */ @@ -2657,8 +2715,10 @@ export interface components { nonce?: string | null; /** @description Id of the channel this message was sent in */ channel: string; - /** @description Id of the user that sent this message */ + /** @description Id of the user or webhook that sent this message */ author: string; + /** @description The webhook that sent this message */ + webhook?: components["schemas"]["MessageWebhook"] | null; /** @description Message content */ content?: string | null; /** @description System message */ @@ -3074,6 +3134,34 @@ export interface components { /** @description User Id */ user: string; }; + /** @description New webhook information */ + DataEditWebhook: { + /** @description Webhook name */ + name?: string | null; + /** @description Avatar ID */ + avatar?: string | null; + /** + * @description Fields to remove from webhook + * @default + */ + remove?: components["schemas"]["FieldsWebhook"][]; + }; + /** + * @description Optional fields on webhook object + * @enum {string} + */ + FieldsWebhook: "Avatar"; + /** @description Webhook information */ + ResponseWebhook: { + /** @description Webhook Id */ + id: string; + /** @description Webhook name */ + name: string; + /** @description Avatar ID */ + avatar?: string | null; + /** @description The channel this webhook belongs to */ + channel_id: string; + }; }; } @@ -4154,6 +4242,53 @@ export interface operations { }; }; }; + /** Creates a webhook which 3rd party platforms can use to send messages */ + webhook_create_req: { + parameters: { + path: { + target: components["schemas"]["Id"]; + }; + }; + responses: { + 200: { + content: { + "application/json": components["schemas"]["Webhook"]; + }; + }; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateWebhookBody"]; + }; + }; + }; + /** Gets all webhooks inside the channel */ + webhook_fetch_all_req: { + parameters: { + path: { + channel_id: components["schemas"]["Id"]; + }; + }; + responses: { + 200: { + content: { + "application/json": components["schemas"]["Webhook"][]; + }; + }; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + }; /** Create a new server. */ server_create_req: { responses: { @@ -5469,6 +5604,197 @@ export interface operations { }; }; }; + /** Gets a webhook with a token */ + webhook_fetch_token_webhook_fetch_token: { + parameters: { + path: { + webhook_id: string; + token: string; + }; + }; + responses: { + 200: { + content: { + "application/json": components["schemas"]["Webhook"]; + }; + }; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + }; + /** Executes a webhook and sends a message */ + webhook_execute_webhook_execute: { + parameters: { + path: { + webhook_id: string; + token: string; + }; + header: { + /** Unique key to prevent duplicate requests */ + "Idempotency-Key"?: string; + }; + }; + responses: { + 200: { + content: { + "application/json": components["schemas"]["Message"]; + }; + }; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + requestBody: { + content: { + "application/json": components["schemas"]["DataMessageSend"]; + }; + }; + }; + /** Deletes a webhook with a token */ + webhook_delete_token_webhook_delete_token: { + parameters: { + path: { + webhook_id: string; + token: string; + }; + }; + responses: { + /** Success */ + 204: never; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + }; + /** Edits a webhook with a token */ + webhook_edit_token_webhook_edit_token: { + parameters: { + path: { + webhook_id: string; + token: string; + }; + }; + responses: { + 200: { + content: { + "application/json": components["schemas"]["Webhook"]; + }; + }; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + requestBody: { + content: { + "application/json": components["schemas"]["DataEditWebhook"]; + }; + }; + }; + /** Gets a webhook */ + webhook_fetch_webhook_fetch: { + parameters: { + path: { + webhook_id: string; + }; + }; + responses: { + 200: { + content: { + "application/json": components["schemas"]["ResponseWebhook"]; + }; + }; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + }; + /** Deletes a webhook */ + webhook_delete_webhook_delete: { + parameters: { + path: { + webhook_id: string; + }; + }; + responses: { + /** Success */ + 204: never; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + }; + /** Edits a webhook */ + webhook_edit_webhook_edit: { + parameters: { + path: { + webhook_id: string; + }; + }; + responses: { + 200: { + content: { + "application/json": components["schemas"]["Webhook"]; + }; + }; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + requestBody: { + content: { + "application/json": components["schemas"]["DataEditWebhook"]; + }; + }; + }; + /** Executes a webhook specific to github and sends a message containing the relevant info about the event */ + webhook_execute_github_webhook_execute_github: { + parameters: { + path: { + webhook_id: string; + token: string; + }; + header: { + /** The name of the github event */ + "X-Github-Event": unknown; + }; + }; + responses: { + 200: unknown; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + requestBody: { + content: { + "application/octet-stream": string; + }; + }; + }; } export interface external {} diff --git a/src/types.ts b/src/types.ts index be5ad43..6e3d0f8 100644 --- a/src/types.ts +++ b/src/types.ts @@ -20,6 +20,7 @@ export type QueryExecStats = components['schemas']['QueryExecStats']; export type CollectionScans = components['schemas']['CollectionScans']; export type BulkMessageResponse = components['schemas']['BulkMessageResponse']; export type Message = components['schemas']['Message']; +export type MessageWebhook = components['schemas']['MessageWebhook']; export type SystemMessage = components['schemas']['SystemMessage']; export type File = components['schemas']['File']; export type Metadata = components['schemas']['Metadata']; @@ -77,6 +78,8 @@ export type CreateVoiceUserResponse = components['schemas']['CreateVoiceUserResp export type Data = components['schemas']['Data']; export type Override = components['schemas']['Override']; export type DataDefaultChannelPermissions = components['schemas']['DataDefaultChannelPermissions']; +export type Webhook = components['schemas']['Webhook']; +export type CreateWebhookBody = components['schemas']['CreateWebhookBody']; export type CreateServerResponse = components['schemas']['CreateServerResponse']; export type Server = components['schemas']['Server']; export type Category = components['schemas']['Category']; @@ -144,4 +147,7 @@ export type DataHello = components['schemas']['DataHello']; export type DataOnboard = components['schemas']['DataOnboard']; export type OptionsFetchSettings = components['schemas']['OptionsFetchSettings']; export type ChannelUnread = components['schemas']['ChannelUnread']; -export type ChannelCompositeKey = components['schemas']['ChannelCompositeKey'];; \ No newline at end of file +export type ChannelCompositeKey = components['schemas']['ChannelCompositeKey']; +export type DataEditWebhook = components['schemas']['DataEditWebhook']; +export type FieldsWebhook = components['schemas']['FieldsWebhook']; +export type ResponseWebhook = components['schemas']['ResponseWebhook'];; \ No newline at end of file