move _response_from_endpoint function to abstract base class