Created
May 24, 2018 21:12
-
-
Save em7v/d7733cac6a8b2cba8ef0bc7a9a65a369 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_get(endpoint, options = {}) { | |
return get(`${this.baseURL}${endpoint}`) | |
.query(options) | |
.set('auth', this.token) | |
.then(res => { | |
this.ratelimit = { | |
'x-ratelimit-limit': res.headers['x-ratelimit-limit'], | |
'x-ratelimit-remaining': res.headers['x-ratelimit-remaining'], | |
'x-ratelimit-reset': res.headers['x-ratelimit-reset'], | |
} | |
return res.body | |
}) | |
.catch(error => { throw `There was a error while trying to get Information from the API: ${error}`; }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment