- factor out auth and api call methods

Signed-off-by: John Grange <john@sd-networks.net>