Add apply method to Endpoint companion

This allows for endpoint to be created with slightly prettier syntax.