Open davidnewcomb opened 1 year ago
I've reopened this to ask why I'm supposed to await .json(). Surely that bit should live inside the library as it's part of the session layer. When I call me()
I should just get back the me
object and not your internal object where I have to do the last little bit - each time.
This is what I had to do to get version 3.0.0 working. Is this right? It's not at all what the docs say.
const pusher = new PushBullet(API_KEY)
const pbObjectPromise = await pusher.devices()
const pbObject = await pbObjectPromise.json()
const devices = pbObject.devices
const device = devices.find((d) => d.nickname === DEVICE_NICKNAME)
The response that is returned is the response object from fetch()
which is used internally. Earlier versions did return the JSON response but there were requests to return the full response as the PushBullet API returns rate limiting information in the response headers (https://docs.pushbullet.com/#ratelimiting) which can be useful to not exceed quota limits.
Following your documentation. I am using version 3.0.0. What am I doing wrong? How can I get the useful information using your module?
Gives:
But when I use curl with the same access token I get: