'Return a dictionary containing all the links that should be
included in the API schema.'

def get_links(self, request=None):

    links = OrderedDict()
    paths = []
    view_endpoints = []
    for (path, method, callback) in self.endpoints:
        view = self.create_view(callback, method, request)
        if getattr(view, 'exclude_from_schema', False):
            continue
        path = self.coerce_path(path, method, view)
        paths.append(path)
        view_endpoints.append((path, method, view))
    if (not paths):
        return None
    prefix = self.determine_path_prefix(paths)
    for (path, method, view) in view_endpoints:
        if (not self.has_view_permissions(path, method, view)):
            continue
        link = self.get_link(path, method, view)
        subpath = path[len(prefix):]
        keys = self.get_keys(subpath, method, view)
        insert_into(links, keys, link)
    return links
