'index( self, trans, history_id, ids=None, **kwd )
* GET /api/histories/{history_id}/contents
return a list of HDA data for the history with the given ``id``
.. note:: Anonymous users are allowed to get their current history contents
If Ids is not given, index returns a list of *summary* objects for
every HDA associated with the given `history_id`.
If ids is given, index returns a *more complete* json object for each
HDA in the ids list.
:type   history_id: str
:param  history_id: encoded id string of the HDA\'s History
:type   ids:        str
:param  ids:        (optional) a comma separated list of encoded `HDA` ids
:param  types:      (optional) kinds of contents to index (currently just
dataset, but dataset_collection will be added shortly).
:type   types:      str
:rtype:     list
:returns:   dictionaries containing summary or detailed HDA information'

@expose_api_anonymous
def index(self, trans, history_id, ids=None, v=None, **kwd):

    if (v == 'dev'):
        return self.__index_v2(trans, history_id, **kwd)
    rval = []
    history = self.history_manager.get_accessible(self.decode_id(history_id), trans.user, current_history=trans.history)
    types = (kwd.get('type', kwd.get('types', None)) or [])
    if types:
        types = util.listify(types)
    else:
        types = ['dataset', 'dataset_collection']
    contents_kwds = {'types': types}
    if ids:
        ids = map((lambda id: self.decode_id(id)), ids.split(','))
        contents_kwds['ids'] = ids
        details = 'all'
    else:
        contents_kwds['deleted'] = kwd.get('deleted', None)
        contents_kwds['visible'] = kwd.get('visible', None)
        details = (kwd.get('details', None) or kwd.get('dataset_details', None) or [])
        if (details and (details != 'all')):
            details = util.listify(details)
    for content in history.contents_iter(**contents_kwds):
        encoded_content_id = trans.security.encode_id(content.id)
        detailed = ((details == 'all') or (encoded_content_id in details))
        if isinstance(content, trans.app.model.HistoryDatasetAssociation):
            view = ('detailed' if detailed else 'summary')
            hda_dict = self.hda_serializer.serialize_to_view(content, view=view, user=trans.user, trans=trans)
            rval.append(hda_dict)
        elif isinstance(content, trans.app.model.HistoryDatasetCollectionAssociation):
            view = ('element' if detailed else 'collection')
            collection_dict = self.__collection_dict(trans, content, view=view)
            rval.append(collection_dict)
    return rval
