pkgdb2client: Remove duplicate code to call the API

The new call_api() method includes the generic API call code that can be
used by all API wrapper methods and to call non-wrapped API methods.
pkgdb2client: Allow low-level API calls
pkgdb2client: Support on-demand authentication

Login only when required by pkgdb, support specifying a callback to get
user name and password.
Merge pull request #10 from tyll/simplify

pkgdb2client: Remove duplicate code to call the API