Refactor the client (again) to better support auth

* Allows consumers to provide their own transports for common cases.
* Supports an 'api_version' flag on test cases for controlling which
  api version they test against
* Provides a common flag registration method for CLIs that need
  to connect to an API server (to avoid duplicating flags)
* Ensures errors are properly returned by the server