'PATCH /api/repositories/{encoded_repository_id}
Updates information about a repository in the Tool Shed.
:param id: the encoded id of the Repository object
:param payload: dictionary structure containing::
\'name\':                  repo\'s name (optional)
\'synopsis\':              repo\'s synopsis (optional)
\'description\':           repo\'s description (optional)
\'remote_repository_url\': repo\'s remote repo (optional)
\'homepage_url\':          repo\'s homepage url (optional)
\'category_ids\':          list of existing encoded TS category ids
the updated repo should be associated with (optional)
:type payload: dict
:returns:   detailed repository information
:rtype:     dict
:raises: RequestParameterInvalidException, InsufficientPermissionsException'

@expose_api
def update(self, trans, id, **kwd):

    payload = kwd.get('payload', None)
    if (not payload):
        raise RequestParameterMissingException('You    did    not    specify    any    payload.')
    name = payload.get('name', None)
    synopsis = payload.get('synopsis', None)
    description = payload.get('description', None)
    remote_repository_url = payload.get('remote_repository_url', None)
    homepage_url = payload.get('homepage_url', None)
    category_ids = payload.get('category_ids', None)
    if (category_ids is not None):
        category_ids = util.listify(category_ids)
    update_kwds = dict(name=name, description=synopsis, long_description=description, remote_repository_url=remote_repository_url, homepage_url=homepage_url, category_ids=category_ids)
    (repo, message) = repository_util.update_repository(app=self.app, trans=trans, id=id, **update_kwds)
    if (repo is None):
        if ('You    are    not    the    owner' in message):
            raise InsufficientPermissionsException(message)
        else:
            raise ActionInputError(message)
    repository_dict = repo.to_dict(view='element', value_mapper=self.__get_value_mapper(trans))
    repository_dict['category_ids'] = [trans.security.encode_id(x.category.id) for x in repo.categories]
    return repository_dict
