'* DELETE /api/libraries/{id}
marks the library with the given ``id`` as `deleted` (or removes the `deleted` mark if the `undelete` param is true)
.. note:: Currently, only admin users can un/delete libraries.
:param  id:     the encoded id of the library to un/delete
:type   id:     an encoded id string
:param   payload: dictionary structure containing:
:param  undelete:    (optional) flag specifying whether the item should be deleted or undeleted, defaults to false:
:type   undelete:    bool
:type:     dictionary
:returns:   detailed library information
:rtype:     dictionary
.. seealso:: :attr:`galaxy.model.Library.dict_element_visible_keys`'

@expose_api
def delete(self, trans, id, payload=None, **kwd):

    if payload:
        kwd.update(payload)
    library = self.library_manager.get(trans, self.__decode_id(trans, id, 'library'))
    undelete = util.string_as_bool(kwd.get('undelete', False))
    library = self.library_manager.delete(trans, library, undelete)
    library_dict = self.library_manager.get_library_dict(trans, library)
    return library_dict
