diff --git a/doc/index.rst b/doc/index.rst index 24f38d4..75a689e 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -166,6 +166,12 @@ The following methods will retrieve either user or group items, depending on the :rtype: list of dicts + .. py:method:: Zotero.publications() + + Returns the publications from the "My Publications" collection of a user's library. Only available on ``user`` libraries. + + :rtype: list of dicts + .. py:method:: Zotero.trash([search/request parameters]) Returns library items from the library's trash diff --git a/pyzotero/zotero.py b/pyzotero/zotero.py index 84ce0f7..e583805 100644 --- a/pyzotero/zotero.py +++ b/pyzotero/zotero.py @@ -33,7 +33,7 @@ from __future__ import unicode_literals __author__ = u'Stephan Hügel' -__version__ = '1.2.13' +__version__ = '1.2.14' __api_version__ = '3' # Python 3 compatibility faffing @@ -397,6 +397,15 @@ def _build_query(self, query_string, no_params=False): query = '%s?%s' % (query, self.url_params) return query + @retrieve + def publications(self): + """ Return the contents of My Publications + """ + if self.library_type != 'users': + raise ze.CallDoesNotExist("This API call does not exist for group libraries") + query_string = '/{t}/{u}/publications/items' + return self._build_query(query_string) + # The following methods are Zotero Read API calls def num_items(self): """ Return the total number of top-level items in the library