t3chnoboy / amazon-product-api

:credit_card: Amazon Product Advertising API client
365 stars 104 forks source link

Why does only the callback return response? #73

Open socketwiz opened 7 years ago

socketwiz commented 7 years ago

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...

t3chnoboy commented 7 years ago

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

masterT commented 7 years ago

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

masterT commented 7 years ago

Same problem in issue #49.

budda commented 6 years ago

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