Promise api implementation.