amazon-product-api icon indicating copy to clipboard operation
amazon-product-api copied to clipboard

Why does only the callback return response?

Open socketwiz opened this issue 8 years ago • 4 comments

It just took me two hours to figure out that the promise only returns the array of products where as the callback returns both the array of products and the response. Why is that, and would you accept a pull request to fix the promise?

Callback: https://github.com/t3chnoboy/amazon-product-api/blob/master/lib/index.js#L19 Promise: https://github.com/t3chnoboy/amazon-product-api/blob/master/lib/index.js#L21

In other words, if you use the promise, you can only ever get back the first page of information because it doesn't return the Items object that contains things like:

<TotalResults>376</TotalResults>
<TotalPages>38</TotalPages>

among other things...

socketwiz avatar Jan 26 '17 02:01 socketwiz

Yeah, sorry for the inconsistency 😕 PRs are welcome! 😄 Or I can take a look on the weekend.

t3chnoboy avatar Jan 26 '17 10:01 t3chnoboy

Can't Promise return more then one value? How will you do that? Return an array of values?

masterT avatar Jan 27 '17 15:01 masterT

Same problem in issue #49.

masterT avatar Jan 27 '17 16:01 masterT

Is this any closer to being fixed and released to npm?

budda avatar Jul 25 '17 23:07 budda