I think you should add to the constructor the `$type` and `$endpoint` rather than setters