Make Api.php Python-free

There are still a lot of issues in Api.php but most of the leftover Python code should be gone and converted at this point. In order to replace the Python list comprehensions, I wrote the ```buildResult``` method to abstract out the various calls to the static ```newFromJsonArray``` methods. In certain cases, a simple ```foreach``` loop sufficed.