wip: Add rest api

Close #29
Implements #30 
The rest of the code seems to have a strong preference for switch statements over this approach.