Transform programmatic callback-style API to promised interface