moving api code into platform folder