refactoring moudle of interact with api.