Skip to content

Commit

Permalink
feat(OAuth2): add /oauth2/@me route (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
advaith1 committed Jan 21, 2021
1 parent 999b359 commit 84759d1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
8 changes: 8 additions & 0 deletions v8/rest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
24 changes: 23 additions & 1 deletion v8/rest/oauth2.ts
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down

0 comments on commit 84759d1

Please sign in to comment.