Add apply method to Endpoint companion

This allows for endpoint to be created with slightly prettier syntax.

Addresses #88
May we move it to a companion object `Endpoint`?