gregmarra/the-blue-alliance — pull request #770 by brandondean (2013-09-29 04:18:03+00:00)
Title: New API controller and team controller for API

Sorry about all the code in a single PR, but this is the smallest I could make it while still submitting something that's functional.

This new API brings the API inline with the rest of the site, it uses the CacheableHandler so it will naturally inherit any improvements from there. The ndb.tasklets in the team controller are, admittedly, a basic copy-paste from its counterpart controller, but this brings the entire controller into the world of ndb async.

Out the gate it does use a lot more RPC's than the older controller, but this also retrieve quite a bit more information thus eliminates the use of issuing more requests (ie. a request to /events/details just to know anything about the events the team attended).

Please punch holes in this PR because I want whatever this ends up being to be the new design paradigm of the API. Getting out the rest of the API will be easy, and then we can start moving onto some fun stuff like a real time API, or doing some cool stuff with TBA user accounts.

* Validates API requests
* Uses CachebleHandler for caching
* Returns big objects that includes events, matches, and awards
* Select a specific year for a team
* ndb async
* Generally cleaner and functions more like its counterpart

TODO
====
* Migrate Google Analytics work onto the new API controller.
* Return small team objects on matches (in place of team_keys) to avoid needing a separate request to get a list of information about the teams they played in matches with.
* My idea here is the avoid the 'request multiple teams in a single request' by just assuming that we give you all the information you will need right out the gate.
* Bubble up other stats about a team, like OPR ratings.