convert api to coffeescript