Skip to content

Commit

Permalink
Merge branch 'release/v0.20.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ja573 committed Mar 27, 2023
2 parents 9cc04b1 + 05749b9 commit 0619ebf
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 254 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Install is either via pip or cloning the repository.

From pip:
```sh
python3 -m pip install thothlibrary==0.19.0
python3 -m pip install thothlibrary==0.20.0
```

Or from the repo:
Expand Down
2 changes: 1 addition & 1 deletion thothlibrary/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""GraphQL client for Thoth"""

__version__ = "0.19.0"
__version__ = "0.20.0"
__author__ = "Javier Arias <[email protected]>"
__copyright__ = "Copyright (c) 2020 Open Book Publishers"
__license__ = "Apache 2.0"
Expand Down
60 changes: 43 additions & 17 deletions thothlibrary/thoth-0_9_0/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,16 +747,19 @@ def subject_count(self, subject_types: str = "", search: str = "",

def works(self, limit: int = 100, offset: int = 0, search: str = "",
order: str = None, publishers: str = None, work_types: str = None,
work_status: str = None, raw: bool = False):
work_status: str = None, work_statuses: str = None,
updated_at_with_relations: str = None, raw: bool = False):
"""
Returns works
@param limit: the maximum number of results to return
@param order: a GraphQL order query statement
@param offset: the offset from which to retrieve results
@param publishers: a list of publishers to limit by
@param search: a filter string to search
@param work_types: the work type (e.g. MONOGRAPH)
@param work_status: the work status (e.g. ACTIVE)
@param work_types: the work types (e.g. [MONOGRAPH, TEXTBOOK])
@param work_status: (deprecated) the work status (e.g. ACTIVE)
@param work_statuses: the work statuses (e.g. [ACTIVE])
@param updated_at_with_relations: timestamp and choice of greater/less than, for limiting results by last update time
@param raw: whether to return a python object or the raw server result
@return: either an object (default) or raw server response
"""
Expand All @@ -775,6 +778,9 @@ def works(self, limit: int = 100, offset: int = 0, search: str = "",
self._dictionary_append(parameters, 'publishers', publishers)
self._dictionary_append(parameters, 'workTypes', work_types)
self._dictionary_append(parameters, 'workStatus', work_status)
self._dictionary_append(parameters, 'workStatuses', work_statuses)
self._dictionary_append(
parameters, 'updatedAtWithRelations', updated_at_with_relations)

return self._api_request("works", parameters, return_raw=raw)

Expand Down Expand Up @@ -804,15 +810,17 @@ def work_by_id(self, work_id: str, raw: bool = False):

return self._api_request("work", parameters, return_raw=raw)

def work_count(self, search: str = "", publishers: str = None,
work_types: str = None, work_status: str = None,
raw: bool = False):
def work_count(self, search: str = "", publishers: str = None, work_types: str = None,
work_status: str = None, work_statuses: str = None,
updated_at_with_relations: str = None, raw: bool = False):
"""
A count of works
@param search: a search string
@param publishers: a list of publishers by which to limit results
@param work_types: the work type (e.g. MONOGRAPH)
@param work_status: the work status (e.g. ACTIVE)
@param work_types: the work types (e.g. [MONOGRAPH, TEXTBOOK])
@param work_status: (deprecated) the work status (e.g. ACTIVE)
@param work_statuses: the work statuses (e.g. [ACTIVE])
@param updated_at_with_relations: timestamp and choice of greater/less than, for limiting results by last update time
@param raw: whether to return a raw result
@return: a count of works
"""
Expand All @@ -825,20 +833,25 @@ def work_count(self, search: str = "", publishers: str = None,
self._dictionary_append(parameters, 'publishers', publishers)
self._dictionary_append(parameters, 'workTypes', work_types)
self._dictionary_append(parameters, 'workStatus', work_status)
self._dictionary_append(parameters, 'workStatuses', work_statuses)
self._dictionary_append(
parameters, 'updatedAtWithRelations', updated_at_with_relations)

return self._api_request("workCount", parameters, return_raw=raw)

def books(self, limit: int = 100, offset: int = 0, search: str = "",
order: str = None, publishers: str = None,
work_status: str = None, raw: bool = False):
order: str = None, publishers: str = None, work_status: str = None,
work_statuses: str = None, updated_at_with_relations: str = None, raw: bool = False):
"""
Returns books
@param limit: the maximum number of results to return
@param order: a GraphQL order query statement
@param offset: the offset from which to retrieve results
@param publishers: a list of publishers to limit by
@param search: a filter string to search
@param work_status: the work status (e.g. ACTIVE)
@param work_status: (deprecated) the work status (e.g. ACTIVE)
@param work_statuses: the work statuses (e.g. [ACTIVE])
@param updated_at_with_relations: timestamp and choice of greater/less than, for limiting results by last update time
@param raw: whether to return a python object or the raw server result
@return: either an object (default) or raw server response
"""
Expand All @@ -856,20 +869,25 @@ def books(self, limit: int = 100, offset: int = 0, search: str = "",
self._dictionary_append(parameters, 'order', order)
self._dictionary_append(parameters, 'publishers', publishers)
self._dictionary_append(parameters, 'workStatus', work_status)
self._dictionary_append(parameters, 'workStatuses', work_statuses)
self._dictionary_append(
parameters, 'updatedAtWithRelations', updated_at_with_relations)

return self._api_request("books", parameters, return_raw=raw)

def bookIds(self, limit: int = 100, offset: int = 0, search: str = "",
order: str = None, publishers: str = None,
work_status: str = None, raw: bool = False):
order: str = None, publishers: str = None, work_status: str = None,
work_statuses: str = None, updated_at_with_relations: str = None, raw: bool = False):
"""
Returns books, in a minimal representation containing only workId
@param limit: the maximum number of results to return
@param order: a GraphQL order query statement
@param offset: the offset from which to retrieve results
@param publishers: a list of publishers to limit by
@param search: a filter string to search
@param work_status: the work status (e.g. ACTIVE)
@param work_status: (deprecated) the work status (e.g. ACTIVE)
@param work_statuses: the work statuses (e.g. [ACTIVE])
@param updated_at_with_relations: timestamp and choice of greater/less than, for limiting results by last update time
@param raw: whether to return a python object or the raw server result
@return: either an object (default) or raw server response
"""
Expand All @@ -887,16 +905,21 @@ def bookIds(self, limit: int = 100, offset: int = 0, search: str = "",
self._dictionary_append(parameters, 'order', order)
self._dictionary_append(parameters, 'publishers', publishers)
self._dictionary_append(parameters, 'workStatus', work_status)
self._dictionary_append(parameters, 'workStatuses', work_statuses)
self._dictionary_append(
parameters, 'updatedAtWithRelations', updated_at_with_relations)

return self._api_request("bookIds", parameters, return_raw=raw)

def book_count(self, search: str = "", publishers: str = None,
work_status: str = None, raw: bool = False):
def book_count(self, search: str = "", publishers: str = None, work_status: str = None,
work_statuses: str = None, updated_at_with_relations: str = None, raw: bool = False):
"""
A count of books
@param search: a search string
@param publishers: a list of publishers by which to limit results
@param work_status: the work status (e.g. ACTIVE)
@param work_status: (deprecated) the work status (e.g. ACTIVE)
@param work_statuses: the work statuses (e.g. [ACTIVE])
@param updated_at_with_relations: timestamp and choice of greater/less than, for limiting results by last update time
@param raw: whether to return a raw result
@return: a count of works
"""
Expand All @@ -908,5 +931,8 @@ def book_count(self, search: str = "", publishers: str = None,
self._dictionary_append(parameters, 'filter', search)
self._dictionary_append(parameters, 'publishers', publishers)
self._dictionary_append(parameters, 'workStatus', work_status)
self._dictionary_append(parameters, 'workStatuses', work_statuses)
self._dictionary_append(
parameters, 'updatedAtWithRelations', updated_at_with_relations)

return self._api_request("bookCount", parameters, return_raw=raw)
Loading

0 comments on commit 0619ebf

Please sign in to comment.