[CHORE] Complete refactor api methods from index to lib/api files.