davidchambers / tutor

JavaScript interface for the Gatherer card database
https://gatherer.wizards.com/
Do What The F*ck You Want To Public License
149 stars 18 forks source link

The languages parser should handle pagination #37

Closed nicknovitski closed 11 years ago

nicknovitski commented 11 years ago

cf: http://gatherer.wizards.com/Pages/Card/Languages.aspx?multiverseid=289327

It's a bit annoying, since the vast majority of cards will only have one page, but to keep the responses consistent, they should all have a page property, with the collection held in a languages property or something like that.

davidchambers commented 11 years ago

I'd appreciate a review of these changes, @nicknovitski. Now that we make multiple HTTP requests each time tutor.card is called, and since the performance cost is negligible, we needn't paginate. Instead, we request the first page, which tells us how many pages there are in total, then request the remaining pages in parallel. There are now several functions involved in retrieving and transforming the data: