oapi: oauth2
This commit is contained in:
parent
3a40254ca5
commit
1b1fbce4d3
@ -6134,6 +6134,17 @@
|
|||||||
"stickers"
|
"stickers"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"OAuthAuthorizeResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"location": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"location"
|
||||||
|
]
|
||||||
|
},
|
||||||
"TenorTrendingResponse": {
|
"TenorTrendingResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -7762,10 +7773,56 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"responses": {
|
"responses": {
|
||||||
"default": {
|
"200": {
|
||||||
"description": "No description available"
|
"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": [
|
"tags": [
|
||||||
"oauth2"
|
"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
|
// 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, scope, response_type, redirect_url } = req.query;
|
||||||
const { client_id } = req.query;
|
const { client_id } = req.query;
|
||||||
|
|
||||||
@ -56,7 +70,13 @@ router.get("/", route({}), async (req: Request, res: Response) => {
|
|||||||
id: req.user_id,
|
id: req.user_id,
|
||||||
bot: false,
|
bot: false,
|
||||||
},
|
},
|
||||||
select: ["id", "username", "avatar", "discriminator", "public_flags"],
|
select: [
|
||||||
|
"id",
|
||||||
|
"username",
|
||||||
|
"avatar",
|
||||||
|
"discriminator",
|
||||||
|
"public_flags",
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const guilds = await Member.find({
|
const guilds = await Member.find({
|
||||||
@ -131,11 +151,33 @@ router.get("/", route({}), async (req: Request, res: Response) => {
|
|||||||
},
|
},
|
||||||
authorized: false,
|
authorized: false,
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
router.post(
|
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) => {
|
async (req: Request, res: Response) => {
|
||||||
const body = req.body as ApplicationAuthorizeSchema;
|
const body = req.body as ApplicationAuthorizeSchema;
|
||||||
// const { client_id, scope, response_type, redirect_url } = req.query;
|
// 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 "./GuildWidgetSettingsResponse";
|
||||||
export * from "./LocationMetadataResponse";
|
export * from "./LocationMetadataResponse";
|
||||||
export * from "./MemberJoinGuildResponse";
|
export * from "./MemberJoinGuildResponse";
|
||||||
|
export * from "./OAuthAuthorizeResponse";
|
||||||
export * from "./Tenor";
|
export * from "./Tenor";
|
||||||
export * from "./TokenResponse";
|
export * from "./TokenResponse";
|
||||||
export * from "./UserProfileResponse";
|
export * from "./UserProfileResponse";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user