mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-22 18:32:29 +01:00
oapi: oauth2
This commit is contained in:
parent
3a40254ca5
commit
1b1fbce4d3
@ -6134,6 +6134,17 @@
|
||||
"stickers"
|
||||
]
|
||||
},
|
||||
"OAuthAuthorizeResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"location"
|
||||
]
|
||||
},
|
||||
"TenorTrendingResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -7762,10 +7773,56 @@
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "No description available"
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/OAuthAuthorizeResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/APIErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/APIErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/APIErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "client_id",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"oauth2"
|
||||
]
|
||||
|
3543
assets/schemas.json
3543
assets/schemas.json
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,21 @@ const router = Router();
|
||||
|
||||
// TODO: scopes, other oauth types
|
||||
|
||||
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||
router.get(
|
||||
"/",
|
||||
route({
|
||||
responses: {
|
||||
// TODO: I really didn't feel like typing all of it out
|
||||
200: {},
|
||||
400: {
|
||||
body: "APIErrorResponse",
|
||||
},
|
||||
404: {
|
||||
body: "APIErrorResponse",
|
||||
},
|
||||
},
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
// const { client_id, scope, response_type, redirect_url } = req.query;
|
||||
const { client_id } = req.query;
|
||||
|
||||
@ -56,7 +70,13 @@ router.get("/", route({}), async (req: Request, res: Response) => {
|
||||
id: req.user_id,
|
||||
bot: false,
|
||||
},
|
||||
select: ["id", "username", "avatar", "discriminator", "public_flags"],
|
||||
select: [
|
||||
"id",
|
||||
"username",
|
||||
"avatar",
|
||||
"discriminator",
|
||||
"public_flags",
|
||||
],
|
||||
});
|
||||
|
||||
const guilds = await Member.find({
|
||||
@ -131,11 +151,33 @@ router.get("/", route({}), async (req: Request, res: Response) => {
|
||||
},
|
||||
authorized: false,
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
router.post(
|
||||
"/",
|
||||
route({ requestBody: "ApplicationAuthorizeSchema" }),
|
||||
route({
|
||||
requestBody: "ApplicationAuthorizeSchema",
|
||||
query: {
|
||||
client_id: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
body: "OAuthAuthorizeResponse",
|
||||
},
|
||||
400: {
|
||||
body: "APIErrorResponse",
|
||||
},
|
||||
403: {
|
||||
body: "APIErrorResponse",
|
||||
},
|
||||
404: {
|
||||
body: "APIErrorResponse",
|
||||
},
|
||||
},
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
const body = req.body as ApplicationAuthorizeSchema;
|
||||
// const { client_id, scope, response_type, redirect_url } = req.query;
|
||||
|
3
src/util/schemas/responses/OAuthAuthorizeResponse.ts
Normal file
3
src/util/schemas/responses/OAuthAuthorizeResponse.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export interface OAuthAuthorizeResponse {
|
||||
location: string;
|
||||
}
|
@ -31,6 +31,7 @@ export * from "./GuildWidgetJsonResponse";
|
||||
export * from "./GuildWidgetSettingsResponse";
|
||||
export * from "./LocationMetadataResponse";
|
||||
export * from "./MemberJoinGuildResponse";
|
||||
export * from "./OAuthAuthorizeResponse";
|
||||
export * from "./Tenor";
|
||||
export * from "./TokenResponse";
|
||||
export * from "./UserProfileResponse";
|
||||
|
Loading…
Reference in New Issue
Block a user