'GET /api/repositories/{encoded_repository_id}/metadata
Returns information about a repository in the Tool Shed.
Example URL: http://localhost:9009/api/repositories/f9cad7b01a472135/metadata
:param id: the encoded id of the Repository object
:returns:   A dictionary containing the specified repository\'s metadata, by changeset,
recursively including dependencies and their metadata.
:not found:  Empty dictionary.'

@expose_api_anonymous_and_sessionless
def metadata(self, trans, id, **kwd):

    try:
        trans.security.decode_id(id)
    except Exception:
        raise MalformedId('The    given    id    is    invalid.')
    recursive = util.asbool(kwd.get('recursive', 'True'))
    all_metadata = {}
    repository = repository_util.get_repository_in_tool_shed(self.app, id)
    for (changeset, changehash) in repository.installable_revisions(self.app):
        metadata = metadata_util.get_current_repository_metadata_for_changeset_revision(self.app, repository, changehash)
        if (metadata is None):
            continue
        metadata_dict = metadata.to_dict(value_mapper={'id': self.app.security.encode_id, 'repository_id': self.app.security.encode_id})
        metadata_dict['repository'] = repository.to_dict(value_mapper={'id': self.app.security.encode_id})
        if (metadata.has_repository_dependencies and recursive):
            metadata_dict['repository_dependencies'] = metadata_util.get_all_dependencies(self.app, metadata, processed_dependency_links=[])
        else:
            metadata_dict['repository_dependencies'] = []
        if (metadata.includes_tool_dependencies and recursive):
            metadata_dict['tool_dependencies'] = repository.get_tool_dependencies(self.app, changehash)
        else:
            metadata_dict['tool_dependencies'] = {}
        if metadata.includes_tools:
            metadata_dict['tools'] = metadata.metadata['tools']
        all_metadata[('%s:%s' % (int(changeset), changehash))] = metadata_dict
    return all_metadata
