[api] allow to dynamically define the view classes used in response types

Fixes #48 and kills one out of two phpcs warnings with TODOs