Skip to content

Commit

Permalink
Add a method for retrieving a user's publications
Browse files Browse the repository at this point in the history
  • Loading branch information
urschrei committed Oct 8, 2017
1 parent b177aa8 commit e3971c7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions doc/index.rst
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion pyzotero/zotero.py
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e3971c7

Please sign in to comment.