1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/8be96f5579e7/ Changeset: 8be96f5579e7 User: carlfeberhard Date: 2013-08-01 21:21:46 Summary: API Documentation: libraries, library_contents Affected #: 2 files diff -r d34d6d1da813bfa6e318b0ceb563186e52d94095 -r 8be96f5579e7f228fac8e7b70ac4bbec261b445d lib/galaxy/webapps/galaxy/api/libraries.py --- a/lib/galaxy/webapps/galaxy/api/libraries.py +++ b/lib/galaxy/webapps/galaxy/api/libraries.py @@ -15,9 +15,18 @@ @web.expose_api def index( self, trans, deleted='False', **kwd ): """ - GET /api/libraries - GET /api/libraries/deleted - Displays a collection (list) of libraries. + index( self, trans, deleted='False', **kwd ) + * GET /api/libraries: + returns a list of summary data for libraries + * GET /api/libraries/deleted: + returns a list of summary data for deleted libraries + + :type deleted: boolean + :param deleted: if True, show only deleted libraries, if False, non-deleted + + :rtype: list + :returns: list of dictionaries containing library information + .. seealso:: :attr:`galaxy.model.Library.api_collection_visible_keys` """ log.debug( "LibrariesController.index: enter" ) query = trans.sa_session.query( trans.app.model.Library ) @@ -49,9 +58,20 @@ @web.expose_api def show( self, trans, id, deleted='False', **kwd ): """ - GET /api/libraries/{encoded_library_id} - GET /api/libraries/deleted/{encoded_library_id} - Displays information about a library. + show( self, trans, id, deleted='False', **kwd ) + * GET /api/libraries/{id}: + returns detailed information about a library + * GET /api/libraries/deleted/{id}: + returns detailed information about a deleted library + + :type id: an encoded id string + :param id: the encoded id of the library + :type deleted: boolean + :param deleted: if True, allow information on a deleted library + + :rtype: dictionary + :returns: detailed library information + .. seealso:: :attr:`galaxy.model.Library.api_element_visible_keys` """ log.debug( "LibraryContentsController.show: enter" ) library_id = id @@ -75,8 +95,20 @@ @web.expose_api def create( self, trans, payload, **kwd ): """ - POST /api/libraries - Creates a new library. + create( self, trans, payload, **kwd ) + * POST /api/libraries: + create a new library + .. note:: Currently, only admin users can create libraries. + + :type payload: dict + :param payload: (optional) dictionary structure containing:: + 'name': the new library's name + 'description': the new library's description + 'synopsis': the new library's synopsis + + :rtype: dict + :returns: a dictionary containing the id, name, and 'show' url + of the new library """ if not trans.user_is_admin(): raise HTTPForbidden( detail='You are not authorized to create a new library.' ) @@ -102,6 +134,19 @@ @web.expose_api def delete( self, trans, id, **kwd ): + """ + delete( self, trans, id, **kwd ) + * DELETE /api/histories/{id} + mark the library with the given ``id`` as deleted + .. note:: Currently, only admin users can delete libraries. + + :type id: str + :param id: the encoded id of the library to delete + + :rtype: dictionary + :returns: detailed library information + .. seealso:: :attr:`galaxy.model.Library.api_element_visible_keys` + """ if not trans.user_is_admin(): raise HTTPForbidden( detail='You are not authorized to delete libraries.' ) try: diff -r d34d6d1da813bfa6e318b0ceb563186e52d94095 -r 8be96f5579e7f228fac8e7b70ac4bbec261b445d lib/galaxy/webapps/galaxy/api/library_contents.py --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -19,8 +19,21 @@ # TODO: Add parameter to only get top level of datasets/subfolders. def index( self, trans, library_id, **kwd ): """ - GET /api/libraries/{encoded_library_id}/contents - Displays a collection (list) of library contents (files and folders). + index( self, trans, library_id, **kwd ) + * GET /api/libraries/{library_id}/contents: + return a list of library files and folders + + :type library_id: str + :param library_id: encoded id string of the library that contains this item + + :rtype: list + :returns: list of dictionaries of the form: + + * id: the encoded id of the library item + * name: the 'libary path' + or relationship of the library item to the root + * type: 'file' or 'folder' + * url: the url to get detailed information on the library item """ rval = [] current_user_roles = trans.get_current_user_roles() @@ -80,8 +93,20 @@ @web.expose_api def show( self, trans, id, library_id, **kwd ): """ - GET /api/libraries/{encoded_library_id}/contents/{encoded_content_id} - Displays information about a library content (file or folder). + show( self, trans, id, library_id, **kwd ) + * GET /api/libraries/{library_id}/contents/{id} + return information about library file or folder + + :type id: str + :param id: the encoded id of the library item to return + :type library_id: str + :param library_id: encoded id string of the library that contains this item + + :rtype: dict + :returns: detailed library item information + .. seealso:: + :func:`galaxy.model.LibraryDataset.get_api_value` and + :attr:`galaxy.model.LibraryFolder.api_element_visible_keys` """ class_name, content_id = self.__decode_library_content_id( trans, id ) if class_name == 'LibraryFolder': @@ -93,8 +118,29 @@ @web.expose_api def create( self, trans, library_id, payload, **kwd ): """ - POST /api/libraries/{encoded_library_id}/contents - Creates a new library content item (file or folder). + create( self, trans, library_id, payload, **kwd ) + * POST /api/libraries/{library_id}/contents: + create a new library file or folder + + To copy an HDA into a library send ``create_type`` of 'file' and + the HDA's encoded id in ``from_hda_id`` (and optionally ``ldda_message``). + + :type library_id: str + :param library_id: encoded id string of the library that contains this item + :type payload: dict + :param payload: dictionary structure containing: + + * folder_id: the parent folder of the new item + * create_type: the type of item to create ('file' or 'folder') + * from_hda_id: (optional) the id of an accessible HDA to copy into the + library + * ldda_message: (optional) the new message attribute of the LDDA created + * extended_metadata: (optional) dub-dictionary containing any extended + metadata to associate with the item + + :rtype: dict + :returns: a dictionary containing the id, name, + and 'show' url of the new item """ create_type = None if 'create_type' not in payload: @@ -195,10 +241,10 @@ def _copy_hda_to_library_folder( self, trans, from_hda_id, library_id, folder_id, ldda_message='' ): """ - Copies hda `from_hda_id` to library folder `library_folder_id` optionally - adding `ldda_message` to the new ldda's `message`. + Copies hda ``from_hda_id`` to library folder ``library_folder_id`` optionally + adding ``ldda_message`` to the new ldda's ``message``. - `library_contents.create` will branch to this if called with 'from_hda_id' + ``library_contents.create`` will branch to this if called with 'from_hda_id' in it's payload. """ log.debug( '_copy_hda_to_library_folder: %s' %( str(( from_hda_id, library_id, folder_id, ldda_message )) ) ) @@ -236,10 +282,23 @@ return rval @web.expose_api - def update( self, trans, id, library_id, payload, **kwd ): + def update( self, trans, id, library_id, payload, **kwd ): """ - PUT /api/libraries/{encoded_library_id}/contents/{encoded_content_type_and_id} - Sets relationships among items + update( self, trans, id, library_id, payload, **kwd ) + * PUT /api/libraries/{library_id}/contents/{id} + create a ImplicitlyConvertedDatasetAssociation + .. seealso:: :class:`galaxy.model.ImplicitlyConvertedDatasetAssociation` + + :type id: str + :param id: the encoded id of the library item to return + :type library_id: str + :param library_id: encoded id string of the library that contains this item + :type payload: dict + :param payload: dictionary structure containing:: + 'converted_dataset_id': + + :rtype: None + :returns: None """ if 'converted_dataset_id' in payload: converted_id = payload.pop( 'converted_dataset_id' ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.