From a4cd54d579d2ccc94d3390a38fe1771f75716e2f Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 11 Jul 2021 18:45:09 +0100 Subject: [PATCH] Finish server routes. --- OpenAPI.json | 7261 +++++------------------------------- README.md | 17 + src/index.ts | 4 +- src/openapi/definitions.ts | 10 +- src/openapi/paths.ts | 4 +- src/routes/channels.ts | 11 +- src/routes/index.ts | 1 + src/routes/servers.ts | 407 ++ tsconfig.tsbuildinfo | 2 +- types/Invites.ts | 16 + types/Servers.ts | 95 +- types/__temp.ts | 26 +- 12 files changed, 1514 insertions(+), 6340 deletions(-) create mode 100644 README.md create mode 100644 src/routes/servers.ts diff --git a/OpenAPI.json b/OpenAPI.json index 73d176f..04547de 100644 --- a/OpenAPI.json +++ b/OpenAPI.json @@ -18,182 +18,42 @@ }, "tags": [ { - "name": "Core", - "description": "Use in your applications to determine information about the Revolt node." + "name": "Server Information", + "description": "Query and fetch servers on Revolt" }, { - "name": "Onboarding", - "description": "After signing up to Revolt, users must pick a unique username." + "name": "Server Members", + "description": "Find and edit server members" }, { - "name": "User Information", - "description": "Query and fetch users on Revolt" - }, - { - "name": "Direct Messaging", - "description": "Direct message other users on Revolt" - }, - { - "name": "Relationships", - "description": "Manage your friendships and block list on the platform" - }, - { - "name": "Channel Information", - "description": "Query and fetch channels on Revolt" - }, - { - "name": "Channel Invites", - "description": "Create and manage invites for channels" - }, - { - "name": "Channel Permissions", - "description": "Manage permissions for channels" - }, - { - "name": "Messaging", - "description": "Send and manipulate messages" - }, - { - "name": "Groups", - "description": "Create, invite users and manipulate groups" - }, - { - "name": "Voice", - "description": "Join and talk with other users" + "name": "Server Permissions", + "description": "Manage permissions for servers" } ], "x-tagGroups": [ { - "name": "Chat Platform", + "name": "Servers", "tags": [ - "Core", - "Onboarding" - ] - }, - { - "name": "Users", - "tags": [ - "User Information", - "Direct Messaging", - "Relationships" - ] - }, - { - "name": "Channels", - "tags": [ - "Channel Information", - "Channel Invites", - "Channel Permissions", - "Messaging", - "Groups", - "Voice" + "Server Information", + "Server Members", + "Server Permissions" ] } ], "paths": { - "/": { + "/servers/:server": { "get": { - "summary": "Query Node", - "description": "This returns information about which features are enabled on the remote node.", + "summary": "Fetch Server", + "description": "Retrieve a server.", "tags": [ - "Core" - ], - "responses": { - "200": { - "description": "Server node information.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/RevoltConfiguration" - } - } - } - } - } - } - }, - "/onboard/hello": { - "get": { - "summary": "Check Onboarding Status", - "description": "This will tell you whether the current account requires onboarding or whether you can continue to send requests as usual. You may skip calling this if you're restoring an existing session.", - "tags": [ - "Onboarding" - ], - "responses": { - "200": { - "description": "Onboarding information.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/OnboardingInformation" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/onboard/complete": { - "post": { - "summary": "Complete Onboarding", - "description": "This sets a new username, completes onboarding and allows a user to start using Revolt.", - "tags": [ - "Onboarding" - ], - "requestBody": { - "description": "Data about wanted user information.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "username": { - "description": "An alphanumeric username which is used to identify the user on the platform.", - "minLength": 2, - "maxLength": 32, - "pattern": "^[a-zA-Z0-9-_]+$", - "type": "string" - } - }, - "required": [ - "username" - ] - } - } - } - }, - "responses": { - "200": { - "description": "Successfully set username" - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/users/:user": { - "get": { - "summary": "Fetch User", - "description": "Retrieve a user's information.", - "tags": [ - "User Information" + "Server Information" ], "parameters": [ { - "name": "user", + "name": "server", "in": "path", "required": true, - "description": "User ID", + "description": "Server ID", "schema": { "$ref": "#/definitions/Id" } @@ -201,11 +61,11 @@ ], "responses": { "200": { - "description": "User information.", + "description": "Retrieved server.", "content": { "application/json": { "schema": { - "$ref": "#/definitions/User" + "$ref": "#/definitions/Server" } } } @@ -213,57 +73,403 @@ }, "security": [ { - "userId": [], - "sessionToken": [] + "User ID": [], + "Session Token": [] } ] - } - }, - "/users/@me": { + }, "patch": { - "summary": "Edit User", - "description": "Edit your user object.", + "summary": "Edit Server", + "description": "Edit a server object.", "tags": [ - "User Information" + "Server Information" + ], + "parameters": [ + { + "name": "server", + "in": "path", + "required": true, + "description": "Server ID", + "schema": { + "$ref": "#/definitions/Id" + } + } ], "requestBody": { - "description": "Requested changes to user object.", + "description": "Requested changes to server object.", "content": { "application/json": { "schema": { "type": "object", "properties": { - "status": { - "description": "User status", + "name": { + "description": "Server name", + "minLength": 1, + "maxLength": 32, + "type": "string" + }, + "description": { + "description": "Server description", + "minLength": 0, + "maxLength": 1024, + "type": "string" + }, + "icon": { + "description": "Autumn file ID, [learn more](https://example.com/TODO).", + "minLength": 1, + "maxLength": 128, + "type": "string" + }, + "banner": { + "description": "Autumn file ID, [learn more](https://example.com/TODO).", + "minLength": 1, + "maxLength": 128, + "type": "string" + }, + "categories": { + "description": "Server categories", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "description": "Id", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", + "type": "string" + }, + "title": { + "type": "string" + }, + "channels": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "channels", + "id", + "title" + ] + } + }, + "system_messages": { + "description": "System message channels", "type": "object", "properties": { - "text": { - "description": "Custom status text", - "minLength": 1, - "maxLength": 128, + "user_joined": { + "description": "Channel ID where user join events should be sent", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" }, - "presence": { - "$ref": "#/definitions/Presence" + "user_left": { + "description": "Channel ID where user leave events should be sent", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", + "type": "string" + }, + "user_kicked": { + "description": "Channel ID where user kick events should be sent", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", + "type": "string" + }, + "user_banned": { + "description": "Channel ID where user ban events should be sent", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", + "type": "string" } } }, - "profile": { - "description": "User profile data", - "type": "object", - "properties": { - "content": { - "description": "Text to set as user profile description", - "maxLength": 2000, - "type": "string" - }, - "background": { - "description": "Autumn file ID, [learn more](https://example.com/TODO).", - "minLength": 1, - "maxLength": 128, - "type": "string" - } - } + "remove": { + "description": "Field to remove from channel object", + "enum": [ + "Banner", + "Description", + "Icon" + ], + "type": "string" + } + }, + "required": [ + "name" + ] + } + } + } + }, + "responses": { + "200": { + "description": "Succesfully changed channel object." + } + }, + "security": [ + { + "User ID": [], + "Session Token": [] + } + ] + }, + "delete": { + "summary": "Delete / Leave Server", + "description": "Deletes a server if owner otherwise leaves.", + "tags": [ + "Server Information" + ], + "parameters": [ + { + "name": "server", + "in": "path", + "required": true, + "description": "Server ID", + "schema": { + "$ref": "#/definitions/Id" + } + } + ], + "responses": { + "200": { + "description": "Deleted Server" + } + }, + "security": [ + { + "User ID": [], + "Session Token": [] + } + ] + } + }, + "/servers/create": { + "post": { + "summary": "Create Server", + "description": "Create a new server.", + "tags": [ + "Server Information" + ], + "requestBody": { + "description": "Server Data", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "description": "Group name", + "minLength": 1, + "maxLength": 32, + "type": "string" + }, + "description": { + "description": "Group description", + "minLength": 0, + "maxLength": 1024, + "type": "string" + }, + "nonce": { + "description": "Nonce value, prefer to use ULIDs here for better feature support.\n\nUsed to prevent double requests to create objects.", + "minLength": 1, + "maxLength": 36, + "type": "string" + } + }, + "required": [ + "name", + "nonce" + ] + } + } + } + }, + "responses": { + "200": { + "description": "Server", + "content": { + "application/json": { + "schema": { + "$ref": "#/definitions/Server" + } + } + } + } + }, + "security": [ + { + "User ID": [], + "Session Token": [] + } + ] + } + }, + "/servers/:server/channels": { + "post": { + "summary": "Create Channel", + "description": "Create a new Text or Voice channel.", + "tags": [ + "Server Information" + ], + "parameters": [ + { + "name": "server", + "in": "path", + "required": true, + "description": "Server ID", + "schema": { + "$ref": "#/definitions/Id" + } + } + ], + "requestBody": { + "description": "Channel Data", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "description": "Channel type", + "enum": [ + "Text", + "Voice" + ], + "type": "string" + }, + "name": { + "description": "Channel name", + "minLength": 1, + "maxLength": 32, + "type": "string" + }, + "description": { + "description": "Channel description", + "minLength": 0, + "maxLength": 1024, + "type": "string" + }, + "nonce": { + "description": "Nonce value, prefer to use ULIDs here for better feature support.\n\nUsed to prevent double requests to create objects.", + "minLength": 1, + "maxLength": 36, + "type": "string" + } + }, + "required": [ + "name", + "nonce", + "type" + ] + } + } + } + }, + "security": [ + { + "User ID": [], + "Session Token": [] + } + ] + } + }, + "/servers/:server/invites": { + "get": { + "summary": "Fetch Invites", + "description": "Fetch all server invites.", + "tags": [ + "Server Information" + ], + "parameters": [ + { + "name": "server", + "in": "path", + "required": true, + "description": "Server ID", + "schema": { + "$ref": "#/definitions/Id" + } + } + ], + "security": [ + { + "User ID": [], + "Session Token": [] + } + ] + } + }, + "/servers/:server/members/:member": { + "get": { + "summary": "Fetch Member", + "description": "Retrieve a member.", + "tags": [ + "Server Members" + ], + "parameters": [ + { + "name": "server", + "in": "path", + "required": true, + "description": "Server ID", + "schema": { + "$ref": "#/definitions/Id" + } + }, + { + "name": "member", + "in": "path", + "required": true, + "description": "Member ID", + "schema": { + "$ref": "#/definitions/Id" + } + } + ], + "responses": { + "200": { + "description": "Retrieved member.", + "content": { + "application/json": { + "schema": { + "$ref": "#/definitions/Member" + } + } + } + } + }, + "security": [ + { + "User ID": [], + "Session Token": [] + } + ] + }, + "patch": { + "summary": "Edit Member", + "description": "Edit a member object.", + "tags": [ + "Server Members" + ], + "parameters": [ + { + "name": "server", + "in": "path", + "required": true, + "description": "Server ID", + "schema": { + "$ref": "#/definitions/Id" + } + } + ], + "requestBody": { + "description": "Requested changes to server object.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "nickname": { + "description": "Member nickname", + "minLength": 1, + "maxLength": 32, + "type": "string" }, "avatar": { "description": "Autumn file ID, [learn more](https://example.com/TODO).", @@ -271,77 +477,24 @@ "maxLength": 128, "type": "string" }, + "roles": { + "description": "Array of role IDs", + "type": "array", + "items": { + "type": "string" + } + }, "remove": { - "description": "Field to remove from user object", + "description": "Field to remove from channel object", "enum": [ "Avatar", - "ProfileBackground", - "ProfileContent", - "StatusText" + "Nickname" ], "type": "string" } }, - "definitions": { - "Presence": { - "description": "User presence", - "enum": [ - "Busy", - "Idle", - "Invisible", - "Online" - ], - "type": "string" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Succesfully changed user object." - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/users/@me/username": { - "patch": { - "summary": "Change Username", - "description": "Change your username.", - "tags": [ - "User Information" - ], - "requestBody": { - "description": "Requested change to username.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "username": { - "description": "New username", - "minLength": 2, - "maxLength": 32, - "pattern": "^[a-zA-Z0-9_.]+$", - "type": "string" - }, - "password": { - "description": "Current account password", - "minLength": 8, - "maxLength": 1024, - "type": "string" - } - }, "required": [ - "password", - "username" + "nickname" ] } } @@ -349,30 +502,48 @@ }, "responses": { "200": { - "description": "Succesfully changed user object." + "description": "Succesfully changed member object." } }, "security": [ { - "userId": [], - "sessionToken": [] + "User ID": [], + "Session Token": [] + } + ] + }, + "delete": { + "summary": "Kick Member", + "description": "Removes a member from the server.", + "tags": [ + "Server Members" + ], + "responses": { + "200": { + "description": "Removed Member" + } + }, + "security": [ + { + "User ID": [], + "Session Token": [] } ] } }, - "/users/:user/profile": { + "/servers/:server/members": { "get": { - "summary": "Fetch User Profile", - "description": "Retrieve a user's profile data.", + "summary": "Fetch Members", + "description": "Fetch all server members.", "tags": [ - "User Information" + "Server Members" ], "parameters": [ { - "name": "user", + "name": "server", "in": "path", "required": true, - "description": "User ID", + "description": "Server ID", "schema": { "$ref": "#/definitions/Id" } @@ -380,252 +551,40 @@ ], "responses": { "200": { - "description": "User profile.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/Profile" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/users/:user/default_avatar": { - "get": { - "summary": "Fetch Default Avatar", - "description": "This returns a default avatar based on the given id.", - "tags": [ - "User Information" - ], - "parameters": [ - { - "name": "user", - "in": "path", - "required": true, - "description": "User ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "Default avatar in PNG format", - "content": { - "image/png": { - "schema": { - "type": "string", - "format": "binary" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/users/:user/mutual": { - "get": { - "summary": "Fetch Mutual Friends", - "description": "Retrieve a list of mutual friends with another user.", - "tags": [ - "User Information" - ], - "parameters": [ - { - "name": "user", - "in": "path", - "required": true, - "description": "User ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "Mutual friends.", + "description": "Server Members", "content": { "application/json": { "schema": { "type": "object", "properties": { - "users": { - "description": "Array of user IDs who both you and the other user are friends with.", + "members": { "type": "array", "items": { - "type": "string" - } - } - }, - "required": [ - "users" - ] - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/users/dms": { - "get": { - "summary": "Fetch Direct Message Channels", - "description": "This fetches your direct messages, including any DM and group DM conversations.", - "tags": [ - "Direct Messaging" - ], - "responses": { - "200": { - "description": "Your DM conversations.", - "content": { - "application/json": { - "schema": { - "description": "Channel objects.", - "type": "array", - "items": { - "anyOf": [ - { "type": "object", "properties": { "_id": { - "description": "Channel Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "channel_type": { - "type": "string", - "enum": [ - "DirectMessage" - ] - }, - "active": { - "description": "Whether this DM is active", - "type": "boolean" - }, - "recipients": { - "description": "List of user IDs who are participating in this DM", - "type": "array", - "items": { - "type": "string" - } - }, - "last_message": { - "description": "Last message sent in channel", "type": "object", "properties": { - "_id": { - "description": "Message ID", + "server": { + "description": "Id", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" }, - "author": { - "description": "Author ID", + "user": { + "description": "Id", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" - }, - "short": { - "description": "Short content of message", - "maxLength": 128, - "type": "string" } }, "required": [ - "_id", - "author", - "short" - ] - } - }, - "required": [ - "_id", - "active", - "channel_type", - "last_message", - "recipients" - ] - }, - { - "type": "object", - "properties": { - "_id": { - "description": "Channel Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "channel_type": { - "type": "string", - "enum": [ - "Group" + "server", + "user" ] }, - "recipients": { - "description": "List of user IDs who are participating in this group", - "type": "array", - "items": { - "type": "string" - } - }, - "name": { - "description": "Group name", + "nickname": { "type": "string" }, - "owner": { - "description": "User ID of group owner", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "description": { - "description": "Group description", - "type": "string" - }, - "last_message": { - "description": "Last message sent in channel", - "type": "object", - "properties": { - "_id": { - "description": "Message ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "author": { - "description": "Author ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "short": { - "description": "Short content of message", - "maxLength": 128, - "type": "string" - } - }, - "required": [ - "_id", - "author", - "short" - ] - }, - "icon": { - "description": "Group icon", + "avatar": { "type": "object", "properties": { "_id": { @@ -750,22 +709,29 @@ "tag" ] }, - "permissions": { - "description": "Permissions given to group members", - "type": "number" + "roles": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "_id", - "channel_type", - "last_message", - "name", - "owner", - "recipients" + "_id" ] } - ] + }, + "users": { + "type": "array", + "items": { + "$ref": "#/definitions/User" + } + } }, + "required": [ + "members", + "users" + ], "definitions": { "AttachmentTag": { "description": "Attachment tag", @@ -777,102 +743,238 @@ "icons" ], "type": "string" - } - } - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/users/:user/dm": { - "get": { - "summary": "Open Direct Message", - "description": "Open a DM with another user.", - "tags": [ - "Direct Messaging" - ], - "parameters": [ - { - "name": "user", - "in": "path", - "required": true, - "description": "User ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "DM channel with user.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/DirectMessageChannel" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/users/relationships": { - "get": { - "summary": "Fetch Relationships", - "description": "Fetch all of your relationships with other users.", - "tags": [ - "Relationships" - ], - "responses": { - "200": { - "description": "Array of relationships.", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "allOf": [ - { - "type": "object", - "properties": { - "status": { - "$ref": "#/definitions/RelationshipStatus" + }, + "User": { + "type": "object", + "properties": { + "_id": { + "description": "User ID", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", + "type": "string" + }, + "username": { + "description": "Username", + "minLength": 2, + "maxLength": 32, + "pattern": "^[a-zA-Z0-9_.]+$", + "type": "string" + }, + "avatar": { + "description": "User avatar", + "type": "object", + "properties": { + "_id": { + "description": "Attachment ID", + "minLength": 1, + "maxLength": 128, + "type": "string" + }, + "tag": { + "$ref": "#/definitions/AttachmentTag" + }, + "size": { + "description": "File size (in bytes)", + "type": "number" + }, + "filename": { + "description": "File name", + "type": "string" + }, + "metadata": { + "description": "Metadata", + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "File" + ] + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "Text" + ] + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "Audio" + ] + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "Image" + ] + }, + "width": { + "type": "number" + }, + "height": { + "type": "number" + } + }, + "required": [ + "height", + "type", + "width" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "Video" + ] + }, + "width": { + "type": "number" + }, + "height": { + "type": "number" + } + }, + "required": [ + "height", + "type", + "width" + ] + } + ] + }, + "content_type": { + "description": "Content type", + "type": "string" + } + }, + "required": [ + "_id", + "content_type", + "filename", + "metadata", + "size", + "tag" + ] + }, + "relations": { + "description": "Relationships with other known users\nOnly present if fetching self", + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "status": { + "$ref": "#/definitions/RelationshipStatus" + } + }, + "required": [ + "status" + ] + }, + { + "type": "object", + "properties": { + "_id": { + "description": "Other user's ID", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", + "type": "string" + } + }, + "required": [ + "_id" + ] + } + ] } }, - "required": [ - "status" - ] + "badges": { + "description": "Bitfield of user's badges", + "type": "number" + }, + "status": { + "description": "User status", + "type": "object", + "properties": { + "text": { + "description": "Custom status text", + "minLength": 1, + "maxLength": 128, + "type": "string" + }, + "presence": { + "$ref": "#/definitions/Presence" + } + } + }, + "relationship": { + "description": "Relationship to user", + "allOf": [ + { + "type": "object", + "properties": { + "status": { + "$ref": "#/definitions/RelationshipStatus" + } + }, + "required": [ + "status" + ] + }, + { + "type": "object", + "properties": { + "_id": { + "description": "Other user's ID", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", + "type": "string" + } + }, + "required": [ + "_id" + ] + } + ] + }, + "online": { + "description": "Whether the user is online", + "type": "boolean" + } }, - { - "type": "object", - "properties": { - "_id": { - "description": "Other user's ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "_id" - ] - } - ] - }, - "definitions": { + "required": [ + "_id", + "username" + ] + }, "RelationshipStatus": { "description": "Your relationship with the user", "enum": [ @@ -885,342 +987,103 @@ "User" ], "type": "string" + }, + "Presence": { + "description": "User presence", + "enum": [ + "Busy", + "Idle", + "Invisible", + "Online" + ], + "type": "string" } } } } } } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] + } } }, - "/users/:user/relationship": { - "get": { - "summary": "Fetch Relationship", - "description": "Fetch your relationship with another other user.", - "tags": [ - "Relationships" - ], - "parameters": [ - { - "name": "user", - "in": "path", - "required": true, - "description": "User ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "Your relationship with the user.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/RelationshipOnly" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/users/:username/friend": { + "/servers/:server/bans/:member": { "put": { - "summary": "Send Friend Request / Accept Request", - "description": "Send a friend request to another user or accept another user's friend request.", + "summary": "Ban User", + "description": "Ban a user by their ID.", "tags": [ - "Relationships" + "Server Members" ], "parameters": [ { - "name": "username", + "name": "server", "in": "path", "required": true, - "description": "Username", - "schema": { - "$ref": "#/definitions/Username" - } - } - ], - "responses": { - "200": { - "description": "Sent friend request / added user as friend.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/RelationshipOnly" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - }, - "delete": { - "summary": "Deny Friend Request / Remove Friend", - "description": "Denies another user's friend request or removes an existing friend.", - "tags": [ - "Relationships" - ], - "parameters": [ - { - "name": "username", - "in": "path", - "required": true, - "description": "Username", - "schema": { - "$ref": "#/definitions/Username" - } - } - ], - "responses": { - "200": { - "description": "Deleted friend request / removed user from friends.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/RelationshipOnly" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/users/:user/block": { - "put": { - "summary": "Block User", - "description": "Block another user.", - "tags": [ - "Relationships" - ], - "parameters": [ - { - "name": "user", - "in": "path", - "required": true, - "description": "User ID", + "description": "Server ID", "schema": { "$ref": "#/definitions/Id" } - } - ], - "responses": { - "200": { - "description": "Blocked user.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/RelationshipOnly" - } - } - } - } - }, - "security": [ + }, { - "userId": [], - "sessionToken": [] - } - ] - }, - "delete": { - "summary": "Unblock User", - "description": "Unblock another user.", - "tags": [ - "Relationships" - ], - "parameters": [ - { - "name": "user", + "name": "member", "in": "path", "required": true, - "description": "User ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "Unblocked user.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/RelationshipOnly" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/channels/:channel": { - "get": { - "summary": "Fetch Channel", - "description": "Retrieve a channel.", - "tags": [ - "Channel Information" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "Retrieved channel.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/Channel" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - }, - "patch": { - "summary": "Edit Channel", - "description": "Edit a channel object.", - "tags": [ - "Channel Information" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", + "description": "Member ID", "schema": { "$ref": "#/definitions/Id" } } ], "requestBody": { - "description": "Requested changes to channel object.", + "description": "Ban Data", "content": { "application/json": { "schema": { "type": "object", "properties": { - "name": { - "description": "Channel name", - "type": "string" - }, - "description": { - "description": "Channel description", - "type": "string" - }, - "icon": { - "description": "Autumn file ID, [learn more](https://example.com/TODO).", + "reason": { + "description": "Ban reason", "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "remove": { - "description": "Field to remove from channel object", - "enum": [ - "Description", - "Icon" - ], + "maxLength": 1024, "type": "string" } - }, - "required": [ - "name" - ] + } } } } }, "responses": { "200": { - "description": "Succesfully changed channel object." + "description": "Banned user." } }, "security": [ { - "userId": [], - "sessionToken": [] + "User ID": [], + "Session Token": [] } ] }, "delete": { - "summary": "Close Channel", - "description": "Deletes a server channel, leaves a group or closes a DM.", + "summary": "Unban User", + "description": "Removes a user's ban.", "tags": [ - "Channel Information" - ], - "responses": { - "200": { - "description": "Deleted Channel" - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/channels/:channel/invites": { - "post": { - "summary": "Create Invite", - "description": "Creates an invite to this channel.\n\nChannel must be a `TextChannel`.", - "tags": [ - "Channel Invites" + "Server Members" ], "parameters": [ { - "name": "channel", + "name": "server", "in": "path", "required": true, - "description": "Channel ID", + "description": "Server ID", + "schema": { + "$ref": "#/definitions/Id" + } + }, + { + "name": "member", + "in": "path", + "required": true, + "description": "Member ID", "schema": { "$ref": "#/definitions/Id" } @@ -1228,20 +1091,72 @@ ], "responses": { "200": { - "description": "Invite", + "description": "Unbanned user." + } + }, + "security": [ + { + "User ID": [], + "Session Token": [] + } + ] + } + }, + "/servers/:server/bans": { + "get": { + "summary": "Fetch Bans", + "description": "Fetch all bans on server.", + "tags": [ + "Server Members" + ], + "parameters": [ + { + "name": "server", + "in": "path", + "required": true, + "description": "Server ID", + "schema": { + "$ref": "#/definitions/Id" + } + } + ], + "responses": { + "200": { + "description": "Bans", "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "code": { - "description": "Invite Code", - "type": "string" - } - }, - "required": [ - "code" - ] + "type": "array", + "items": { + "type": "object", + "properties": { + "_id": { + "type": "object", + "properties": { + "server": { + "description": "Id", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", + "type": "string" + }, + "user": { + "description": "Id", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", + "type": "string" + } + }, + "required": [ + "server", + "user" + ] + }, + "reason": { + "type": "string" + } + }, + "required": [ + "_id" + ] + } } } } @@ -1249,18 +1164,18 @@ }, "security": [ { - "userId": [], - "sessionToken": [] + "User ID": [], + "Session Token": [] } ] } }, - "/channels/:channel/permissions/:role": { + "/servers/:server/permissions/:role": { "put": { "summary": "Set Role Permission", - "description": "Sets permissions for the specified role in this channel.\n\nChannel must be a `TextChannel` or `VoiceChannel`.", + "description": "Sets permissions for the specified role in this server.", "tags": [ - "Channel Permissions" + "Server Permissions" ], "parameters": [ { @@ -1283,152 +1198,33 @@ } ], "requestBody": { - "description": "Channel Permissions", + "description": "Server Permissions", "content": { "application/json": { "schema": { "type": "object", "properties": { "permissions": { - "type": "number" - } - }, - "required": [ - "permissions" - ] - } - } - } - }, - "responses": { - "200": { - "description": "Successfully updated permissions." - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/channels/:channel/permissions/default": { - "put": { - "summary": "Set Default Permission", - "description": "Sets permissions for the default role in this channel.\n\nChannel must be a `Group`, `TextChannel` or `VoiceChannel`.", - "tags": [ - "Channel Permissions" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "requestBody": { - "description": "Channel Permissions", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "permissions": { - "type": "number" - } - }, - "required": [ - "permissions" - ] - } - } - } - }, - "responses": { - "200": { - "description": "Successfully updated permissions." - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/channels/:channel/messages": { - "post": { - "summary": "Send Message", - "description": "Sends a message to the given channel.", - "tags": [ - "Messaging" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "requestBody": { - "description": "Message to be sent.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "content": { - "description": "Message content to send.", - "minLength": 0, - "maxLength": 2000, - "type": "string" - }, - "nonce": { - "description": "Nonce value, prefer to use ULIDs here for better feature support.\n\nUsed to prevent double requests to create objects.", - "minLength": 1, - "maxLength": 36, - "type": "string" - }, - "attachments": { - "description": "Attachments to include in message.", - "type": "array", - "items": { - "type": "string" - } - }, - "replies": { - "description": "Messages to reply to.", + "description": "Permission values", "type": "object", "properties": { - "id": { - "description": "Message Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" + "server": { + "description": "Server permission", + "type": "number" }, - "mention": { - "description": "Whether this reply should mention the message's author.", - "type": "boolean" + "channel": { + "description": "Channel permission", + "type": "number" } }, "required": [ - "id", - "mention" + "channel", + "server" ] } }, "required": [ - "content", - "nonce" + "permissions" ] } } @@ -1436,4842 +1232,115 @@ }, "responses": { "200": { - "description": "Sent message.", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/Message" - } - } - } + "description": "Successfully updated permissions." } }, "security": [ { - "userId": [], - "sessionToken": [] - } - ] - }, - "get": { - "summary": "Fetch Messages", - "description": "Fetches multiple messages.", - "tags": [ - "Messaging" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "requestBody": { - "description": "Fetch Options", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "limit": { - "description": "Maximum number of messages to fetch.\n\nFor fetching nearby messages, this is `(limit + 1)`.", - "minimum": 1, - "maximum": 100, - "type": "number" - }, - "before": { - "description": "Message id before which messages should be fetched.", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "after": { - "description": "Message id after which messages should be fetched.", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "sort": { - "description": "Message sort direction", - "enum": [ - "Latest", - "Oldest" - ], - "type": "string" - }, - "nearby": { - "description": "Message id to fetch around, this will ignore 'before', 'after' and 'sort' options.\nLimits in each direction will be half of the specified limit.\nIt also fetches the specified message ID.", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "include_users": { - "description": "Whether to include user (and member, if server channel) objects.", - "type": "boolean" - } - }, - "required": [ - "sort" - ] - } - } - } - }, - "responses": { - "200": { - "description": "Message array or object with requested data.", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "description": "Message Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "nonce": { - "description": "Nonce value, prefer to use ULIDs here for better feature support.\n\nUsed to prevent double requests to create objects.", - "minLength": 1, - "maxLength": 36, - "type": "string" - }, - "channel": { - "description": "Channel Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "author": { - "description": "Author Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "content": { - "description": "Message content, can be an object *only* if sent by the system user.", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "text" - ] - }, - "content": { - "type": "string" - } - }, - "required": [ - "content", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_added" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_remove" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_joined" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_left" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_kicked" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_banned" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_renamed" - ] - }, - "name": { - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "name", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_description_changed" - ] - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_icon_changed" - ] - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "type" - ] - }, - { - "type": "string" - } - ] - }, - "attachments": { - "description": "Message attachments", - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "description": "Attachment ID", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "tag": { - "$ref": "#/definitions/AttachmentTag" - }, - "size": { - "description": "File size (in bytes)", - "type": "number" - }, - "filename": { - "description": "File name", - "type": "string" - }, - "metadata": { - "description": "Metadata", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "File" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Text" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Audio" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Video" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - } - ] - }, - "content_type": { - "description": "Content type", - "type": "string" - } - }, - "required": [ - "_id", - "content_type", - "filename", - "metadata", - "size", - "tag" - ] - } - }, - "edited": { - "description": "Unix timestamp of when message was last edited", - "type": "object", - "properties": { - "$date": { - "type": "string" - } - }, - "required": [ - "$date" - ] - }, - "embeds": { - "description": "Message link embeds", - "type": "array", - "items": { - "description": "Message embed", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Website" - ] - }, - "url": { - "type": "string" - }, - "special": { - "description": "A special 3rd party embed", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "YouTube" - ] - }, - "id": { - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Twitch" - ] - }, - "content_type": { - "enum": [ - "Channel", - "Clip", - "Video" - ], - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Spotify" - ] - }, - "content_type": { - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Soundcloud" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Bandcamp" - ] - }, - "content_type": { - "enum": [ - "Album", - "Track" - ], - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - } - ] - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "image": { - "description": "An embedded image", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "size": { - "enum": [ - "Large", - "Preview" - ], - "type": "string" - } - }, - "required": [ - "height", - "size", - "url", - "width" - ] - }, - "video": { - "description": "An embedded video", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "url", - "width" - ] - }, - "site_name": { - "type": "string" - }, - "icon_url": { - "type": "string" - }, - "color": { - "type": "string" - } - }, - "required": [ - "type" - ] - }, - { - "allOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - } - }, - "required": [ - "type" - ] - }, - { - "description": "An embedded image", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "size": { - "enum": [ - "Large", - "Preview" - ], - "type": "string" - } - }, - "required": [ - "height", - "size", - "url", - "width" - ] - } - ] - } - ] - } - }, - "mentions": { - "description": "Array of user IDs mentioned in message", - "type": "array", - "items": { - "type": "string" - } - }, - "replies": { - "description": "Array of message IDs replied to", - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "_id", - "author", - "channel", - "content" - ] - } - }, - { - "type": "object", - "properties": { - "messages": { - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "description": "Message Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "nonce": { - "description": "Nonce value, prefer to use ULIDs here for better feature support.\n\nUsed to prevent double requests to create objects.", - "minLength": 1, - "maxLength": 36, - "type": "string" - }, - "channel": { - "description": "Channel Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "author": { - "description": "Author Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "content": { - "description": "Message content, can be an object *only* if sent by the system user.", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "text" - ] - }, - "content": { - "type": "string" - } - }, - "required": [ - "content", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_added" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_remove" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_joined" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_left" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_kicked" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_banned" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_renamed" - ] - }, - "name": { - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "name", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_description_changed" - ] - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_icon_changed" - ] - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "type" - ] - }, - { - "type": "string" - } - ] - }, - "attachments": { - "description": "Message attachments", - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "description": "Attachment ID", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "tag": { - "$ref": "#/definitions/AttachmentTag" - }, - "size": { - "description": "File size (in bytes)", - "type": "number" - }, - "filename": { - "description": "File name", - "type": "string" - }, - "metadata": { - "description": "Metadata", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "File" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Text" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Audio" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Video" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - } - ] - }, - "content_type": { - "description": "Content type", - "type": "string" - } - }, - "required": [ - "_id", - "content_type", - "filename", - "metadata", - "size", - "tag" - ] - } - }, - "edited": { - "description": "Unix timestamp of when message was last edited", - "type": "object", - "properties": { - "$date": { - "type": "string" - } - }, - "required": [ - "$date" - ] - }, - "embeds": { - "description": "Message link embeds", - "type": "array", - "items": { - "description": "Message embed", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Website" - ] - }, - "url": { - "type": "string" - }, - "special": { - "description": "A special 3rd party embed", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "YouTube" - ] - }, - "id": { - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Twitch" - ] - }, - "content_type": { - "enum": [ - "Channel", - "Clip", - "Video" - ], - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Spotify" - ] - }, - "content_type": { - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Soundcloud" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Bandcamp" - ] - }, - "content_type": { - "enum": [ - "Album", - "Track" - ], - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - } - ] - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "image": { - "description": "An embedded image", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "size": { - "enum": [ - "Large", - "Preview" - ], - "type": "string" - } - }, - "required": [ - "height", - "size", - "url", - "width" - ] - }, - "video": { - "description": "An embedded video", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "url", - "width" - ] - }, - "site_name": { - "type": "string" - }, - "icon_url": { - "type": "string" - }, - "color": { - "type": "string" - } - }, - "required": [ - "type" - ] - }, - { - "allOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - } - }, - "required": [ - "type" - ] - }, - { - "description": "An embedded image", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "size": { - "enum": [ - "Large", - "Preview" - ], - "type": "string" - } - }, - "required": [ - "height", - "size", - "url", - "width" - ] - } - ] - } - ] - } - }, - "mentions": { - "description": "Array of user IDs mentioned in message", - "type": "array", - "items": { - "type": "string" - } - }, - "replies": { - "description": "Array of message IDs replied to", - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "_id", - "author", - "channel", - "content" - ] - } - }, - "users": { - "type": "array", - "items": { - "$ref": "#/definitions/User" - } - }, - "members": { - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "type": "object", - "properties": { - "server": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "user": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "server", - "user" - ] - }, - "nickname": { - "type": "string" - }, - "avatar": { - "type": "object", - "properties": { - "_id": { - "description": "Attachment ID", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "tag": { - "$ref": "#/definitions/AttachmentTag" - }, - "size": { - "description": "File size (in bytes)", - "type": "number" - }, - "filename": { - "description": "File name", - "type": "string" - }, - "metadata": { - "description": "Metadata", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "File" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Text" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Audio" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Video" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - } - ] - }, - "content_type": { - "description": "Content type", - "type": "string" - } - }, - "required": [ - "_id", - "content_type", - "filename", - "metadata", - "size", - "tag" - ] - }, - "roles": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "_id" - ] - } - } - }, - "required": [ - "messages", - "users" - ] - } - ], - "definitions": { - "AttachmentTag": { - "description": "Attachment tag", - "enum": [ - "attachments", - "avatars", - "backgrounds", - "banners", - "icons" - ], - "type": "string" - }, - "User": { - "type": "object", - "properties": { - "_id": { - "description": "User ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "username": { - "description": "Username", - "minLength": 2, - "maxLength": 32, - "pattern": "^[a-zA-Z0-9_.]+$", - "type": "string" - }, - "avatar": { - "description": "User avatar", - "type": "object", - "properties": { - "_id": { - "description": "Attachment ID", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "tag": { - "$ref": "#/definitions/AttachmentTag" - }, - "size": { - "description": "File size (in bytes)", - "type": "number" - }, - "filename": { - "description": "File name", - "type": "string" - }, - "metadata": { - "description": "Metadata", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "File" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Text" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Audio" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Video" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - } - ] - }, - "content_type": { - "description": "Content type", - "type": "string" - } - }, - "required": [ - "_id", - "content_type", - "filename", - "metadata", - "size", - "tag" - ] - }, - "relations": { - "description": "Relationships with other known users\nOnly present if fetching self", - "type": "array", - "items": { - "allOf": [ - { - "type": "object", - "properties": { - "status": { - "$ref": "#/definitions/RelationshipStatus" - } - }, - "required": [ - "status" - ] - }, - { - "type": "object", - "properties": { - "_id": { - "description": "Other user's ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "_id" - ] - } - ] - } - }, - "badges": { - "description": "Bitfield of user's badges", - "type": "number" - }, - "status": { - "description": "User status", - "type": "object", - "properties": { - "text": { - "description": "Custom status text", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "presence": { - "$ref": "#/definitions/Presence" - } - } - }, - "relationship": { - "description": "Relationship to user", - "allOf": [ - { - "type": "object", - "properties": { - "status": { - "$ref": "#/definitions/RelationshipStatus" - } - }, - "required": [ - "status" - ] - }, - { - "type": "object", - "properties": { - "_id": { - "description": "Other user's ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "_id" - ] - } - ] - }, - "online": { - "description": "Whether the user is online", - "type": "boolean" - } - }, - "required": [ - "_id", - "username" - ] - }, - "RelationshipStatus": { - "description": "Your relationship with the user", - "enum": [ - "Blocked", - "BlockedOther", - "Friend", - "Incoming", - "None", - "Outgoing", - "User" - ], - "type": "string" - }, - "Presence": { - "description": "User presence", - "enum": [ - "Busy", - "Idle", - "Invisible", - "Online" - ], - "type": "string" - } - } - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] + "User ID": [], + "Session Token": [] } ] } }, - "/channels/:channel/messages/:message": { - "get": { - "summary": "Fetch Message", - "description": "Retrieves a message by ID.", - "tags": [ - "Messaging" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - }, - { - "name": "message", - "in": "path", - "required": true, - "description": "Message ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "Message", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/Message" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - }, - "patch": { - "summary": "Edit Message", - "description": "Edits a message that you've previously sent.", - "tags": [ - "Messaging" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - }, - { - "name": "message", - "in": "path", - "required": true, - "description": "Message ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "requestBody": { - "description": "Message edit data.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "content": { - "description": "Message content", - "minLength": 1, - "maxLength": 2000, - "type": "string" - } - }, - "required": [ - "content" - ] - } - } - } - }, - "responses": { - "200": { - "description": "Message was changed." - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - }, - "delete": { - "summary": "Delete Message", - "description": "Delete a message you've sent or one you have permission to delete.", - "tags": [ - "Messaging" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - }, - { - "name": "message", - "in": "path", - "required": true, - "description": "Message ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "Message was deleted." - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/channels/:channel/messages/stale": { - "post": { - "summary": "Poll Message Changes", - "description": "This route returns any changed message objects and tells you if any have been deleted.\n\nDon't actually poll this route, instead use this to update your local database.", - "tags": [ - "Messaging" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "requestBody": { - "description": "Poll Options", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "ids": { - "description": "Array of message IDs.", - "maxItems": 150, - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "ids" - ] - } - } - } - }, - "responses": { - "200": { - "description": "Polled Information", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "changed": { - "description": "Changed message objects.", - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "description": "Message Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "nonce": { - "description": "Nonce value, prefer to use ULIDs here for better feature support.\n\nUsed to prevent double requests to create objects.", - "minLength": 1, - "maxLength": 36, - "type": "string" - }, - "channel": { - "description": "Channel Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "author": { - "description": "Author Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "content": { - "description": "Message content, can be an object *only* if sent by the system user.", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "text" - ] - }, - "content": { - "type": "string" - } - }, - "required": [ - "content", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_added" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_remove" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_joined" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_left" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_kicked" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_banned" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_renamed" - ] - }, - "name": { - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "name", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_description_changed" - ] - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_icon_changed" - ] - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "type" - ] - }, - { - "type": "string" - } - ] - }, - "attachments": { - "description": "Message attachments", - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "description": "Attachment ID", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "tag": { - "$ref": "#/definitions/AttachmentTag" - }, - "size": { - "description": "File size (in bytes)", - "type": "number" - }, - "filename": { - "description": "File name", - "type": "string" - }, - "metadata": { - "description": "Metadata", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "File" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Text" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Audio" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Video" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - } - ] - }, - "content_type": { - "description": "Content type", - "type": "string" - } - }, - "required": [ - "_id", - "content_type", - "filename", - "metadata", - "size", - "tag" - ] - } - }, - "edited": { - "description": "Unix timestamp of when message was last edited", - "type": "object", - "properties": { - "$date": { - "type": "string" - } - }, - "required": [ - "$date" - ] - }, - "embeds": { - "description": "Message link embeds", - "type": "array", - "items": { - "description": "Message embed", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Website" - ] - }, - "url": { - "type": "string" - }, - "special": { - "description": "A special 3rd party embed", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "YouTube" - ] - }, - "id": { - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Twitch" - ] - }, - "content_type": { - "enum": [ - "Channel", - "Clip", - "Video" - ], - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Spotify" - ] - }, - "content_type": { - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Soundcloud" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Bandcamp" - ] - }, - "content_type": { - "enum": [ - "Album", - "Track" - ], - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - } - ] - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "image": { - "description": "An embedded image", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "size": { - "enum": [ - "Large", - "Preview" - ], - "type": "string" - } - }, - "required": [ - "height", - "size", - "url", - "width" - ] - }, - "video": { - "description": "An embedded video", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "url", - "width" - ] - }, - "site_name": { - "type": "string" - }, - "icon_url": { - "type": "string" - }, - "color": { - "type": "string" - } - }, - "required": [ - "type" - ] - }, - { - "allOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - } - }, - "required": [ - "type" - ] - }, - { - "description": "An embedded image", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "size": { - "enum": [ - "Large", - "Preview" - ], - "type": "string" - } - }, - "required": [ - "height", - "size", - "url", - "width" - ] - } - ] - } - ] - } - }, - "mentions": { - "description": "Array of user IDs mentioned in message", - "type": "array", - "items": { - "type": "string" - } - }, - "replies": { - "description": "Array of message IDs replied to", - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "_id", - "author", - "channel", - "content" - ] - } - }, - "deleted": { - "description": "Array of deleted message IDs.", - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "changed", - "deleted" - ], - "definitions": { - "AttachmentTag": { - "description": "Attachment tag", - "enum": [ - "attachments", - "avatars", - "backgrounds", - "banners", - "icons" - ], - "type": "string" - } - } - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/channels/:channel/messages/search": { - "post": { - "summary": "Search for Messages", - "description": "This route searches for messages within the given parameters.", - "tags": [ - "Messaging" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "requestBody": { - "description": "Search Options", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "query": { - "description": "Full-text search query.\n\nSee [MongoDB documentation](https://docs.mongodb.com/manual/text-search/#-text-operator) for more information.", - "minLength": 1, - "maxLength": 64, - "type": "string" - }, - "limit": { - "description": "Maximum number of messages to fetch.", - "minimum": 1, - "maximum": 100, - "type": "number" - }, - "before": { - "description": "Message id before which messages should be fetched.", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "after": { - "description": "Message id after which messages should be fetched.", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "sort": { - "description": "Message sort direction", - "enum": [ - "Latest", - "Oldest", - "Relevance" - ], - "type": "string" - }, - "include_users": { - "description": "Whether to include user (and member, if server channel) objects.", - "type": "boolean" - } - }, - "required": [ - "query", - "sort" - ] - } - } - } - }, - "responses": { - "200": { - "description": "Message array or object with requested data.", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "description": "Message Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "nonce": { - "description": "Nonce value, prefer to use ULIDs here for better feature support.\n\nUsed to prevent double requests to create objects.", - "minLength": 1, - "maxLength": 36, - "type": "string" - }, - "channel": { - "description": "Channel Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "author": { - "description": "Author Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "content": { - "description": "Message content, can be an object *only* if sent by the system user.", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "text" - ] - }, - "content": { - "type": "string" - } - }, - "required": [ - "content", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_added" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_remove" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_joined" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_left" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_kicked" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_banned" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_renamed" - ] - }, - "name": { - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "name", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_description_changed" - ] - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_icon_changed" - ] - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "type" - ] - }, - { - "type": "string" - } - ] - }, - "attachments": { - "description": "Message attachments", - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "description": "Attachment ID", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "tag": { - "$ref": "#/definitions/AttachmentTag" - }, - "size": { - "description": "File size (in bytes)", - "type": "number" - }, - "filename": { - "description": "File name", - "type": "string" - }, - "metadata": { - "description": "Metadata", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "File" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Text" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Audio" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Video" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - } - ] - }, - "content_type": { - "description": "Content type", - "type": "string" - } - }, - "required": [ - "_id", - "content_type", - "filename", - "metadata", - "size", - "tag" - ] - } - }, - "edited": { - "description": "Unix timestamp of when message was last edited", - "type": "object", - "properties": { - "$date": { - "type": "string" - } - }, - "required": [ - "$date" - ] - }, - "embeds": { - "description": "Message link embeds", - "type": "array", - "items": { - "description": "Message embed", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Website" - ] - }, - "url": { - "type": "string" - }, - "special": { - "description": "A special 3rd party embed", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "YouTube" - ] - }, - "id": { - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Twitch" - ] - }, - "content_type": { - "enum": [ - "Channel", - "Clip", - "Video" - ], - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Spotify" - ] - }, - "content_type": { - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Soundcloud" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Bandcamp" - ] - }, - "content_type": { - "enum": [ - "Album", - "Track" - ], - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - } - ] - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "image": { - "description": "An embedded image", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "size": { - "enum": [ - "Large", - "Preview" - ], - "type": "string" - } - }, - "required": [ - "height", - "size", - "url", - "width" - ] - }, - "video": { - "description": "An embedded video", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "url", - "width" - ] - }, - "site_name": { - "type": "string" - }, - "icon_url": { - "type": "string" - }, - "color": { - "type": "string" - } - }, - "required": [ - "type" - ] - }, - { - "allOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - } - }, - "required": [ - "type" - ] - }, - { - "description": "An embedded image", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "size": { - "enum": [ - "Large", - "Preview" - ], - "type": "string" - } - }, - "required": [ - "height", - "size", - "url", - "width" - ] - } - ] - } - ] - } - }, - "mentions": { - "description": "Array of user IDs mentioned in message", - "type": "array", - "items": { - "type": "string" - } - }, - "replies": { - "description": "Array of message IDs replied to", - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "_id", - "author", - "channel", - "content" - ] - } - }, - { - "type": "object", - "properties": { - "messages": { - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "description": "Message Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "nonce": { - "description": "Nonce value, prefer to use ULIDs here for better feature support.\n\nUsed to prevent double requests to create objects.", - "minLength": 1, - "maxLength": 36, - "type": "string" - }, - "channel": { - "description": "Channel Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "author": { - "description": "Author Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "content": { - "description": "Message content, can be an object *only* if sent by the system user.", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "text" - ] - }, - "content": { - "type": "string" - } - }, - "required": [ - "content", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_added" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_remove" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_joined" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_left" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_kicked" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user_banned" - ] - }, - "id": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_renamed" - ] - }, - "name": { - "type": "string" - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "name", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_description_changed" - ] - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "channel_icon_changed" - ] - }, - "by": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "by", - "type" - ] - }, - { - "type": "string" - } - ] - }, - "attachments": { - "description": "Message attachments", - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "description": "Attachment ID", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "tag": { - "$ref": "#/definitions/AttachmentTag" - }, - "size": { - "description": "File size (in bytes)", - "type": "number" - }, - "filename": { - "description": "File name", - "type": "string" - }, - "metadata": { - "description": "Metadata", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "File" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Text" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Audio" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Video" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - } - ] - }, - "content_type": { - "description": "Content type", - "type": "string" - } - }, - "required": [ - "_id", - "content_type", - "filename", - "metadata", - "size", - "tag" - ] - } - }, - "edited": { - "description": "Unix timestamp of when message was last edited", - "type": "object", - "properties": { - "$date": { - "type": "string" - } - }, - "required": [ - "$date" - ] - }, - "embeds": { - "description": "Message link embeds", - "type": "array", - "items": { - "description": "Message embed", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Website" - ] - }, - "url": { - "type": "string" - }, - "special": { - "description": "A special 3rd party embed", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "YouTube" - ] - }, - "id": { - "type": "string" - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Twitch" - ] - }, - "content_type": { - "enum": [ - "Channel", - "Clip", - "Video" - ], - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Spotify" - ] - }, - "content_type": { - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Soundcloud" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Bandcamp" - ] - }, - "content_type": { - "enum": [ - "Album", - "Track" - ], - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "content_type", - "id", - "type" - ] - } - ] - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "image": { - "description": "An embedded image", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "size": { - "enum": [ - "Large", - "Preview" - ], - "type": "string" - } - }, - "required": [ - "height", - "size", - "url", - "width" - ] - }, - "video": { - "description": "An embedded video", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "url", - "width" - ] - }, - "site_name": { - "type": "string" - }, - "icon_url": { - "type": "string" - }, - "color": { - "type": "string" - } - }, - "required": [ - "type" - ] - }, - { - "allOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - } - }, - "required": [ - "type" - ] - }, - { - "description": "An embedded image", - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "size": { - "enum": [ - "Large", - "Preview" - ], - "type": "string" - } - }, - "required": [ - "height", - "size", - "url", - "width" - ] - } - ] - } - ] - } - }, - "mentions": { - "description": "Array of user IDs mentioned in message", - "type": "array", - "items": { - "type": "string" - } - }, - "replies": { - "description": "Array of message IDs replied to", - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "_id", - "author", - "channel", - "content" - ] - } - }, - "users": { - "type": "array", - "items": { - "$ref": "#/definitions/User" - } - }, - "members": { - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "type": "object", - "properties": { - "server": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "user": { - "description": "Id", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "server", - "user" - ] - }, - "nickname": { - "type": "string" - }, - "avatar": { - "type": "object", - "properties": { - "_id": { - "description": "Attachment ID", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "tag": { - "$ref": "#/definitions/AttachmentTag" - }, - "size": { - "description": "File size (in bytes)", - "type": "number" - }, - "filename": { - "description": "File name", - "type": "string" - }, - "metadata": { - "description": "Metadata", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "File" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Text" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Audio" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Video" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - } - ] - }, - "content_type": { - "description": "Content type", - "type": "string" - } - }, - "required": [ - "_id", - "content_type", - "filename", - "metadata", - "size", - "tag" - ] - }, - "roles": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "_id" - ] - } - } - }, - "required": [ - "messages", - "users" - ] - } - ], - "definitions": { - "AttachmentTag": { - "description": "Attachment tag", - "enum": [ - "attachments", - "avatars", - "backgrounds", - "banners", - "icons" - ], - "type": "string" - }, - "User": { - "type": "object", - "properties": { - "_id": { - "description": "User ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "username": { - "description": "Username", - "minLength": 2, - "maxLength": 32, - "pattern": "^[a-zA-Z0-9_.]+$", - "type": "string" - }, - "avatar": { - "description": "User avatar", - "type": "object", - "properties": { - "_id": { - "description": "Attachment ID", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "tag": { - "$ref": "#/definitions/AttachmentTag" - }, - "size": { - "description": "File size (in bytes)", - "type": "number" - }, - "filename": { - "description": "File name", - "type": "string" - }, - "metadata": { - "description": "Metadata", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "File" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Text" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Audio" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Video" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - } - ] - }, - "content_type": { - "description": "Content type", - "type": "string" - } - }, - "required": [ - "_id", - "content_type", - "filename", - "metadata", - "size", - "tag" - ] - }, - "relations": { - "description": "Relationships with other known users\nOnly present if fetching self", - "type": "array", - "items": { - "allOf": [ - { - "type": "object", - "properties": { - "status": { - "$ref": "#/definitions/RelationshipStatus" - } - }, - "required": [ - "status" - ] - }, - { - "type": "object", - "properties": { - "_id": { - "description": "Other user's ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "_id" - ] - } - ] - } - }, - "badges": { - "description": "Bitfield of user's badges", - "type": "number" - }, - "status": { - "description": "User status", - "type": "object", - "properties": { - "text": { - "description": "Custom status text", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "presence": { - "$ref": "#/definitions/Presence" - } - } - }, - "relationship": { - "description": "Relationship to user", - "allOf": [ - { - "type": "object", - "properties": { - "status": { - "$ref": "#/definitions/RelationshipStatus" - } - }, - "required": [ - "status" - ] - }, - { - "type": "object", - "properties": { - "_id": { - "description": "Other user's ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "_id" - ] - } - ] - }, - "online": { - "description": "Whether the user is online", - "type": "boolean" - } - }, - "required": [ - "_id", - "username" - ] - }, - "RelationshipStatus": { - "description": "Your relationship with the user", - "enum": [ - "Blocked", - "BlockedOther", - "Friend", - "Incoming", - "None", - "Outgoing", - "User" - ], - "type": "string" - }, - "Presence": { - "description": "User presence", - "enum": [ - "Busy", - "Idle", - "Invisible", - "Online" - ], - "type": "string" - } - } - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/channels/:channel/ack/:message": { + "/servers/:server/permissions/default": { "put": { - "summary": "Acknowledge Message", - "description": "Lets the server and all other clients know that we've seen this message id in this channel.", + "summary": "Set Default Permission", + "description": "Sets permissions for the default role in this server.", "tags": [ - "Messaging" + "Server Permissions" ], "parameters": [ { - "name": "channel", + "name": "server", "in": "path", "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - }, - { - "name": "message", - "in": "path", - "required": true, - "description": "Message ID", + "description": "Server ID", "schema": { "$ref": "#/definitions/Id" } } ], + "requestBody": { + "description": "Server Permissions", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "permissions": { + "description": "Permission values", + "type": "object", + "properties": { + "server": { + "description": "Server permission", + "type": "number" + }, + "channel": { + "description": "Channel permission", + "type": "number" + } + }, + "required": [ + "channel", + "server" + ] + } + }, + "required": [ + "permissions" + ] + } + } + } + }, "responses": { "200": { - "description": "Acknowledged message." + "description": "Successfully updated permissions." } }, "security": [ { - "userId": [], - "sessionToken": [] + "User ID": [], + "Session Token": [] } ] } }, - "/channels/create": { + "/servers/:server/roles": { "post": { - "summary": "Create Group", - "description": "Create a new group with friends.", + "summary": "Create Role", + "description": "Creates a new server role.", "tags": [ - "Groups" + "Server Permissions" + ], + "parameters": [ + { + "name": "server", + "in": "path", + "required": true, + "description": "Server ID", + "schema": { + "$ref": "#/definitions/Id" + } + } ], "requestBody": { - "description": "Group Data", + "description": "Role Data", "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { - "description": "Group name", + "description": "Role name", "minLength": 1, "maxLength": 32, "type": "string" - }, - "description": { - "description": "Group description", - "minLength": 0, - "maxLength": 1024, - "type": "string" - }, - "nonce": { - "description": "Nonce value, prefer to use ULIDs here for better feature support.\n\nUsed to prevent double requests to create objects.", - "minLength": 1, - "maxLength": 36, - "type": "string" - }, - "users": { - "description": "Array of user IDs to add to the group.\n\nMust be friends with them.", - "maxItems": 49, - "type": "array", - "items": { - "type": "string" - } } }, "required": [ - "name", - "nonce" + "name" ] } } @@ -6279,450 +1348,35 @@ }, "responses": { "200": { - "description": "Group", - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/GroupChannel" - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/channels/:channel/members": { - "get": { - "summary": "Fetch Group Members", - "description": "Retrieves users who are part of this group.", - "tags": [ - "Groups" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - }, - { - "name": "message", - "in": "path", - "required": true, - "description": "Message ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "Members", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/User" - }, - "definitions": { - "User": { - "type": "object", - "properties": { - "_id": { - "description": "User ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - }, - "username": { - "description": "Username", - "minLength": 2, - "maxLength": 32, - "pattern": "^[a-zA-Z0-9_.]+$", - "type": "string" - }, - "avatar": { - "description": "User avatar", - "type": "object", - "properties": { - "_id": { - "description": "Attachment ID", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "tag": { - "$ref": "#/definitions/AttachmentTag" - }, - "size": { - "description": "File size (in bytes)", - "type": "number" - }, - "filename": { - "description": "File name", - "type": "string" - }, - "metadata": { - "description": "Metadata", - "anyOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "File" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Text" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Audio" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Image" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Video" - ] - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - } - }, - "required": [ - "height", - "type", - "width" - ] - } - ] - }, - "content_type": { - "description": "Content type", - "type": "string" - } - }, - "required": [ - "_id", - "content_type", - "filename", - "metadata", - "size", - "tag" - ] - }, - "relations": { - "description": "Relationships with other known users\nOnly present if fetching self", - "type": "array", - "items": { - "allOf": [ - { - "type": "object", - "properties": { - "status": { - "$ref": "#/definitions/RelationshipStatus" - } - }, - "required": [ - "status" - ] - }, - { - "type": "object", - "properties": { - "_id": { - "description": "Other user's ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "_id" - ] - } - ] - } - }, - "badges": { - "description": "Bitfield of user's badges", - "type": "number" - }, - "status": { - "description": "User status", - "type": "object", - "properties": { - "text": { - "description": "Custom status text", - "minLength": 1, - "maxLength": 128, - "type": "string" - }, - "presence": { - "$ref": "#/definitions/Presence" - } - } - }, - "relationship": { - "description": "Relationship to user", - "allOf": [ - { - "type": "object", - "properties": { - "status": { - "$ref": "#/definitions/RelationshipStatus" - } - }, - "required": [ - "status" - ] - }, - { - "type": "object", - "properties": { - "_id": { - "description": "Other user's ID", - "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", - "type": "string" - } - }, - "required": [ - "_id" - ] - } - ] - }, - "online": { - "description": "Whether the user is online", - "type": "boolean" - } - }, - "required": [ - "_id", - "username" - ] - }, - "AttachmentTag": { - "description": "Attachment tag", - "enum": [ - "attachments", - "avatars", - "backgrounds", - "banners", - "icons" - ], - "type": "string" - }, - "RelationshipStatus": { - "description": "Your relationship with the user", - "enum": [ - "Blocked", - "BlockedOther", - "Friend", - "Incoming", - "None", - "Outgoing", - "User" - ], - "type": "string" - }, - "Presence": { - "description": "User presence", - "enum": [ - "Busy", - "Idle", - "Invisible", - "Online" - ], - "type": "string" - } - } - } - } - } - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - }, - "put": { - "summary": "Add Group Member", - "description": "Adds another user to the group.", - "tags": [ - "Groups" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - }, - { - "name": "message", - "in": "path", - "required": true, - "description": "Message ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "User was added to the group." - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - }, - "delete": { - "summary": "Remove Group Member", - "description": "Removes a user from the group.", - "tags": [ - "Groups" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - }, - { - "name": "message", - "in": "path", - "required": true, - "description": "Message ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "User was removed from the group." - } - }, - "security": [ - { - "userId": [], - "sessionToken": [] - } - ] - } - }, - "/channels/:channel/join_call": { - "post": { - "summary": "Join Call", - "description": "Asks the voice server for a token to join the call.", - "tags": [ - "Voice" - ], - "parameters": [ - { - "name": "channel", - "in": "path", - "required": true, - "description": "Channel ID", - "schema": { - "$ref": "#/definitions/Id" - } - } - ], - "responses": { - "200": { - "description": "Join Data", + "description": "New Role", "content": { "application/json": { "schema": { "type": "object", "properties": { - "token": { - "description": "Voso Token", + "id": { + "description": "Role ID", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" + }, + "permissions": { + "description": "Tuple consisting of server and channel permissions in that order", + "type": "array", + "items": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "minItems": 2, + "maxItems": 2 } }, "required": [ - "token" + "id", + "permissions" ] } } @@ -6731,8 +1385,48 @@ }, "security": [ { - "userId": [], - "sessionToken": [] + "User ID": [], + "Session Token": [] + } + ] + } + }, + "/servers/:server/roles/:role": { + "delete": { + "summary": "Delete Role", + "description": "Deletes a server role by ID.", + "tags": [ + "Server Permissions" + ], + "parameters": [ + { + "name": "channel", + "in": "path", + "required": true, + "description": "Channel ID", + "schema": { + "$ref": "#/definitions/Id" + } + }, + { + "name": "role", + "in": "path", + "required": true, + "description": "Role ID", + "schema": { + "$ref": "#/definitions/Id" + } + } + ], + "responses": { + "200": { + "description": "Successfully deleted role." + } + }, + "security": [ + { + "User ID": [], + "Session Token": [] } ] } @@ -9814,22 +4508,22 @@ ] }, "_id": { - "description": "Id", + "description": "Invite Code", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" }, "server": { - "description": "Id", + "description": "ID of the server this invite is for.", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" }, "creator": { - "description": "Id", + "description": "ID of the user who created this invite.", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" }, "channel": { - "description": "Id", + "description": "ID of the channel this invite is for.", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" } @@ -9865,22 +4559,22 @@ ] }, "_id": { - "description": "Id", + "description": "Invite Code", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" }, "server": { - "description": "Id", + "description": "ID of the server this invite is for.", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" }, "creator": { - "description": "Id", + "description": "ID of the user who created this invite.", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" }, "channel": { - "description": "Id", + "description": "ID of the channel this invite is for.", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" } @@ -11234,24 +5928,33 @@ "type": "string" }, "nonce": { + "description": "Nonce value, prefer to use ULIDs here for better feature support.\n\nUsed to prevent double requests to create objects.", + "minLength": 1, + "maxLength": 36, "type": "string" }, "owner": { + "description": "User ID of server owner", + "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", "type": "string" }, "name": { + "description": "Server name", "type": "string" }, "description": { + "description": "Server description", "type": "string" }, "channels": { + "description": "Array of server channel IDs", "type": "array", "items": { "type": "string" } }, "categories": { + "description": "Array of server categories", "type": "array", "items": { "type": "object", @@ -11279,6 +5982,7 @@ } }, "system_messages": { + "description": "System message channels\n\nEach type of system message will be sent into the respective channel ID.", "type": "object", "properties": { "user_joined": { @@ -11304,6 +6008,7 @@ } }, "roles": { + "description": "Server roles", "type": "object", "additionalProperties": { "type": "object", @@ -11336,7 +6041,7 @@ } }, "default_permissions": { - "description": "Tuple consisting of server and channel permissions in that order", + "description": "Default permissions for all members", "type": "array", "items": [ { @@ -11350,6 +6055,7 @@ "maxItems": 2 }, "icon": { + "description": "Server icon", "type": "object", "properties": { "_id": { @@ -11475,6 +6181,7 @@ ] }, "banner": { + "description": "Server banner", "type": "object", "properties": { "_id": { @@ -12443,54 +7150,6 @@ } } }, - "JoinData": { - "type": "object", - "properties": { - "token": { - "description": "Voso Token", - "type": "string" - } - }, - "required": [ - "token" - ], - "definitions": { - "AttachmentTag": { - "description": "Attachment tag", - "enum": [ - "attachments", - "avatars", - "backgrounds", - "banners", - "icons" - ], - "type": "string" - }, - "RelationshipStatus": { - "description": "Your relationship with the user", - "enum": [ - "Blocked", - "BlockedOther", - "Friend", - "Incoming", - "None", - "Outgoing", - "User" - ], - "type": "string" - }, - "Presence": { - "description": "User presence", - "enum": [ - "Busy", - "Idle", - "Invisible", - "Online" - ], - "type": "string" - } - } - }, "Id": { "description": "Id", "pattern": "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}", @@ -12625,13 +7284,13 @@ ], "components": { "securitySchemes": { - "userId": { + "User ID": { "type": "apiKey", "in": "header", "name": "x-user-id", "description": "User ID is found when calling `/auth/login`.\n" }, - "sessionToken": { + "Session Token": { "type": "apiKey", "in": "header", "name": "x-session-token", diff --git a/README.md b/README.md new file mode 100644 index 0000000..ff8e79d --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Revolt API + +### Tip + +For faster compile times when working on API routes, comment out the categories you don't care about. + +```ts +// src/routes/index.ts +export async function load() { + // await import('./core.js'); + // await import('./users.js'); + // await import('./channels.js'); + await import('./servers.js'); +} + +await load(); +``` diff --git a/src/index.ts b/src/index.ts index b0a5afa..87384c7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,13 +28,13 @@ async function generate(): Promise { ], components: { securitySchemes: { - userId: { + 'User ID': { type: "apiKey", in: "header", name: "x-user-id", description: "User ID is found when calling `/auth/login`.\n" }, - sessionToken: { + 'Session Token': { type: "apiKey", in: "header", name: "x-session-token", diff --git a/src/openapi/definitions.ts b/src/openapi/definitions.ts index 71acb0c..11dbd5b 100644 --- a/src/openapi/definitions.ts +++ b/src/openapi/definitions.ts @@ -13,10 +13,12 @@ export default async function() { let definitions: { [key: string]: TJS.Definition } = {}; for (let type of types) { - const defn = generator?.getSchemaForSymbol(type); - if (defn) { - definitions[type] = await convert(defn); - } + try { + const defn = generator.getSchemaForSymbol(type); + if (defn) { + definitions[type] = await convert(defn); + } + } catch (err) {} } return definitions; diff --git a/src/openapi/paths.ts b/src/openapi/paths.ts index cfca7ed..c32c1aa 100644 --- a/src/openapi/paths.ts +++ b/src/openapi/paths.ts @@ -55,8 +55,8 @@ export function routeAuthenticated(summary: string, description: string, obj: Om ...route(summary, description, obj), security: [ { - userId: [], - sessionToken: [] + 'User ID': [], + 'Session Token': [] } ] } diff --git a/src/routes/channels.ts b/src/routes/channels.ts index 064d9de..4db2093 100644 --- a/src/routes/channels.ts +++ b/src/routes/channels.ts @@ -34,14 +34,18 @@ resource('/channels/:channel', { import type { Status } from './Users'; import type { AutumnId } from './_common'; - interface ${'EditChannels'} { + interface ${'EditChannel'} { /** * Channel name + * @minLength 1 + * @maxLength 32 **/ name: string; /** * Channel description + * @minLength 0 + * @maxLength 1024 **/ description?: string; @@ -59,7 +63,10 @@ resource('/channels/:channel', { delete: routeAuthenticated( "Close Channel", "Deletes a server channel, leaves a group or closes a DM.", - await success("Deleted Channel") + { + ...channelParams, + ...await success("Deleted Channel") + } ) }); //#endregion diff --git a/src/routes/index.ts b/src/routes/index.ts index a43e906..f254835 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -2,6 +2,7 @@ export async function load() { await import('./core.js'); await import('./users.js'); await import('./channels.js'); + await import('./servers.js'); } await load(); diff --git a/src/routes/servers.ts b/src/routes/servers.ts new file mode 100644 index 0000000..327d044 --- /dev/null +++ b/src/routes/servers.ts @@ -0,0 +1,407 @@ +import { body, parameter, ref, success } from "../openapi/generators.js"; +import { group, resource, route, routeAuthenticated, tag } from "../openapi/paths.js"; +import { schema } from "../typescript.js"; + +group("Servers"); + +//#region Server Information +tag("Server Information", "Query and fetch servers on Revolt"); + +const serverParams = { + parameters: [ + await parameter('server', 'Server ID', ref("Id")) + ] +} + +resource('/servers/:server', { + get: routeAuthenticated( + "Fetch Server", + "Retrieve a server.", + { + ...serverParams, + ...await success( + "Retrieved server.", + ref("Server") + ) + } + ), + patch: routeAuthenticated( + "Edit Server", + "Edit a server object.", + { + ...serverParams, + ...await body("Requested changes to server object.", schema` + import type { Category, SystemMessageChannels } from './Servers'; + import type { AutumnId } from './_common'; + + interface ${'EditServer'} { + /** + * Server name + * @minLength 1 + * @maxLength 32 + **/ + name: string; + + /** + * Server description + * @minLength 0 + * @maxLength 1024 + **/ + description?: string; + + icon?: AutumnId; + + banner?: AutumnId; + + /** + * Server categories + */ + categories?: Category[]; + + /** + * System message channels + */ + system_messages?: SystemMessageChannels; + + /** + * Field to remove from channel object + */ + remove?: 'Icon' | 'Banner' | 'Description'; + } + `), + ...await success("Succesfully changed channel object.") + } + ), + delete: routeAuthenticated( + "Delete / Leave Server", + "Deletes a server if owner otherwise leaves.", + { + ...serverParams, + ...await success("Deleted Server") + } + ) +}); + +resource('/servers/create', { + post: routeAuthenticated( + "Create Server", + "Create a new server.", + { + ...await body("Server Data", schema` + import { Id, Nonce } from './_common'; + + interface ${'ServerData'} { + /** + * Group name + * @minLength 1 + * @maxLength 32 + */ + name: string; + + /** + * Group description + * @minLength 0 + * @maxLength 1024 + */ + description?: string; + + nonce: Nonce; + } + `), + ...await success('Server', ref("Server")) + } + ) +}); + +resource('/servers/:server/channels', { + post: routeAuthenticated( + "Create Channel", + "Create a new Text or Voice channel.", + { + ...serverParams, + ...await body("Channel Data", schema` + import { Id, Nonce } from './_common'; + + interface ${'ChannelData'} { + /** + * Channel type + */ + type: 'Text' | 'Voice'; + + /** + * Channel name + * @minLength 1 + * @maxLength 32 + */ + name: string; + + /** + * Channel description + * @minLength 0 + * @maxLength 1024 + */ + description?: string; + + nonce: Nonce; + } + `), + ...success("Channel", ref("Channel")) + } + ) +}); + +resource('/servers/:server/invites', { + get: routeAuthenticated( + "Fetch Invites", + "Fetch all server invites.", + { + ...serverParams, + ...success("Server Invites", schema` + import { Id } from './_common'; + + type ${'ServerInvites'} = { + /** + * Invite Code + */ + code: string; + + /** + * ID of the user who created this invite. + */ + creator: Id; + + /** + * ID of the channel this invite is for. + */ + channel: Id; + } + `) + } + ) +}); +//#endregion + +//#region Server Members +tag("Server Members", "Find and edit server members"); + +const memberParams = { + parameters: [ + await parameter('server', 'Server ID', ref("Id")), + await parameter('member', 'Member ID', ref("Id")) + ] +} + +resource('/servers/:server/members/:member', { + get: routeAuthenticated( + "Fetch Member", + "Retrieve a member.", + { + ...memberParams, + ...await success( + "Retrieved member.", + ref("Member") + ) + } + ), + patch: routeAuthenticated( + "Edit Member", + "Edit a member object.", + { + ...serverParams, + ...await body("Requested changes to server object.", schema` + import type { AutumnId, Id } from './_common'; + + interface ${'EditMember'} { + /** + * Member nickname + * @minLength 1 + * @maxLength 32 + **/ + nickname: string; + + avatar?: AutumnId; + + /** + * Array of role IDs + */ + roles?: Id[]; + + /** + * Field to remove from channel object + */ + remove?: 'Nickname' | 'Avatar'; + } + `), + ...await success("Succesfully changed member object.") + } + ), + delete: routeAuthenticated( + "Kick Member", + "Removes a member from the server.", + await success("Removed Member") + ) +}); + +resource('/servers/:server/members', { + get: route( + "Fetch Members", + "Fetch all server members.", + { + ...serverParams, + ...await success( + "Server Members", + schema` + import { Member } from './Servers'; + import { User } from './Users'; + + interface ${'ServerMembers'} { + members: Member[], + users: User[] + } + ` + ) + } + ) +}); + +resource('/servers/:server/bans/:member', { + put: routeAuthenticated( + "Ban User", + "Ban a user by their ID.", + { + ...memberParams, + ...await body("Ban Data", schema` + interface ${'BanData'} { + /** + * Ban reason + * @minLength 1 + * @maxLength 1024 + */ + reason?: string + } + `), + ...await success("Banned user.") + } + ), + delete: routeAuthenticated( + "Unban User", + "Removes a user's ban.", + { + ...memberParams, + ...await success("Unbanned user.") + } + ) +}); + +resource('/servers/:server/bans', { + get: routeAuthenticated( + "Fetch Bans", + "Fetch all bans on server.", + { + ...serverParams, + ...await success("Bans", schema` + import { Ban } from './Servers'; + type ${'ServerBans'} = Ban[]; + `) + } + ) +}); +//#endregion + +//#region Server Permissions +tag("Server Permissions", "Manage permissions for servers"); + +const roleParams = { + parameters: [ + await parameter('channel', 'Channel ID', ref("Id")), + await parameter('role', 'Role ID', ref("Id")) + ] +} + +const serverPermissions = await body("Server Permissions", schema` + interface ${'ServerPermissions'} { + /** + * Permission values + */ + permissions: { + /** + * Server permission + */ + server: number, + + /** + * Channel permission + */ + channel: number + } + } +`) + +resource('/servers/:server/permissions/:role', { + put: routeAuthenticated( + "Set Role Permission", + "Sets permissions for the specified role in this server.", + { + ...roleParams, + ...serverPermissions, + ...await success("Successfully updated permissions.") + } + ) +}); + +resource('/servers/:server/permissions/default', { + put: routeAuthenticated( + "Set Default Permission", + "Sets permissions for the default role in this server.", + { + ...serverParams, + ...serverPermissions, + ...await success("Successfully updated permissions.") + } + ) +}); + +resource('/servers/:server/roles', { + post: routeAuthenticated( + "Create Role", + "Creates a new server role.", + { + ...serverParams, + ...await body("Role Data", schema` + interface ${'RoleData'} { + /** + * Role name + * @minLength 1 + * @maxLength 32 + */ + name: string; + } + `), + ...await success("New Role", schema` + import { Id } from './_common'; + import { PermissionTuple } from './Servers'; + + interface ${'NewRole'} { + /** + * Role ID + */ + id: Id; + + permissions: PermissionTuple; + } + `) + } + ) +}); + +resource('/servers/:server/roles/:role', { + delete: routeAuthenticated( + "Delete Role", + "Deletes a server role by ID.", + { + ...roleParams, + ...await success("Successfully deleted role.") + } + ) +}); +//#endregion diff --git a/tsconfig.tsbuildinfo b/tsconfig.tsbuildinfo index 8b1ab2b..03b933a 100644 --- a/tsconfig.tsbuildinfo +++ b/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"program":{"fileNames":["./node_modules/typescript/lib/lib.es5.d.ts","./node_modules/typescript/lib/lib.es2015.d.ts","./node_modules/typescript/lib/lib.es2016.d.ts","./node_modules/typescript/lib/lib.es2017.d.ts","./node_modules/typescript/lib/lib.es2018.d.ts","./node_modules/typescript/lib/lib.es2019.d.ts","./node_modules/typescript/lib/lib.es2020.d.ts","./node_modules/typescript/lib/lib.dom.d.ts","./node_modules/typescript/lib/lib.dom.iterable.d.ts","./node_modules/typescript/lib/lib.webworker.importscripts.d.ts","./node_modules/typescript/lib/lib.scripthost.d.ts","./node_modules/typescript/lib/lib.es2015.core.d.ts","./node_modules/typescript/lib/lib.es2015.collection.d.ts","./node_modules/typescript/lib/lib.es2015.generator.d.ts","./node_modules/typescript/lib/lib.es2015.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.promise.d.ts","./node_modules/typescript/lib/lib.es2015.proxy.d.ts","./node_modules/typescript/lib/lib.es2015.reflect.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2016.array.include.d.ts","./node_modules/typescript/lib/lib.es2017.object.d.ts","./node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2017.string.d.ts","./node_modules/typescript/lib/lib.es2017.intl.d.ts","./node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","./node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","./node_modules/typescript/lib/lib.es2018.intl.d.ts","./node_modules/typescript/lib/lib.es2018.promise.d.ts","./node_modules/typescript/lib/lib.es2018.regexp.d.ts","./node_modules/typescript/lib/lib.es2019.array.d.ts","./node_modules/typescript/lib/lib.es2019.object.d.ts","./node_modules/typescript/lib/lib.es2019.string.d.ts","./node_modules/typescript/lib/lib.es2019.symbol.d.ts","./node_modules/typescript/lib/lib.es2020.bigint.d.ts","./node_modules/typescript/lib/lib.es2020.promise.d.ts","./node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2020.string.d.ts","./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2020.intl.d.ts","./node_modules/typescript/lib/lib.esnext.intl.d.ts","./node_modules/typescript/lib/lib.es2020.full.d.ts","./node_modules/openapi-types/dist/index.d.ts","./node_modules/typescript-json-schema/node_modules/typescript/lib/typescript.d.ts","./node_modules/@types/json-schema/index.d.ts","./node_modules/typescript-json-schema/dist/typescript-json-schema.d.ts","./src/openapi/info.ts","./node_modules/@openapi-contrib/json-schema-to-openapi-schema/index.d.ts","./src/typescript.ts","./src/openapi/definitions.ts","./src/openapi/paths.ts","./src/openapi/generators.ts","./src/routes/core.ts","./src/routes/users.ts","./src/routes/channels.ts","./src/routes/index.ts","./src/index.ts","./node_modules/@types/node/globals.d.ts","./node_modules/@types/node/async_hooks.d.ts","./node_modules/@types/node/buffer.d.ts","./node_modules/@types/node/child_process.d.ts","./node_modules/@types/node/cluster.d.ts","./node_modules/@types/node/console.d.ts","./node_modules/@types/node/constants.d.ts","./node_modules/@types/node/crypto.d.ts","./node_modules/@types/node/dgram.d.ts","./node_modules/@types/node/dns.d.ts","./node_modules/@types/node/domain.d.ts","./node_modules/@types/node/events.d.ts","./node_modules/@types/node/fs.d.ts","./node_modules/@types/node/fs/promises.d.ts","./node_modules/@types/node/http.d.ts","./node_modules/@types/node/http2.d.ts","./node_modules/@types/node/https.d.ts","./node_modules/@types/node/inspector.d.ts","./node_modules/@types/node/module.d.ts","./node_modules/@types/node/net.d.ts","./node_modules/@types/node/os.d.ts","./node_modules/@types/node/path.d.ts","./node_modules/@types/node/perf_hooks.d.ts","./node_modules/@types/node/process.d.ts","./node_modules/@types/node/punycode.d.ts","./node_modules/@types/node/querystring.d.ts","./node_modules/@types/node/readline.d.ts","./node_modules/@types/node/repl.d.ts","./node_modules/@types/node/stream.d.ts","./node_modules/@types/node/string_decoder.d.ts","./node_modules/@types/node/timers.d.ts","./node_modules/@types/node/tls.d.ts","./node_modules/@types/node/trace_events.d.ts","./node_modules/@types/node/tty.d.ts","./node_modules/@types/node/url.d.ts","./node_modules/@types/node/util.d.ts","./node_modules/@types/node/v8.d.ts","./node_modules/@types/node/vm.d.ts","./node_modules/@types/node/worker_threads.d.ts","./node_modules/@types/node/zlib.d.ts","./node_modules/@types/node/globals.global.d.ts","./node_modules/@types/node/wasi.d.ts","./node_modules/@types/node/ts3.6/base.d.ts","./node_modules/@types/node/assert.d.ts","./node_modules/@types/node/base.d.ts","./node_modules/@types/node/index.d.ts","./node_modules/@types/normalize-package-data/index.d.ts","./node_modules/@types/urijs/dom-monkeypatch.d.ts","./node_modules/@types/urijs/index.d.ts"],"fileInfos":[{"version":"ac3a8c4040e183ce38da69d23b96939112457d1936198e6542672b7963cf0fce","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"1dad4fe1561d99dfd6709127608b99a76e5c2643626c800434f99c48038567ee","affectsGlobalScope":true},{"version":"a8fe23ae87c3e9d2877032cafeb290f2ebe0c51e216d175a0408b10915ebe9f0","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"cce43d02223f8049864f8568bed322c39424013275cd3bcc3f51492d8b546cb3","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"8dff1b4c2df638fcd976cbb0e636f23ab5968e836cd45084cc31d47d1ab19c49","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"8f4c9f651c8294a2eb1cbd12581fe25bfb901ab1d474bb93cd38c7e2f4be7a30","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"60761e6ea886034af0f294f025a7199360ce4e2c8ba4ec6408bc049cf9b89799","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"506b80b9951c9381dc5f11897b31fca5e2a65731d96ddefa19687fbc26b23c6e","affectsGlobalScope":true},"f58c6d0669d1ee04b2fcb0e87fb949b6828602f3f29c7bf6c76a214f16fd50d5","22f7331ced6368f3c0e43b28037b821cfbbfc2e92ed0c2ca852b1911c94f09c2","b4e3edb529b83431180aba7ea2d39302afe8919962344db98d71fe0253951b62","a185ebc69c9f6798ebd67bfdfd72a37457dc67c23459784783c7128ae9bd5250","6f6cd024262d1f27ccd61c1da510875b18ce4b64ab4df6aca845f09b482c6353",{"version":"e4582c5cb6645d68edeaf060b51c069302fe3ad2c6985dda4efe2e43789fdc87","signature":"fe0d8a53cf3de50ece9b12859abc312631b44303c0791a23b29e0d4ea370ee2e"},"d28688041fc3686eb9842d1e2a883ec9af6a0d983ac3a969f22a264319612fa9","977756569c123972466f369e2bed001330ddbcf98e1e1c8fb1ad8f59205aa984",{"version":"6c0e70e7f91887eb669a71d97950fb2e633ccacef74aaf17f896e35986715120","signature":"3e512af78903190c7dd84cdb8e306bd3cb350a37f9b4cd27c8d7bea5b8a5d758"},{"version":"60ab16ff77f9a7351ad9863d904661526ac17f494d569420cf8767a5a49e92f4","signature":"54b322ddd515eaed558f0c9915ad0b9d90069722ca6e53c42959a985c19d2a64"},{"version":"1bed1f694295b6adec93ab3e065c9ff21f841ff0804c7d9ee841bdaeb49ffaa3","signature":"971c879b0ef703441b33a4577083ebdac085158f8e7c502b3d222cb432655ef5"},{"version":"990a8011272b92e9b750e4f6bc0699c2c7d28b61d60be1908c10ae2e1d11bcee","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"2f1cf450f1a04cbe8cf48edbf9c664f4851d651c6975fcf6fc74a2c6fbe9be64","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"87892f8d3f8ab9ec3e77fd172302b1d68fb1edb1f854f7123676849c9559b7f7","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"014742176f4a6602766c7c4074a37c3a654bad0b79dd1d76ed4904a6d4c4373c","signature":"c8844ed00e939d6bf966ee18a2e870f4029d61ee8505119d8ff260c28fcbd305"},{"version":"490c94a41844f37ed6ef71a196956cfe148b1237d9974cf09d6dda3eba6aa37b","signature":"57293441f7fc6659e400b0585c14b94a8930ae37ba37831b0a7c9f849c266708"},{"version":"3e432cdf56538889e5742d388cdf03d670bfb17f4547dbbb1daf90701ec790d5","affectsGlobalScope":true},"85d545d430795d54a8b2896f67f9aeb7bf19fd74a1469ae0627311eb72f0dfa2","a473cf45c3d9809518f8af913312139d9f4db6887dc554e0d06d0f4e52722e6b","55cb77e6ff3d95a68568446f53d3f1dc8fca753575d7c60471a865685f08dcc3","3d68ecf05475492f041c88395372c3a01b30351619bebcd38287ab185be7f7e4",{"version":"36c956a3a6dc279f1e6b77aa4b97b7b229b7d828102573ef5002de456ff5e1d9","affectsGlobalScope":true},"45ac321f2e15d268fd74a90ddaa6467dcaaff2c5b13f95b4b85831520fb7a491","6e8b894365ab993dbb55c58542598d1548fdda072c974f98b89c218891e2ba09","ddd6169dff8e5263397a9399ba7ba92521d3959f8f9dcdc27f24403dc7b751ba","508e1e25ca40ea6cde332d3232c826fcd82f456f45ae535d817754684f048f9e",{"version":"2866a528b2708aa272ec3eaafd3c980abb23aec1ef831cfc5eb2186b98c37ce5","affectsGlobalScope":true},{"version":"8f8f6ee2a0c94077f79439f51640a625ac7e2f5dd6866bd3b5a41705c836adfc","affectsGlobalScope":true},"dda27180d5ff550ace8378f5df0f7a26e616f0c4e310c77e94329e2355f9c255","839421b494b57cd2bc0074e914130277051850eba6def6c25870056e6652640b","12a01de318341fefb7be11f22eb4bf28478a5f137b1b4546c509156e9c158198","88587b5c94b0c4f5d78026e4beeb93383b3933c860d9840b55d6bf47d7b632bb","5aa2a9a778a055cd668ea419ea80ba6e195210eb37d47707a1a58886aa4d80f0","9e8947666e44137405fd378f3a8a0515a492e967e552406c02b991c98c78fc61","0cff7901aedfe78e314f7d44088f07e2afa1b6e4f0473a4169b8456ca2fb245d","9e6a556cf660a94faa51f5bce6ed009b9e02373546a4c67925da909f36c039d0","69640cc2e76dad52daeb9914e6b70c5c9a5591a3a65190a2d3ea432cf0015e16","a39a4c527b7a2dc7a2661b711a534c10c76852c5ad6ae320767d3f7d2621b67d","1bb5c9857b2ee32c199dd85bc0f4c0299112485d6e5dc91428eabfdee0dbd68c",{"version":"61dd09b57a0a5cf1486c3ceb3a18ad23babfe602c323035ce3d01544c5e3e0b6","affectsGlobalScope":true},"7f77304372efe3c9967e5f9ea2061f1b4bf41dc3cda3c83cdd676f2e5af6b7e6","662661bbf9ccd869f3bca82d34234b2abdc95c657e2187c35352d42dddb24c2d","5caa645cc390a0a8d5a031072b6b4e49218c17017cd80a63bd2557b19be13c5f","4c4334eb5d8fae83416a361d787b55a5743916aed8af812a909898bc7333e709","352104835f5c468c7d8a277f2c8c02fac239a37cd2293181fe421faa153878d3","4fd3c4debadce3e9ab9dec3eb45f7f5e2e3d4ad65cf975a6d938d883cfb25a50","0953427f9c2498f71dd912fdd8a81b19cf6925de3e1ad67ab9a77b9a0f79bf0b","a4aa075328fe61190b8547e74fae18179591a67fedb2ad274c63044a00716743","7df562288f949945cf69c21cd912100c2afedeeb7cdb219085f7f4b46cb7dde4","9d16690485ff1eb4f6fc57aebe237728fd8e03130c460919da3a35f4d9bd97f5","40c6ed5dc58e1c6afa7dcd23b1697bf290cc5b1170c63d0a4dd12f52aa39291c","71d6da3b0150ecdcd16c08b3b546fe4cc7f53df642eccfeb03c813ee788fae0c","a364b4a8a015ae377052fa4fac94204d79a69d879567f444c7ceff1b7a18482d","c5ec3b97d9db756c689cd11f4a11eaa9e6077b2768e3e9b54ff727a93c03a909","bdb07038733b2d74a75ba9c381dcb92774cd6f161ee125bfa921eae7d883ccc9","ad93e960a3a07dff7394bf0c8a558006a9ff2d0725ab28fc33dec227d4cb251e",{"version":"2708349d5a11a5c2e5f3a0765259ebe7ee00cdcc8161cb9990cb4910328442a1","affectsGlobalScope":true},"c14e9e86f18189c7d32b5dd03b4cf3f40bed68f0509dec06d75d41b82c065fe2","ae68a04912ee5a0f589276f9ec60b095f8c40d48128a4575b3fdd7d93806931c","d555cd63a3fc837840db192596273fdf52fb28092b0a33bec98e89a0334b3a4c","e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","49daf80661034e07d919f1c716aef69324e34d18a63a282f8100f52c961b58a7","6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a",{"version":"159733de19927f949b83112a45b7c52ebc0bbad1605a668d5c19ba65e0ee9128","affectsGlobalScope":true},{"version":"8445addb196de41a30b99f3c6ceeb45213f459fcbf7beb01b1f435f75fcdceff","affectsGlobalScope":true}],"options":{"esModuleInterop":true,"module":99,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"strict":true,"target":7},"fileIdsList":[[101,102],[70,71,78,87],[62,70,78],[94],[66,71,79],[87],[68,70,78],[70],[70,72,87,93],[71],[78,87,93],[70,71,73,78,87,90,93],[73,90,93],[103],[93],[68,70,87],[60],[92],[85,94,96],[78],[59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100],[84],[70,72,87,93,96],[106],[45,46],[44,47,48,51,52,57,72],[47,49,50,71],[44],[44,72],[50,52,53],[54,55,56],[47,49,71,80],[57],[47]],"referencedMap":[[103,1],[62,2],[63,3],[64,4],[65,5],[66,6],[67,7],[69,8],[70,8],[71,9],[72,10],[73,11],[74,12],[75,13],[104,14],[76,8],[77,15],[78,16],[81,17],[82,18],[85,8],[86,19],[87,8],[90,20],[101,21],[92,20],[93,22],[95,6],[97,23],[98,6],[107,24],[47,25],[58,26],[51,27],[53,28],[48,29],[52,28],[56,30],[54,30],[57,31],[55,30],[50,32]],"exportedModulesMap":[[103,1],[62,2],[63,3],[64,4],[65,5],[66,6],[67,7],[69,8],[70,8],[71,9],[72,10],[73,11],[74,12],[75,13],[104,14],[76,8],[77,15],[78,16],[81,17],[82,18],[85,8],[86,19],[87,8],[90,20],[101,21],[92,20],[93,22],[95,6],[97,23],[98,6],[107,24],[47,25],[58,33],[51,34],[53,28],[48,28],[52,28],[50,32]],"semanticDiagnosticsPerFile":[49,46,102,60,103,61,62,63,64,65,66,67,68,69,70,71,72,59,99,73,74,75,104,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,101,92,93,94,95,96,100,97,98,105,106,107,44,47,45,8,9,13,12,2,14,15,16,17,18,19,20,21,3,4,25,22,23,24,26,27,28,5,29,30,31,32,6,33,34,35,36,7,43,41,37,38,39,40,1,42,11,10,58,51,53,48,52,56,54,57,55,50]},"version":"4.3.5"} \ No newline at end of file +{"program":{"fileNames":["./node_modules/typescript/lib/lib.es5.d.ts","./node_modules/typescript/lib/lib.es2015.d.ts","./node_modules/typescript/lib/lib.es2016.d.ts","./node_modules/typescript/lib/lib.es2017.d.ts","./node_modules/typescript/lib/lib.es2018.d.ts","./node_modules/typescript/lib/lib.es2019.d.ts","./node_modules/typescript/lib/lib.es2020.d.ts","./node_modules/typescript/lib/lib.dom.d.ts","./node_modules/typescript/lib/lib.dom.iterable.d.ts","./node_modules/typescript/lib/lib.webworker.importscripts.d.ts","./node_modules/typescript/lib/lib.scripthost.d.ts","./node_modules/typescript/lib/lib.es2015.core.d.ts","./node_modules/typescript/lib/lib.es2015.collection.d.ts","./node_modules/typescript/lib/lib.es2015.generator.d.ts","./node_modules/typescript/lib/lib.es2015.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.promise.d.ts","./node_modules/typescript/lib/lib.es2015.proxy.d.ts","./node_modules/typescript/lib/lib.es2015.reflect.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2016.array.include.d.ts","./node_modules/typescript/lib/lib.es2017.object.d.ts","./node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2017.string.d.ts","./node_modules/typescript/lib/lib.es2017.intl.d.ts","./node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","./node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","./node_modules/typescript/lib/lib.es2018.intl.d.ts","./node_modules/typescript/lib/lib.es2018.promise.d.ts","./node_modules/typescript/lib/lib.es2018.regexp.d.ts","./node_modules/typescript/lib/lib.es2019.array.d.ts","./node_modules/typescript/lib/lib.es2019.object.d.ts","./node_modules/typescript/lib/lib.es2019.string.d.ts","./node_modules/typescript/lib/lib.es2019.symbol.d.ts","./node_modules/typescript/lib/lib.es2020.bigint.d.ts","./node_modules/typescript/lib/lib.es2020.promise.d.ts","./node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2020.string.d.ts","./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2020.intl.d.ts","./node_modules/typescript/lib/lib.esnext.intl.d.ts","./node_modules/typescript/lib/lib.es2020.full.d.ts","./node_modules/openapi-types/dist/index.d.ts","./node_modules/typescript-json-schema/node_modules/typescript/lib/typescript.d.ts","./node_modules/@types/json-schema/index.d.ts","./node_modules/typescript-json-schema/dist/typescript-json-schema.d.ts","./src/openapi/info.ts","./node_modules/@openapi-contrib/json-schema-to-openapi-schema/index.d.ts","./src/typescript.ts","./src/openapi/definitions.ts","./src/openapi/paths.ts","./src/openapi/generators.ts","./src/routes/core.ts","./src/routes/users.ts","./src/routes/channels.ts","./src/routes/servers.ts","./src/routes/index.ts","./src/index.ts","./node_modules/@types/node/globals.d.ts","./node_modules/@types/node/async_hooks.d.ts","./node_modules/@types/node/buffer.d.ts","./node_modules/@types/node/child_process.d.ts","./node_modules/@types/node/cluster.d.ts","./node_modules/@types/node/console.d.ts","./node_modules/@types/node/constants.d.ts","./node_modules/@types/node/crypto.d.ts","./node_modules/@types/node/dgram.d.ts","./node_modules/@types/node/dns.d.ts","./node_modules/@types/node/domain.d.ts","./node_modules/@types/node/events.d.ts","./node_modules/@types/node/fs.d.ts","./node_modules/@types/node/fs/promises.d.ts","./node_modules/@types/node/http.d.ts","./node_modules/@types/node/http2.d.ts","./node_modules/@types/node/https.d.ts","./node_modules/@types/node/inspector.d.ts","./node_modules/@types/node/module.d.ts","./node_modules/@types/node/net.d.ts","./node_modules/@types/node/os.d.ts","./node_modules/@types/node/path.d.ts","./node_modules/@types/node/perf_hooks.d.ts","./node_modules/@types/node/process.d.ts","./node_modules/@types/node/punycode.d.ts","./node_modules/@types/node/querystring.d.ts","./node_modules/@types/node/readline.d.ts","./node_modules/@types/node/repl.d.ts","./node_modules/@types/node/stream.d.ts","./node_modules/@types/node/string_decoder.d.ts","./node_modules/@types/node/timers.d.ts","./node_modules/@types/node/tls.d.ts","./node_modules/@types/node/trace_events.d.ts","./node_modules/@types/node/tty.d.ts","./node_modules/@types/node/url.d.ts","./node_modules/@types/node/util.d.ts","./node_modules/@types/node/v8.d.ts","./node_modules/@types/node/vm.d.ts","./node_modules/@types/node/worker_threads.d.ts","./node_modules/@types/node/zlib.d.ts","./node_modules/@types/node/globals.global.d.ts","./node_modules/@types/node/wasi.d.ts","./node_modules/@types/node/ts3.6/base.d.ts","./node_modules/@types/node/assert.d.ts","./node_modules/@types/node/base.d.ts","./node_modules/@types/node/index.d.ts","./node_modules/@types/normalize-package-data/index.d.ts","./node_modules/@types/urijs/dom-monkeypatch.d.ts","./node_modules/@types/urijs/index.d.ts"],"fileInfos":[{"version":"ac3a8c4040e183ce38da69d23b96939112457d1936198e6542672b7963cf0fce","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"1dad4fe1561d99dfd6709127608b99a76e5c2643626c800434f99c48038567ee","affectsGlobalScope":true},{"version":"a8fe23ae87c3e9d2877032cafeb290f2ebe0c51e216d175a0408b10915ebe9f0","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"cce43d02223f8049864f8568bed322c39424013275cd3bcc3f51492d8b546cb3","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"8dff1b4c2df638fcd976cbb0e636f23ab5968e836cd45084cc31d47d1ab19c49","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"8f4c9f651c8294a2eb1cbd12581fe25bfb901ab1d474bb93cd38c7e2f4be7a30","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"60761e6ea886034af0f294f025a7199360ce4e2c8ba4ec6408bc049cf9b89799","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"506b80b9951c9381dc5f11897b31fca5e2a65731d96ddefa19687fbc26b23c6e","affectsGlobalScope":true},"f58c6d0669d1ee04b2fcb0e87fb949b6828602f3f29c7bf6c76a214f16fd50d5","22f7331ced6368f3c0e43b28037b821cfbbfc2e92ed0c2ca852b1911c94f09c2","b4e3edb529b83431180aba7ea2d39302afe8919962344db98d71fe0253951b62","a185ebc69c9f6798ebd67bfdfd72a37457dc67c23459784783c7128ae9bd5250","6f6cd024262d1f27ccd61c1da510875b18ce4b64ab4df6aca845f09b482c6353",{"version":"e4582c5cb6645d68edeaf060b51c069302fe3ad2c6985dda4efe2e43789fdc87","signature":"fe0d8a53cf3de50ece9b12859abc312631b44303c0791a23b29e0d4ea370ee2e"},"d28688041fc3686eb9842d1e2a883ec9af6a0d983ac3a969f22a264319612fa9","977756569c123972466f369e2bed001330ddbcf98e1e1c8fb1ad8f59205aa984",{"version":"143a4a0a74f7852f9771e73509241576eab30cd484fc6081e1740247a02d4b1b","signature":"3e512af78903190c7dd84cdb8e306bd3cb350a37f9b4cd27c8d7bea5b8a5d758"},{"version":"e1b0d33c567c4fe88a1a381d8a3fd30f17e1b9d149b60e63dea2e5d754ab8f75","signature":"54b322ddd515eaed558f0c9915ad0b9d90069722ca6e53c42959a985c19d2a64"},{"version":"1bed1f694295b6adec93ab3e065c9ff21f841ff0804c7d9ee841bdaeb49ffaa3","signature":"971c879b0ef703441b33a4577083ebdac085158f8e7c502b3d222cb432655ef5"},{"version":"990a8011272b92e9b750e4f6bc0699c2c7d28b61d60be1908c10ae2e1d11bcee","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"2f1cf450f1a04cbe8cf48edbf9c664f4851d651c6975fcf6fc74a2c6fbe9be64","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"99ee500de9cc0de7d16688043e789dbc077d97c93f56c339b677dd07314b2e4c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"dcf3a95eaa0cf11d8df9531be547d65cd2a99b2c6c211f82f00f2e0030f9ad73","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"97d71923d2d3502bde810564602fee58e6ae9fc9cf0d97aa003649910a1f24bd","signature":"c8844ed00e939d6bf966ee18a2e870f4029d61ee8505119d8ff260c28fcbd305"},{"version":"27775defae46f1e796930e02b2e12bdbedce7f1634fd7222626210fef9b75e3b","signature":"57293441f7fc6659e400b0585c14b94a8930ae37ba37831b0a7c9f849c266708"},{"version":"3e432cdf56538889e5742d388cdf03d670bfb17f4547dbbb1daf90701ec790d5","affectsGlobalScope":true},"85d545d430795d54a8b2896f67f9aeb7bf19fd74a1469ae0627311eb72f0dfa2","a473cf45c3d9809518f8af913312139d9f4db6887dc554e0d06d0f4e52722e6b","55cb77e6ff3d95a68568446f53d3f1dc8fca753575d7c60471a865685f08dcc3","3d68ecf05475492f041c88395372c3a01b30351619bebcd38287ab185be7f7e4",{"version":"36c956a3a6dc279f1e6b77aa4b97b7b229b7d828102573ef5002de456ff5e1d9","affectsGlobalScope":true},"45ac321f2e15d268fd74a90ddaa6467dcaaff2c5b13f95b4b85831520fb7a491","6e8b894365ab993dbb55c58542598d1548fdda072c974f98b89c218891e2ba09","ddd6169dff8e5263397a9399ba7ba92521d3959f8f9dcdc27f24403dc7b751ba","508e1e25ca40ea6cde332d3232c826fcd82f456f45ae535d817754684f048f9e",{"version":"2866a528b2708aa272ec3eaafd3c980abb23aec1ef831cfc5eb2186b98c37ce5","affectsGlobalScope":true},{"version":"8f8f6ee2a0c94077f79439f51640a625ac7e2f5dd6866bd3b5a41705c836adfc","affectsGlobalScope":true},"dda27180d5ff550ace8378f5df0f7a26e616f0c4e310c77e94329e2355f9c255","839421b494b57cd2bc0074e914130277051850eba6def6c25870056e6652640b","12a01de318341fefb7be11f22eb4bf28478a5f137b1b4546c509156e9c158198","88587b5c94b0c4f5d78026e4beeb93383b3933c860d9840b55d6bf47d7b632bb","5aa2a9a778a055cd668ea419ea80ba6e195210eb37d47707a1a58886aa4d80f0","9e8947666e44137405fd378f3a8a0515a492e967e552406c02b991c98c78fc61","0cff7901aedfe78e314f7d44088f07e2afa1b6e4f0473a4169b8456ca2fb245d","9e6a556cf660a94faa51f5bce6ed009b9e02373546a4c67925da909f36c039d0","69640cc2e76dad52daeb9914e6b70c5c9a5591a3a65190a2d3ea432cf0015e16","a39a4c527b7a2dc7a2661b711a534c10c76852c5ad6ae320767d3f7d2621b67d","1bb5c9857b2ee32c199dd85bc0f4c0299112485d6e5dc91428eabfdee0dbd68c",{"version":"61dd09b57a0a5cf1486c3ceb3a18ad23babfe602c323035ce3d01544c5e3e0b6","affectsGlobalScope":true},"7f77304372efe3c9967e5f9ea2061f1b4bf41dc3cda3c83cdd676f2e5af6b7e6","662661bbf9ccd869f3bca82d34234b2abdc95c657e2187c35352d42dddb24c2d","5caa645cc390a0a8d5a031072b6b4e49218c17017cd80a63bd2557b19be13c5f","4c4334eb5d8fae83416a361d787b55a5743916aed8af812a909898bc7333e709","352104835f5c468c7d8a277f2c8c02fac239a37cd2293181fe421faa153878d3","4fd3c4debadce3e9ab9dec3eb45f7f5e2e3d4ad65cf975a6d938d883cfb25a50","0953427f9c2498f71dd912fdd8a81b19cf6925de3e1ad67ab9a77b9a0f79bf0b","a4aa075328fe61190b8547e74fae18179591a67fedb2ad274c63044a00716743","7df562288f949945cf69c21cd912100c2afedeeb7cdb219085f7f4b46cb7dde4","9d16690485ff1eb4f6fc57aebe237728fd8e03130c460919da3a35f4d9bd97f5","40c6ed5dc58e1c6afa7dcd23b1697bf290cc5b1170c63d0a4dd12f52aa39291c","71d6da3b0150ecdcd16c08b3b546fe4cc7f53df642eccfeb03c813ee788fae0c","a364b4a8a015ae377052fa4fac94204d79a69d879567f444c7ceff1b7a18482d","c5ec3b97d9db756c689cd11f4a11eaa9e6077b2768e3e9b54ff727a93c03a909","bdb07038733b2d74a75ba9c381dcb92774cd6f161ee125bfa921eae7d883ccc9","ad93e960a3a07dff7394bf0c8a558006a9ff2d0725ab28fc33dec227d4cb251e",{"version":"2708349d5a11a5c2e5f3a0765259ebe7ee00cdcc8161cb9990cb4910328442a1","affectsGlobalScope":true},"c14e9e86f18189c7d32b5dd03b4cf3f40bed68f0509dec06d75d41b82c065fe2","ae68a04912ee5a0f589276f9ec60b095f8c40d48128a4575b3fdd7d93806931c","d555cd63a3fc837840db192596273fdf52fb28092b0a33bec98e89a0334b3a4c","e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","49daf80661034e07d919f1c716aef69324e34d18a63a282f8100f52c961b58a7","6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a",{"version":"159733de19927f949b83112a45b7c52ebc0bbad1605a668d5c19ba65e0ee9128","affectsGlobalScope":true},{"version":"8445addb196de41a30b99f3c6ceeb45213f459fcbf7beb01b1f435f75fcdceff","affectsGlobalScope":true}],"options":{"esModuleInterop":true,"module":99,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"strict":true,"target":7},"fileIdsList":[[102,103],[71,72,79,88],[63,71,79],[95],[67,72,80],[88],[69,71,79],[71],[71,73,88,94],[72],[79,88,94],[71,72,74,79,88,91,94],[74,91,94],[104],[94],[69,71,88],[61],[93],[86,95,97],[79],[60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101],[85],[71,73,88,94,97],[107],[45,46],[44,47,48,51,52,58,73],[47,49,50,72],[44],[44,73],[50,52,53],[54,55,56,57],[47,49,72,81],[58],[47]],"referencedMap":[[104,1],[63,2],[64,3],[65,4],[66,5],[67,6],[68,7],[70,8],[71,8],[72,9],[73,10],[74,11],[75,12],[76,13],[105,14],[77,8],[78,15],[79,16],[82,17],[83,18],[86,8],[87,19],[88,8],[91,20],[102,21],[93,20],[94,22],[96,6],[98,23],[99,6],[108,24],[47,25],[59,26],[51,27],[53,28],[48,29],[52,28],[56,30],[54,30],[58,31],[57,30],[55,30],[50,32]],"exportedModulesMap":[[104,1],[63,2],[64,3],[65,4],[66,5],[67,6],[68,7],[70,8],[71,8],[72,9],[73,10],[74,11],[75,12],[76,13],[105,14],[77,8],[78,15],[79,16],[82,17],[83,18],[86,8],[87,19],[88,8],[91,20],[102,21],[93,20],[94,22],[96,6],[98,23],[99,6],[108,24],[47,25],[59,33],[51,34],[53,28],[48,28],[52,28],[50,32]],"semanticDiagnosticsPerFile":[49,46,103,61,104,62,63,64,65,66,67,68,69,70,71,72,73,60,100,74,75,76,105,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,102,93,94,95,96,97,101,98,99,106,107,108,44,47,45,8,9,13,12,2,14,15,16,17,18,19,20,21,3,4,25,22,23,24,26,27,28,5,29,30,31,32,6,33,34,35,36,7,43,41,37,38,39,40,1,42,11,10,59,51,53,48,52,56,54,58,57,55,50]},"version":"4.3.5"} \ No newline at end of file diff --git a/types/Invites.ts b/types/Invites.ts index 13dd280..46ad3e6 100644 --- a/types/Invites.ts +++ b/types/Invites.ts @@ -3,9 +3,25 @@ import type { Id } from "./_common"; export type ServerInvite = { type: 'Server' + + /** + * Invite Code + */ _id: Id + + /** + * ID of the server this invite is for. + */ server: Id + + /** + * ID of the user who created this invite. + */ creator: Id + + /** + * ID of the channel this invite is for. + */ channel: Id } diff --git a/types/Servers.ts b/types/Servers.ts index e05cac2..8c46253 100644 --- a/types/Servers.ts +++ b/types/Servers.ts @@ -1,22 +1,24 @@ import type { Attachment } from './Autumn'; -import type { Id } from './_common'; +import type { Id, Nonce } from './_common'; export type MemberCompositeKey = { - server: Id, + server: Id + user: Id } export type Member = { - _id: MemberCompositeKey, + _id: MemberCompositeKey - nickname?: string, - avatar?: Attachment, + nickname?: string + + avatar?: Attachment roles?: Id[] } export type Ban = { - _id: MemberCompositeKey, + _id: MemberCompositeKey reason?: string } @@ -29,46 +31,89 @@ export type PermissionTuple = [ ] export type Role = { - name: string, - permissions: PermissionTuple, + name: string + + permissions: PermissionTuple + colour?: string } export type Category = { - id: Id, - title: string, + id: Id + + title: string + channels: string[] } export type SystemMessageChannels = { /** Channel ID where user join events should be sent */ - user_joined?: Id, + user_joined?: Id /** Channel ID where user leave events should be sent */ - user_left?: Id, + user_left?: Id /** Channel ID where user kick events should be sent */ - user_kicked?: Id, + user_kicked?: Id /** Channel ID where user ban events should be sent */ - user_banned?: Id, + user_banned?: Id } export type Server = { /** * Server ID */ - _id: Id, - nonce?: string, - owner: string, + _id: Id - name: string, - description?: string, + nonce?: Nonce - channels: string[], - categories?: Category[], - system_messages?: SystemMessageChannels, + /** + * User ID of server owner + */ + owner: Id - roles?: { [key: string]: Role }, - default_permissions: PermissionTuple, + /** + * Server name + */ + name: string - icon?: Attachment, + /** + * Server description + */ + description?: string + + /** + * Array of server channel IDs + */ + channels: Id[] + + /** + * Array of server categories + */ + categories?: Category[] + + /** + * System message channels + * + * Each type of system message will be sent into the respective channel ID. + */ + system_messages?: SystemMessageChannels + + /** + * Server roles + */ + roles?: { [key: string]: Role } + + /** + * Default permissions for all members + */ + default_permissions: PermissionTuple + + /** + * Server icon + */ + icon?: Attachment + + /** + * Server banner + */ banner?: Attachment } diff --git a/types/__temp.ts b/types/__temp.ts index 715cf53..4f26611 100644 --- a/types/__temp.ts +++ b/types/__temp.ts @@ -1,8 +1,28 @@ - interface JoinData { + import type { Status } from './Users'; + import type { AutumnId } from './_common'; + + interface EditUser { + status?: Status; + /** - * Voso Token + * User profile data + **/ + profile?: { + /** + * Text to set as user profile description + * @maxLength 2000 + */ + content?: string; + + background?: AutumnId; + } + + avatar?: AutumnId; + + /** + * Field to remove from user object */ - token: string; + remove?: 'ProfileContent' | 'ProfileBackground' | 'StatusText' | 'Avatar'; } \ No newline at end of file