work in progress api client. still needs some refactoring