turning a callback api into a blocking api with promises