Add support for more OAuth features (#1203)

This commit is contained in:
Gus Caplan
2017-02-22 14:09:40 -06:00
committed by Amish Shah
parent d09dfa4c37
commit 61e12c637b
6 changed files with 67 additions and 37 deletions

View File

@@ -12,7 +12,7 @@ const Role = require('../../structures/Role');
const Invite = require('../../structures/Invite');
const Webhook = require('../../structures/Webhook');
const UserProfile = require('../../structures/UserProfile');
const ClientOAuth2Application = require('../../structures/ClientOAuth2Application');
const OAuth2Application = require('../../structures/OAuth2Application');
const Channel = require('../../structures/Channel');
const Guild = require('../../structures/Guild');
const VoiceRegion = require('../../structures/VoiceRegion');
@@ -799,12 +799,20 @@ class RESTMethods {
);
}
getMyApplication() {
return this.rest.makeRequest('get', Constants.Endpoints.myApplication, true).then(app =>
new ClientOAuth2Application(this.client, app)
getApplication(id) {
return this.rest.makeRequest('get', Constants.Endpoints.oauth2Application(id), true).then(app =>
new OAuth2Application(this.client, app)
);
}
resetApplication(id) {
return this.rest.makeRequest(
'post',
`${Constants.Endpoints.oauth2Application(id)}/reset`,
true
).then(app => new OAuth2Application(this.client, app));
}
setNote(user, note) {
return this.rest.makeRequest('put', Constants.Endpoints.note(user.id), true, { note }).then(() => user);
}