'GET /api/tool_shed_repositories/shed_repository
Get details about the specified repository from its shed.
:param tsr_id:          the tool_shed_repository_id
:param tsr_id:          str
:param tool_shed_url:   the URL of the toolshed whence to retrieve repository details
:param tool_shed_url:   str
:param tool_ids:         (optional) comma-separated list of tool IDs
:param tool_ids:         str'

@expose_api
@web.require_admin
def shed_repository(self, trans, **kwd):

    tool_dependencies = dict()
    tools = dict()
    tool_shed_url = kwd.get('tool_shed_url', '')
    tsr_id = kwd.get('tsr_id', None)
    tool_ids = kwd.get('tool_ids', None)
    if (tool_ids is not None):
        tool_ids = util.listify(tool_ids)
    tool_panel_section_select_field = tool_util.build_tool_panel_section_select_field(trans.app)
    tool_panel_section_dict = {'name': tool_panel_section_select_field.name, 'id': tool_panel_section_select_field.field_id, 'sections': []}
    for (name, id, _) in tool_panel_section_select_field.options:
        tool_panel_section_dict['sections'].append(dict(id=id, name=name))
    repository_data = dict()
    if (tool_ids is not None):
        if (len(tool_shed_url) == 0):
            tool_shed_url = common_util.get_tool_shed_url_from_tool_shed_registry(self.app, tool_ids[0].split('/')[0])
        found_repository = json.loads(util.url_get(tool_shed_url, params=dict(tool_ids=','.join(tool_ids)), pathspec=['api', 'repositories']))
        fr_keys = found_repository.keys()
        tsr_id = found_repository[fr_keys[0]]['repository_id']
        repository_data['current_changeset'] = found_repository['current_changeset']
        repository_data['repository'] = json.loads(util.url_get(tool_shed_url, pathspec=['api', 'repositories', tsr_id]))
        del found_repository['current_changeset']
        repository_data['repository']['metadata'] = found_repository
        repository_data['tool_shed_url'] = tool_shed_url
    else:
        repository_data['repository'] = json.loads(util.url_get(tool_shed_url, pathspec=['api', 'repositories', tsr_id]))
        repository_data['repository']['metadata'] = json.loads(util.url_get(tool_shed_url, pathspec=['api', 'repositories', tsr_id, 'metadata']))
    repository_data['shed_conf'] = tool_util.build_shed_tool_conf_select_field(trans.app).get_html().replace('\n', '')
    repository_data['panel_section_html'] = tool_panel_section_select_field.get_html(extra_attr={'style': 'width:    30em;'}).replace('\n', '')
    repository_data['panel_section_dict'] = tool_panel_section_dict
    for (changeset, metadata) in repository_data['repository']['metadata'].items():
        if (changeset not in tool_dependencies):
            tool_dependencies[changeset] = []
        if metadata['includes_tools_for_display_in_tool_panel']:
            if (changeset not in tools):
                tools[changeset] = []
            for tool_dict in metadata['tools']:
                tool_info = dict(clean=re.sub('[^a-zA-Z0-9]+', '_', tool_dict['name']).lower(), guid=tool_dict['guid'], name=tool_dict['name'], version=tool_dict['version'], description=tool_dict['description'])
                if (tool_info not in tools[changeset]):
                    tools[changeset].append(tool_info)
            if metadata['has_repository_dependencies']:
                for repository_dependency in metadata['repository_dependencies']:
                    tools[changeset] = self.__get_tools(repository_dependency, tools[changeset])
            repository_data['tools'] = tools
        for (key, dependency_dict) in metadata['tool_dependencies'].items():
            if ('readme' in dependency_dict):
                del dependency_dict['readme']
            if (dependency_dict not in tool_dependencies[changeset]):
                tool_dependencies[changeset].append(dependency_dict)
        if metadata['has_repository_dependencies']:
            for repository_dependency in metadata['repository_dependencies']:
                tool_dependencies[changeset] = self.__get_tool_dependencies(repository_dependency, tool_dependencies[changeset])
    repository_data['tool_dependencies'] = tool_dependencies
    return repository_data
