Skip to content

Instantly share code, notes, and snippets.

@ginsengs
Created May 24, 2018 21:12
Show Gist options
  • Save ginsengs/d7733cac6a8b2cba8ef0bc7a9a65a369 to your computer and use it in GitHub Desktop.
Save ginsengs/d7733cac6a8b2cba8ef0bc7a9a65a369 to your computer and use it in GitHub Desktop.
_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