ericblade / mws-advanced

Javascript (node) Amazon Merchant Web Services (MWS) code with mws-simple as it's underpinnings
Apache License 2.0
41 stars 11 forks source link

add ability to "get all" of every type of function that provides a *ByNextToken equivalent #16

Open ericblade opened 6 years ago

ericblade commented 6 years ago

We should add a parameter to all the base functions that also have ByNextToken versions, that will allow the MWS lib to go and gather up ALL* of the data before accepting the promise.

So, you could potentially call something like

    callEndpoint('ListFinancialEvents', { GetAll: true })

and if you receive a NextToken with the initial result, then automatically call ListFinancialEventsByNextToken, and add that data to the original result. Re-run until there are no more NextTokens returned.

This is essentially what getReportListAll() does already.

LeeMeeTed commented 6 years ago

It will be VERY helpful, that we dont need to deal with the looping and recursion to get all the data. Hope that it will be implemented to all of the End Points soon. Doing good man!

ericblade commented 6 years ago

Is there a particular one that you need to use? I'm not sure how my time is going to be affected -- just become unemployed, and I'm not specifically sure if that leans me toward having more time to work out some things on personal projects, or less time.

Though, honestly, it wouldn't be difficult to model something after getReportListAll() that does it for another function . . . it's probably a feature that i won't get to implementing all of them for until after i have figured out a reasonable way to deal with throttling issues, since that will directly affect throttling -- I'd like to be able to send as many requests as I can at once, and only throttle if I have to. Right now, anything that is likely to get throttled is not smart enough to handle it effectively.

Also, my Amazon store is pretty small, and I might not necessarily have the data available to test some of these calls effectively :-D

ericblade commented 6 years ago

@LeeMeeTed any chance you might be able to share some output from some of the calls that return NextTokens? I don't have a lot of multiple page things to work with.