Added interface to restclient to allow raw streams to be returned.
Pushed refactor to credentials manager.