t3chnoboy / amazon-product-api

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

Make `response` return the whole Items/BrowseNodes array (supports batch requests) #53

Closed FdezRomero closed 8 years ago

FdezRomero commented 8 years ago

Theresponse callback parameter (e.g. client.itemSearch(query, function(err, result, response) {}) currently assumes that there is only one Items/BrowseNodes object in the response and returns respObj.Items[0] or respObj.BrowseNodes[0].

This is true for normal requests but the Amazon PA API also supports Batch Requests where you can have a second Items/BrowseNodes object in respObj.Items[1] or respObj.BrowseNodes[1], which is never returned.

This PR simply returns the parent Items/BrowseNodes array in the response parameter. It shouldn't break compatibility for most users as this parameter is currently not documented.

t3chnoboy commented 8 years ago

Sounds good! But let's bump at least a minor version since it is a breaking change.

FdezRomero commented 8 years ago

Sure :+1: I knew there were some other PRs waiting so I didn't want to touch the version, in case you wanted to publish them all together :wink: