feat(OAuth2): add /oauth2/@me route (#73)

This commit is contained in:
Advaith
2021-01-21 12:02:59 -08:00
committed by GitHub
parent 999b3594d8
commit 84759d19bc
2 changed files with 31 additions and 1 deletions

View File

@@ -564,6 +564,14 @@ export const Routes = {
return `/oauth2/applications/@me`;
},
/**
* Route for:
* - GET `/oauth2/@me`
*/
oauth2CurrentAuthorization() {
return `/oauth2/@me`;
},
/**
* Route for:
* - GET `/applications/{application.id}/commands`

View File

@@ -1,11 +1,33 @@
import type { Permissions, Snowflake } from '../../common/index';
import type { APIApplication, APIGuild, APIWebhook, OAuth2Scopes } from '../payloads/index';
import type { APIApplication, APIGuild, APIUser, APIWebhook, OAuth2Scopes } from '../payloads/index';
/**
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information
*/
export type RESTGetAPIOauth2CurrentApplicationResult = Omit<APIApplication, 'flags'>;
/**
* https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information
*/
export interface RESTGetAPIOauth2CurrentAuthorizationResult {
/**
* the current application
*/
application: Partial<APIApplication>;
/**
* the scopes the user has authorized the application for
*/
scopes: OAuth2Scopes[];
/**
* when the access token expires
*/
expires: string;
/**
* the user who has authorized, if the user has authorized with the `identify` scope
*/
user?: APIUser;
}
/**
* https://discord.com/developers/docs/topics/oauth2#authorization-code-grant
*/