diff --git a/docs/docs_client.rst b/docs/docs_client.rst index 05288f882..79e29b717 100755 --- a/docs/docs_client.rst +++ b/docs/docs_client.rst @@ -861,6 +861,16 @@ Set the note of a user. This will only work for user accounts. - **callback** - `function` taking the following: - **error** - error if any occurred. +getOAuthApplication(appID, `callback`) +~~~~~~~~~~~~~~~~~~~~ + +Get data on an OAuth2 application + +- **appID** - The target application ID. If none was specified, it defaults to "@me", which refers to the logged in user's application. +- **callback** - `function` taking the following: + - **error** - error if any occurred. + - **data** - the application data. Refer to `the official Discord API documentation entry `_ for data structure details + Events ------ diff --git a/lib/Client/Client.js b/lib/Client/Client.js index c162af2ec..cb0ba321e 100644 --- a/lib/Client/Client.js +++ b/lib/Client/Client.js @@ -1190,6 +1190,19 @@ var Client = (function (_EventEmitter) { return this.internal.removeFriend(user).then(dataCallback(callback), errorCallback(callback)); }; + // def getOAuthApplication + + Client.prototype.getOAuthApplication = function getOAuthApplication(appID) { + var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err, bans*/{} : arguments[1]; + + if (typeof appID === "function") { + // appID is the callback + callback = appID; + appID = null; + } + return this.internal.getOAuthApplication(appID).then(dataCallback(callback), errorCallback(callback)); + }; + // def awaitResponse Client.prototype.awaitResponse = function awaitResponse(msg) { diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index b804f3811..ac0814865 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -1764,6 +1764,13 @@ var InternalClient = (function () { return this.apiRequest("delete", _Constants.Endpoints.FRIENDS + "/" + user.id, true); }; + //def getOAuthApplication + + InternalClient.prototype.getOAuthApplication = function getOAuthApplication(appID) { + appID = appID || "@me"; + return this.apiRequest("get", _Constants.Endpoints.OAUTH2_APPLICATION(appID), true); + }; + //def ack InternalClient.prototype.ack = function ack(msg) { diff --git a/src/Client/Client.js b/src/Client/Client.js index 3b0bb5aa7..2be337ba6 100755 --- a/src/Client/Client.js +++ b/src/Client/Client.js @@ -1176,6 +1176,17 @@ export default class Client extends EventEmitter { .then(dataCallback(callback), errorCallback(callback)); } + // def getOAuthApplication + getOAuthApplication(appID, callback = (/*err, bans*/) => { }) { + if (typeof appID === "function") { + // appID is the callback + callback = appID; + appID = null; + } + return this.internal.getOAuthApplication(appID) + .then(dataCallback(callback), errorCallback(callback)); + } + // def awaitResponse awaitResponse(msg, toSend = null, options = null, callback = (/*err, newMsg*/) => { }) { var ret; diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index 70fe6ffad..2db641aca 100755 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -1537,6 +1537,12 @@ export default class InternalClient { return this.apiRequest("delete", `${Endpoints.FRIENDS}/${user.id}`, true); } + //def getOAuthApplication + getOAuthApplication(appID) { + appID = appID || "@me"; + return this.apiRequest("get", Endpoints.OAUTH2_APPLICATION(appID), true); + } + //def ack ack(msg) { msg = this.resolver.resolveMessage(msg);