code: def add_endpoint(self, endpoint):
          
  
          if self.url_prefix:
              url = '{prefix}{url}'.format(prefix=self.url_prefix, url=endpoint.url)
          else:
              url = endpoint.url
  
          self.add_url_rule(
              url,
              view_func=endpoint.as_view(endpoint.get_name()),
          )
docs: Register an :class:`.Endpoint` aginst this resource.
  
          :param endpoint: :class:`.Endpoint` API Endpoint class
  
          Usage::
  
              foo_resource = Resource('example', __name__)
              class MyEndpoint(Endpoint):
  
                  url = '/example'
                  name = 'myendpoint'
  
              foo_resource.add_endpoint(MyEndpoint)