diff --git a/thothlibrary/thoth-0_9_0/endpoints.py b/thothlibrary/thoth-0_9_0/endpoints.py index 521a85b..c11516d 100644 --- a/thothlibrary/thoth-0_9_0/endpoints.py +++ b/thothlibrary/thoth-0_9_0/endpoints.py @@ -747,7 +747,8 @@ 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 @@ -755,8 +756,10 @@ def works(self, limit: int = 100, offset: int = 0, search: str = "", @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 """ @@ -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) @@ -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 """ @@ -825,12 +833,15 @@ 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 @@ -838,7 +849,9 @@ def books(self, limit: int = 100, offset: int = 0, search: str = "", @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 """ @@ -856,12 +869,15 @@ 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 @@ -869,7 +885,9 @@ def bookIds(self, limit: int = 100, offset: int = 0, search: str = "", @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 """ @@ -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 """ @@ -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) diff --git a/thothlibrary/thoth-0_9_0/fixtures/QUERIES b/thothlibrary/thoth-0_9_0/fixtures/QUERIES index 99bf0b5..e1a81fc 100644 --- a/thothlibrary/thoth-0_9_0/fixtures/QUERIES +++ b/thothlibrary/thoth-0_9_0/fixtures/QUERIES @@ -14,18 +14,9 @@ "workId", "work { fullTitle }", "contributor {firstName lastName fullName orcid __typename website contributorId}" - ], - "parameters": [ - "contributionId" - ] - }, - "contributionCount": { - "parameters": [ - "filter", - "publishers", - "contributionType" ] }, + "contributionCount": {}, "contributions": { "fields": [ "contributionId", @@ -41,14 +32,6 @@ "workId", "work { fullTitle }", "contributor {firstName lastName fullName orcid __typename website contributorId}" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers", - "contributionType" ] }, "contributor": { @@ -60,16 +43,9 @@ "orcid", "__typename", "contributions { contributionId contributionType work { workId fullTitle} }" - ], - "parameters": [ - "contributorId" - ] - }, - "contributorCount": { - "parameters": [ - "filter" ] }, + "contributorCount": {}, "contributors": { "fields": [ "contributorId", @@ -79,12 +55,6 @@ "orcid", "__typename", "contributions { contributionId contributionType work { workId fullTitle} }" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order" ] }, "institution": { @@ -95,9 +65,6 @@ "fundings { grantNumber program projectName projectShortname jurisdiction institutionId work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } imprint { publisher { publisherName publisherId } } } }", "affiliations { affiliationOrdinal position contribution { fullName contributionType mainContribution contributionOrdinal } }", "__typename" - ], - "parameters": [ - "institutionId" ] }, "institutions": { @@ -110,12 +77,6 @@ "fundings { grantNumber program projectName projectShortname jurisdiction institutionId work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } imprint { publisher { publisherName publisherId } } } }", "affiliations { affiliationOrdinal position contribution { fullName contributionType mainContribution contributionOrdinal } }", "__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order" ] }, "funding": { @@ -131,9 +92,6 @@ "jurisdiction", "work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } imprint { publisher { publisherName publisherId } } }", "__typename" - ], - "parameters": [ - "fundingId" ] }, "fundingCount": {}, @@ -150,12 +108,6 @@ "jurisdiction", "work { workId fullTitle doi publicationDate place contributions(order: {field: CONTRIBUTION_ORDINAL, direction: ASC}) { fullName contributionType mainContribution contributionOrdinal } imprint { publisher { publisherName publisherId } } }", "__typename" - ], - "parameters": [ - "limit", - "offset", - "publishers", - "order" ] }, "imprint": { @@ -168,17 +120,9 @@ "publisherId", "publisher { publisherName publisherId }", "works { workId fullTitle doi publicationDate place contributions(order: {field: CONTRIBUTION_ORDINAL, direction: ASC}) { fullName contributionType mainContribution contributionOrdinal } }__typename" - ], - "parameters": [ - "imprintId" - ] - }, - "imprintCount": { - "parameters": [ - "filter", - "publishers" ] }, + "imprintCount": {}, "imprints": { "fields": [ "imprintUrl", @@ -189,13 +133,6 @@ "publisherId", "publisher { publisherName publisherId }", "works { workId fullTitle doi publicationDate place contributions(order: {field: CONTRIBUTION_ORDINAL, direction: ASC}) { fullName contributionType mainContribution contributionOrdinal } }__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers" ] }, "issue": { @@ -207,9 +144,6 @@ "createdAt", "series { seriesId seriesType seriesName imprintId imprint { __typename publisher { publisherName publisherId __typename } }}", "work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } }__typename" - ], - "parameters": [ - "issueId" ] }, "issues": { @@ -221,13 +155,6 @@ "createdAt", "series { seriesId seriesType seriesName imprintId imprint { __typename publisher { publisherName publisherId __typename } }}", "work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } }__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers" ] }, "issuesCount": {}, @@ -240,17 +167,9 @@ "createdAt", "mainLanguage", "work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } }__typename" - ], - "parameters": [ - "languageId" - ] - }, - "languageCount": { - "parameters": [ - "languageCodes", - "languageRelation" ] }, + "languageCount": {}, "languages": { "fields": [ "languageId", @@ -260,15 +179,6 @@ "createdAt", "mainLanguage", "work { workId fullTitle doi publicationDate place contributions(order: {field: CONTRIBUTION_ORDINAL, direction: ASC}) { fullName contributionType mainContribution contributionOrdinal } }__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers", - "languageCodes", - "languageRelation" ] }, "price": { @@ -281,16 +191,9 @@ "createdAt", "updatedAt", "__typename" - ], - "parameters": [ - "priceId" - ] - }, - "priceCount": { - "parameters": [ - "currencyCode" ] }, + "priceCount": {}, "prices": { "fields": [ "currencyCode", @@ -301,14 +204,6 @@ "createdAt", "updatedAt", "__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers", - "currencyCode" ] }, "publication": { @@ -327,18 +222,9 @@ "prices { currencyCode unitPrice __typename}", "work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } imprint { publisher { publisherName publisherId } } }", "__typename" - ], - "parameters": [ - "publicationId" - ] - }, - "publicationCount": { - "parameters": [ - "filter", - "publishers", - "publicationType" ] }, + "publicationCount": {}, "publications": { "fields": [ "publicationId", @@ -351,14 +237,6 @@ "prices { currencyCode unitPrice __typename}", "work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } imprint { publisher { publisherName publisherId } } }", "__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers", - "publicationType" ] }, "publisher": { @@ -370,17 +248,9 @@ "publisherShortname", "publisherUrl", "__typename" - ], - "parameters": [ - "publisherId" - ] - }, - "publisherCount": { - "parameters": [ - "filter", - "publishers" ] }, + "publisherCount": {}, "publishers": { "fields": [ "imprints { imprintUrl imprintId imprintName __typename}updatedAt", @@ -390,13 +260,6 @@ "publisherShortname", "publisherUrl", "__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers" ] }, "reference": { @@ -428,9 +291,6 @@ "updatedAt", "work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } imprint { publisher { publisherName publisherId } } }", "__typename" - ], - "parameters": [ - "referenceId" ] }, "references": { @@ -462,13 +322,6 @@ "updatedAt", "work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } imprint { publisher { publisherName publisherId } } }", "__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers" ] }, "series": { @@ -482,18 +335,9 @@ "imprint { __typename publisher { publisherName publisherId __typename } }", "issues { issueId work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } } }", "__typename" - ], - "parameters": [ - "seriesId" - ] - }, - "seriesCount": { - "parameters": [ - "filter", - "publishers", - "seriesType" ] }, + "seriesCount": {}, "serieses": { "fields": [ "seriesId", @@ -505,14 +349,6 @@ "imprint { __typename publisher { publisherName publisherId __typename } }", "issues { issueId work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } } }", "__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers", - "seriesType" ] }, "subject": { @@ -524,17 +360,9 @@ "subjectOrdinal", "createdAt", "work { workId fullTitle doi publicationDate place contributions(order: {field: CONTRIBUTION_ORDINAL, direction: ASC}) { fullName contributionType mainContribution contributionOrdinal } }__typename" - ], - "parameters": [ - "subjectId" - ] - }, - "subjectCount": { - "parameters": [ - "filter", - "subjectTypes" ] }, + "subjectCount": {}, "subjects": { "fields": [ "subjectId", @@ -544,14 +372,6 @@ "subjectOrdinal", "createdAt", "work { workId fullTitle doi publicationDate place contributions { fullName contributionType mainContribution contributionOrdinal } }__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers", - "subjectTypes" ] }, "work": { @@ -595,9 +415,6 @@ "imprint { __typename publisher { publisherName publisherId __typename } }", "subjects { subjectId, subjectType, subjectCode, subjectOrdinal, __typename }", "__typename" - ], - "parameters": [ - "workId" ] }, "workByDoi": { @@ -639,19 +456,9 @@ "contributions { fullName contributionType mainContribution contributor { contributorId orcid firstName lastName fullName } contributionId contributionOrdinal __typename }", "imprint { __typename publisher { publisherName publisherId __typename } }", "__typename" - ], - "parameters": [ - "doi" - ] - }, - "workCount": { - "parameters": [ - "filter", - "publishers", - "workType", - "workStatus" ] }, + "workCount": {}, "works": { "fields": [ "workType", @@ -688,24 +495,9 @@ "contributions(order: {field: CONTRIBUTION_ORDINAL, direction: ASC}) { fullName contributionType mainContribution affiliations { affiliationId institution { institutionName institutionId ror fundings { institutionId program projectName projectShortname grantNumber jurisdiction } } } contributor { contributorId orcid firstName lastName fullName } contributionId contributionOrdinal __typename }", "imprint { __typename publisher { publisherName publisherId __typename } }", "__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers", - "workType", - "workStatus" - ] - }, - "bookCount": { - "parameters": [ - "filter", - "publishers", - "workStatus" ] }, + "bookCount": {}, "books": { "fields": [ "workType", @@ -742,14 +534,6 @@ "contributions(order: {field: CONTRIBUTION_ORDINAL, direction: ASC}) { fullName contributionType mainContribution affiliations { affiliationId institution { institutionName institutionId ror fundings { institutionId program projectName projectShortname grantNumber jurisdiction } } } contributor { contributorId orcid firstName lastName fullName } contributionId contributionOrdinal __typename }", "imprint { __typename publisher { publisherName publisherId __typename } }", "__typename" - ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers", - "workStatus" ] }, "bookIds": { @@ -757,14 +541,6 @@ "workId", "__typename" ], - "parameters": [ - "limit", - "offset", - "filter", - "order", - "publishers", - "workStatus" - ], "aliasOf": "books" } }