Refactor api adapters