Structure service for call API with promise angularJS