Portable API

@mzabolotko this is the continuation of your original pull request. I haven't tested the build scripts yet, can you please take a look through this and make sure you're happy with it before I rebase/merge it.

The improvements I made over your original pull request:

 - Api library is now poratble
 - Async version of API