Attempt 1

This commit is contained in:
Rory&
2025-10-16 09:39:21 +02:00
parent 4e96f2e832
commit 157cd64a66
71 changed files with 325 additions and 141 deletions
+9 -6
View File
@@ -32,7 +32,7 @@
<setting file="file://$PROJECT_DIR$/result/node_modules/lambert-server/src/Utils.ts" root0="SKIP_INSPECTION" />
</component>
<component name="ProblemsViewState">
<option name="selectedTabId" value="ProjectErrors" />
<option name="selectedTabId" value="CurrentFile" />
</component>
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
@@ -57,7 +57,8 @@
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;javascript.nodejs.core.library.configured.version&quot;: &quot;24.8.0&quot;,
&quot;javascript.nodejs.core.library.typings.version&quot;: &quot;24.7.0&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/Rory/git/spacebar/server-master/src/schemas/api/guilds&quot;,
&quot;last.edited.regexp&quot;: &quot;\&quot;$ref\&quot;: \&quot;#/definitions/name\&quot;&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/Rory/git/spacebar/server-master/src/api/routes/applications&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
@@ -70,7 +71,8 @@
&quot;npm.start.executor&quot;: &quot;Debug&quot;,
&quot;prettierjs.PrettierConfiguration.Package&quot;: &quot;/home/Rory/git/spacebar/server-master/node_modules/prettier&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
&quot;ts.external.directory.path&quot;: &quot;/home/Rory/git/spacebar/server-master/node_modules/typescript/lib&quot;
&quot;ts.external.directory.path&quot;: &quot;/home/Rory/git/spacebar/server-master/node_modules/typescript/lib&quot;,
&quot;two.files.diff.last.used.file&quot;: &quot;/home/Rory/git/spacebar/server-master/dist/openapi_discord.json&quot;
},
&quot;keyToStringList&quot;: {
&quot;GitStage.ChangesTree.GroupingKeys&quot;: [
@@ -82,11 +84,11 @@
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/api/routes/applications" />
<recent name="$PROJECT_DIR$/scripts" />
<recent name="$PROJECT_DIR$/src/schemas/api/guilds" />
<recent name="$PROJECT_DIR$/src/schemas" />
<recent name="$PROJECT_DIR$/src/schemas/api/users" />
<recent name="$PROJECT_DIR$/src/schemas/api/messages" />
<recent name="$PROJECT_DIR$/src/admin-api/routes/v0" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/schemas/api/guilds" />
@@ -141,7 +143,8 @@
<workItem from="1759868659577" duration="8847000" />
<workItem from="1760044946282" duration="43683000" />
<workItem from="1760402350251" duration="49898000" />
<workItem from="1760538864442" duration="1330000" />
<workItem from="1760538864442" duration="18561000" />
<workItem from="1760596006678" duration="3780000" />
</task>
<servers />
</component>
Binary file not shown.
Binary file not shown.
+91
View File
@@ -0,0 +1,91 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
require("module-alias/register");
const path = require("path");
const fs = require("fs");
require("../dist/util/util/extensions");
const openapiPathOut = path.join(__dirname, "..", "dist", "openapi_discord.json");
async function main() {
console.log("Generating OpenAPI Specification...");
const routesRes = await fetch(
"https://raw.githubusercontent.com/discord/discord-api-spec/refs/heads/main/specs/openapi_preview.json",
{
headers: {
Accept: "application/json",
},
},
);
const dOpenApi = await routesRes.json();
for (const pathName in dOpenApi.paths) {
console.log("Processing path:", pathName);
const path = dOpenApi.paths[pathName];
for (const methodName in path) {
if (methodName === 'parameters') continue;
console.log(" Processing method:", methodName);
const method = path[methodName];
if (method.operationId)
// delete dOpenApi.paths[path][methodName].operationId;
delete method.operationId; // we don't care about these
for (const respCode in method.responses) {
console.log(" Processing response:", respCode);
const resp = method.responses[respCode];
if(resp.description)
delete resp.description; // we don't care about these
}
console.log(" Method security:", JSON.stringify(method.security));
// if(method.security?.length >= 1 && method.security[0]?.["BotToken"] !== undefined) {
// console.log(" Converting BotToken security to bearer");
// // BotToken -> bearer
// method.security[0]["bearer"] = [];
// delete method.security[0]["BotToken"];
// }
for (const securityObj of method.security||[]) {
if(securityObj["BotToken"] !== undefined) {
console.log(" Converting BotToken security to bearer");
// BotToken -> bearer
securityObj["bearer"] = [];
delete securityObj["BotToken"];
}
}
}
}
fs.writeFileSync(
openapiPathOut,
JSON.stringify(dOpenApi, null, 2)
);
console.log("Wrote OpenAPI specification to", openapiPathOut);
console.log(
"Specification contains",
Object.keys(dOpenApi.paths).length,
"paths and",
Object.keys(dOpenApi.components.schemas).length,
"schemas.",
);
}
main();
+43 -42
View File
@@ -20,9 +20,7 @@ require("module-alias/register");
const getRouteDescriptions = require("./util/getRouteDescriptions");
const path = require("path");
const fs = require("fs");
const {
NO_AUTHORIZATION_ROUTES,
} = require("../dist/api/middlewares/Authentication");
const { NO_AUTHORIZATION_ROUTES } = require("../dist/api/middlewares/Authentication");
require("../dist/util/util/extensions");
const openapiPath = path.join(__dirname, "..", "assets", "openapi.json");
@@ -39,7 +37,7 @@ let specification = {
name: "AGPLV3",
url: "https://www.gnu.org/licenses/agpl-3.0.en.html",
},
version: "1.0.0",
version: "9",
},
externalDocs: {
description: "Spacebar Docs",
@@ -47,8 +45,8 @@ let specification = {
},
servers: [
{
url: "https://old.server.spacebar.chat/api/",
description: "Official Spacebar Instance",
url: "https://old.server.spacebar.chat/api/v9",
},
],
components: {
@@ -88,8 +86,7 @@ function combineSchemas(schemas) {
continue;
}
specification.components = specification.components || {};
specification.components.schemas =
specification.components.schemas || {};
specification.components.schemas = specification.components.schemas || {};
specification.components.schemas[key] = definitions[key];
delete definitions[key].additionalProperties;
delete definitions[key].$schema;
@@ -134,8 +131,7 @@ function apiRoutes(missingRoutes) {
if (
!NO_AUTHORIZATION_ROUTES.some((x) => {
if (typeof x === "string")
return (method.toUpperCase() + " " + path).startsWith(x);
if (typeof x === "string") return (method.toUpperCase() + " " + path).startsWith(x);
return x.test(method.toUpperCase() + " " + path);
})
) {
@@ -162,10 +158,10 @@ function apiRoutes(missingRoutes) {
if (route.responses) {
obj.responses = {};
for (const [k, v] of Object.entries(route.responses)) {
for (const [statusCode, v] of Object.entries(route.responses)) {
if (v.body)
obj.responses[k] = {
description: obj?.responses?.[k]?.description || "",
obj.responses[statusCode] = {
description: obj?.responses?.[statusCode]?.description,
content: {
"application/json": {
schema: {
@@ -175,12 +171,23 @@ function apiRoutes(missingRoutes) {
},
};
else
obj.responses[k] = {
description:
obj?.responses?.[k]?.description ||
"No description available",
obj.responses[statusCode] = {
description: obj?.responses?.[statusCode]?.description || "No description available",
};
}
if (route.ratelimitBucket) {
obj["x-ratelimit-bucket"] = route.ratelimitBucket;
obj.responses["429"] = {};
if (obj.responses["200"]) {
obj.responses["200"].headers ??= {};
for (const key in ["Limit", "Remaining", "Reset", "Reset-After", "Bucket"]) {
obj.responses["200"].headers[`X-RateLimit-${key}`] = {
$ref: `#/components/headers/X-RateLimit-${key}`,
};
}
}
}
} else {
obj.responses = {
default: {
@@ -224,45 +231,39 @@ function apiRoutes(missingRoutes) {
];
}
specification.paths[path] = Object.assign(
specification.paths[path] || {},
{
[method]: obj,
},
);
specification.paths[path] = Object.assign(specification.paths[path] || {}, {
[method]: obj,
});
});
// order top level
const topLevelOrder = ["openapi", "info", "externalDocs", "servers", "paths", "tags", "components"];
specification = Object.fromEntries(
topLevelOrder
.map((x) => [x, specification[x]])
.filter((x) => x[1] !== undefined)
.concat(Object.entries(specification).filter((x) => !topLevelOrder.includes(x[0]))),
);
// order paths alphabetically
specification.paths = Object.fromEntries(Object.entries(specification.paths).sort((a, b) => a[0].localeCompare(b[0])));
}
async function main() {
console.log("Generating OpenAPI Specification...");
const routesRes = await fetch(
"https://github.com/spacebarchat/missing-routes/raw/main/missing.json",
{
headers: {
Accept: "application/json",
},
const routesRes = await fetch("https://github.com/spacebarchat/missing-routes/raw/main/missing.json", {
headers: {
Accept: "application/json",
},
);
});
const missingRoutes = await routesRes.json();
combineSchemas(schemas);
apiRoutes(missingRoutes);
fs.writeFileSync(
openapiPath,
JSON.stringify(specification, null, 4)
.replaceAll("#/definitions", "#/components/schemas")
.replaceAll("bigint", "number"),
);
fs.writeFileSync(openapiPath, JSON.stringify(specification, null, 4).replaceAll("#/definitions", "#/components/schemas").replaceAll("bigint", "number"));
console.log("Wrote OpenAPI specification to", openapiPath);
console.log(
"Specification contains",
Object.keys(specification.paths).length,
"paths and",
Object.keys(specification.components.schemas).length,
"schemas.",
);
console.log("Specification contains", Object.keys(specification.paths).length, "paths and", Object.keys(specification.components.schemas).length, "schemas.");
}
main();
+69
View File
@@ -0,0 +1,69 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
require("module-alias/register");
const path = require("path");
const fs = require("fs");
require("../dist/util/util/extensions");
const openapiPath = path.join(__dirname, "..", "assets", "openapi.json");
const openapiPathOut = path.join(__dirname, "..", "dist", "openapi_missing.json");
const SchemaPath = path.join(__dirname, "..", "assets", "schemas.json");
const sbOpenApi = JSON.parse(fs.readFileSync(SchemaPath, { encoding: "utf8" }));
async function main() {
console.log("Generating OpenAPI Specification...");
const routesRes = await fetch(
"https://raw.githubusercontent.com/discord/discord-api-spec/refs/heads/main/specs/openapi_preview.json",
{
headers: {
Accept: "application/json",
},
},
);
const dOpenApi = await routesRes.json();
for (const path in dOpenApi.paths) {
if (!sbOpenApi.paths[path]) {
console.log("Missing path:", path);
continue;
}
for (const method in dOpenApi.paths[path]) {
if(sbOpenApi.paths?.[path]?.[method]) delete sbOpenApi.paths[path][method];
}
if(Object.keys(sbOpenApi.paths?.[path]||{}).length === 0) delete sbOpenApi.paths[path];
}
fs.writeFileSync(
openapiPathOut,
JSON.stringify(dOpenApi, null, 4)
);
console.log("Wrote OpenAPI specification to", openapiPathOut);
console.log(
"Specification contains",
Object.keys(specification.paths).length,
"paths and",
Object.keys(specification.components.schemas).length,
"schemas.",
);
}
main();
+19
View File
@@ -46,6 +46,7 @@ const settings = {
const ExcludeAndWarn = [
/^Record/,
/^Partial/,
/^import\(/,
]
const Excluded = [
"DefaultSchema",
@@ -149,6 +150,24 @@ function main() {
deleteOneOfKindUndefinedRecursive(definitions, "$");
// cant do this here:
// let hasUnreferencedSchemas = true;
// while (hasUnreferencedSchemas) {
// hasUnreferencedSchemas = false;
// console.log(`Checking for unreferenced schemas in ${definitions.length}..."`);
// let fullMap = JSON.stringify(definitions);
// for (const [name, schema] of Object.entries(definitions)) {
// const schemaStr = JSON.stringify(schema);
// const refRe = new RegExp(`"\\$ref":"#/definitions/${name}"`, "g");
// const count = (fullMap.match(refRe) || []).length;
// if (count <= 1) {
// console.log("Deleting unreferenced schema", name);
// delete definitions[name];
// hasUnreferencedSchemas = true;
// }
// }
// }
fs.writeFileSync(schemaPath, JSON.stringify(definitions, null, 4));
console.log("Successfully wrote", Object.keys(definitions).length, "schemas to", schemaPath);
}
@@ -39,7 +39,7 @@ router.post(
204: {
body: "TokenOnlyResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -68,7 +68,7 @@ router.post(
200: {
body: "TokenResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -104,7 +104,7 @@ router.patch(
200: {
body: "Application",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -37,7 +37,7 @@ router.get(
200: {
body: "Application",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -62,7 +62,7 @@ router.patch(
200: {
body: "Application",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -128,7 +128,7 @@ router.post(
route({
responses: {
200: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+1 -1
View File
@@ -33,7 +33,7 @@ router.post(
200: {
body: "RefreshUrlsResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+1 -1
View File
@@ -28,7 +28,7 @@ router.post(
requestBody: "ForgotPasswordSchema",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorOrCaptchaResponse",
},
},
+1 -1
View File
@@ -41,7 +41,7 @@ router.post(
200: {
body: "LoginResponse",
},
400: {
"4XX": {
body: "APIErrorOrCaptchaResponse",
},
},
+1 -1
View File
@@ -32,7 +32,7 @@ router.post(
200: {
body: "TokenResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+1 -1
View File
@@ -45,7 +45,7 @@ router.post(
requestBody: "WebAuthnTotpSchema",
responses: {
200: { body: "TokenResponse" },
400: { body: "APIErrorResponse" },
"4XX": { body: "APIErrorResponse" },
},
}),
async (req: Request, res: Response) => {
+1 -1
View File
@@ -45,7 +45,7 @@ router.post(
requestBody: "RegisterSchema",
responses: {
200: { body: "TokenOnlyResponse" },
400: { body: "APIErrorOrCaptchaResponse" },
"4XX": { body: "APIErrorOrCaptchaResponse" },
},
}),
async (req: Request, res: Response) => {
+1 -1
View File
@@ -39,7 +39,7 @@ router.post(
200: {
body: "TokenOnlyResponse",
},
400: {
"4XX": {
body: "APIErrorOrCaptchaResponse",
},
},
+1 -1
View File
@@ -46,7 +46,7 @@ router.post(
200: {
body: "TokenResponse",
},
400: {
"4XX": {
body: "APIErrorOrCaptchaResponse",
},
},
+1 -1
View File
@@ -28,7 +28,7 @@ router.post(
right: "RESEND_VERIFICATION_EMAIL",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
500: {
@@ -29,7 +29,7 @@ router.post(
requestBody: "BackupCodesChallengeSchema",
responses: {
200: { body: "BackupCodesChallengeResponse" },
400: { body: "APIErrorResponse" },
"4XX": { body: "APIErrorResponse" },
},
}),
async (req: Request, res: Response) => {
@@ -39,7 +39,7 @@ router.post(
body: "UploadAttachmentResponseSchema",
},
404: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -28,7 +28,7 @@ router.get(
200: {
body: "HubDirectoryEntriesResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+1 -1
View File
@@ -34,7 +34,7 @@ router.post(
body: "Message",
},
404: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+1 -1
View File
@@ -137,7 +137,7 @@ router.patch(
body: "Channel",
},
404: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -35,7 +35,7 @@ router.post(
body: "Invite",
},
404: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -59,7 +59,7 @@ router.patch(
200: {
body: "Message",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {},
@@ -161,7 +161,7 @@ router.put(
200: {
body: "Message",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {},
@@ -264,7 +264,7 @@ router.get(
200: {
body: "Message",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {},
@@ -297,7 +297,7 @@ router.delete(
route({
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -59,7 +59,7 @@ router.delete(
permission: "MANAGE_MESSAGES",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -95,7 +95,7 @@ router.delete(
permission: "MANAGE_MESSAGES",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -144,7 +144,7 @@ router.get(
200: {
body: "PublicUser",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -183,7 +183,7 @@ router.put(
right: "SELF_ADD_REACTIONS",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -264,7 +264,7 @@ router.delete(
route({
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -334,7 +334,7 @@ router.delete(
route({
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -42,7 +42,7 @@ router.post(
requestBody: "BulkDeleteSchema",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {},
@@ -70,7 +70,7 @@ router.get(
200: {
body: "APIMessageArray",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {},
@@ -281,7 +281,7 @@ router.post(
200: {
body: "Message",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {},
@@ -40,7 +40,7 @@ router.put(
204: {},
403: {},
404: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -126,7 +126,7 @@ router.delete(
204: {},
403: {},
404: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -173,7 +173,7 @@ router.get(
200: {
body: "APIMessageArray",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -35,7 +35,7 @@ router.put(
204: {},
404: {},
501: {},
400: { body: "APIErrorResponse" },
"4XX": { body: "APIErrorResponse" },
},
}),
async (req: Request, res: Response) => {
+3 -3
View File
@@ -41,7 +41,7 @@ router.put(
204: {},
403: {},
404: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -127,7 +127,7 @@ router.delete(
204: {},
403: {},
404: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -174,7 +174,7 @@ router.get(
200: {
body: "APIMessageArray",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+1 -1
View File
@@ -43,7 +43,7 @@ router.post(
/*body: "PurgeSchema",*/
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -86,7 +86,7 @@ router.post(
200: {
body: "WebhookCreateResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {},
+1 -1
View File
@@ -30,7 +30,7 @@ router.post(
200: {
body: "PreloadMessagesResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -53,7 +53,7 @@ router.post(
200: {
body: "AutomodRuleSchemaWithId",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -102,7 +102,7 @@ router.patch(
200: {
body: "AutomodRuleSchemaWithId",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
+1 -1
View File
@@ -200,7 +200,7 @@ router.put(
permission: "BAN_MEMBERS",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
+1 -1
View File
@@ -40,7 +40,7 @@ router.post(
200: {
body: "Ban",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
+2 -2
View File
@@ -62,7 +62,7 @@ router.post(
201: {
body: "Channel",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -96,7 +96,7 @@ router.patch(
permission: "MANAGE_CHANNELS",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -89,7 +89,7 @@ router.patch(
200: {
body: "Member",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -30,7 +30,7 @@ router.patch(
200: {
body: "APIPublicMember",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -37,7 +37,7 @@ router.patch(
200: {
body: "Member",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
@@ -62,7 +62,7 @@ router.delete(
permission: "MANAGE_ROLES",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -108,7 +108,7 @@ router.patch(
200: {
body: "Role",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -52,7 +52,7 @@ router.post(
200: {
body: "Role",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -128,7 +128,7 @@ router.patch(
200: {
body: "APIRoleArray",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
+2 -2
View File
@@ -72,7 +72,7 @@ router.post(
200: {
body: "Sticker",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -165,7 +165,7 @@ router.patch(
200: {
body: "Sticker",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
+1 -1
View File
@@ -70,7 +70,7 @@ router.post(
200: {
body: "Template",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -37,7 +37,7 @@ router.patch(
requestBody: "VoiceStateUpdateSchema",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -56,7 +56,7 @@ router.patch(
permission: "MANAGE_GUILD",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
@@ -37,7 +37,7 @@ router.get(
route({
responses: {
200: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
+1 -1
View File
@@ -58,7 +58,7 @@ router.patch(
200: {
body: "WidgetModifySchema",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
@@ -35,7 +35,7 @@ router.post(
200: {
body: "EmailDomainLookupResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
@@ -70,7 +70,7 @@ router.post(
// 200: {
// body: "EmailDomainLookupVerifyCodeResponse",
// },
400: {
"4XX": {
body: "APIErrorResponse",
},
501: {},
+1 -1
View File
@@ -40,7 +40,7 @@ router.post(
201: {
body: "GuildCreateResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
+1 -1
View File
@@ -32,7 +32,7 @@ router.post(
200: {
body: "HubWaitlistSignupResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+2 -2
View File
@@ -44,7 +44,7 @@ router.get(
responses: {
// TODO: I really didn't feel like typing all of it out
200: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
@@ -181,7 +181,7 @@ router.post(
200: {
body: "OAuthAuthorizeResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {
+1 -1
View File
@@ -28,7 +28,7 @@ router.post(
requestBody: "AckBulkSchema",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+1 -1
View File
@@ -29,7 +29,7 @@ router.get(
200: {
body: "UpdatesResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
+1 -1
View File
@@ -29,7 +29,7 @@ router.get(
200: {
body: "DmMessagesResponseSchema",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+1 -1
View File
@@ -28,7 +28,7 @@ router.post(
route({
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
+1 -1
View File
@@ -62,7 +62,7 @@ router.delete(
route({
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
@@ -51,7 +51,7 @@ router.patch(
requestBody: "UserGuildSettingsSchema",
responses: {
200: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
+1 -1
View File
@@ -59,7 +59,7 @@ router.patch(
200: {
body: "UserUpdateResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
@@ -36,7 +36,7 @@ router.post(
200: {
body: "APIBackupCodeArray",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
+1 -1
View File
@@ -42,7 +42,7 @@ router.post(
200: {
body: "APIBackupCodeArray",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
+1 -1
View File
@@ -37,7 +37,7 @@ router.post(
200: {
body: "TokenOnlyResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+1 -1
View File
@@ -38,7 +38,7 @@ router.post(
200: {
body: "TokenWithBackupCodesResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
@@ -77,7 +77,7 @@ router.post(
200: {
body: "WebAuthnCreateResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
},
+3 -3
View File
@@ -76,7 +76,7 @@ router.put(
requestBody: "RelationshipPutSchema",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
@@ -104,7 +104,7 @@ router.post(
requestBody: "RelationshipPostSchema",
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
@@ -137,7 +137,7 @@ router.delete(
route({
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
+1 -1
View File
@@ -49,7 +49,7 @@ router.patch(
200: {
body: "UserSettings",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {
@@ -541,7 +541,7 @@ router.post(
},
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -99,7 +99,7 @@ router.post(
},
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -113,7 +113,7 @@ router.delete(
route({
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -160,7 +160,7 @@ router.patch(
200: {
body: "Message",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {},
+2 -2
View File
@@ -66,7 +66,7 @@ router.delete(
route({
responses: {
204: {},
400: {
"4XX": {
body: "APIErrorResponse",
},
404: {},
@@ -122,7 +122,7 @@ router.patch(
200: {
body: "WebhookCreateResponse",
},
400: {
"4XX": {
body: "APIErrorResponse",
},
403: {},
+2 -1
View File
@@ -58,7 +58,7 @@ export interface RouteOptions {
right?: RightResolvable;
requestBody?: `${string}Schema`; // typescript interface name
responses?: {
[status: number]: {
[status: number | string]: {
// body?: `${string}Response`;
body?: string;
};
@@ -75,6 +75,7 @@ export interface RouteOptions {
};
};
deprecated?: boolean;
ratelimitBucket?: string;
// test?: {
// response?: RouteResponse;
// body?: unknown;